diff --git a/adonisrc.ts b/adonisrc.ts index edd4ac4..7e77f98 100644 --- a/adonisrc.ts +++ b/adonisrc.ts @@ -1,4 +1,4 @@ -import { defineConfig } from '@adonisjs/core/app' +import { defineConfig } from '@adonisjs/core/app'; export default defineConfig({ /* @@ -44,7 +44,7 @@ export default defineConfig({ () => import('@adonisjs/inertia/inertia_provider'), () => import('@adonisjs/ally/ally_provider'), () => import('@izzyjs/route/izzy_provider'), - () => import('#providers/route_provider') + () => import('#providers/route_provider'), ], /* @@ -107,4 +107,4 @@ export default defineConfig({ onBuildStarting: [() => import('@adonisjs/vite/build_hook')], onDevServerStarted: [() => import('@izzyjs/route/dev_hook')], }, -}) +}); diff --git a/app/controllers/favicons_controller.ts b/app/controllers/favicons_controller.ts index ed48ffd..af40025 100644 --- a/app/controllers/favicons_controller.ts +++ b/app/controllers/favicons_controller.ts @@ -1,8 +1,8 @@ import FaviconNotFoundException from '#exceptions/favicon_not_found_exception'; +import { cache } from '#lib/cache'; import type { HttpContext } from '@adonisjs/core/http'; import logger from '@adonisjs/core/services/logger'; import { parse } from 'node-html-parser'; -import { cache } from '../lib/cache.js'; interface Favicon { buffer: Buffer; @@ -11,7 +11,6 @@ interface Favicon { size: number; } -// TODO: refactor this controller (adapted from the previous version of MyLinks) export default class FaviconsController { private userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0'; diff --git a/app/models/collection.ts b/app/models/collection.ts index e638cd7..ac610d6 100644 --- a/app/models/collection.ts +++ b/app/models/collection.ts @@ -3,7 +3,7 @@ import Link from '#models/link'; import User from '#models/user'; import { belongsTo, column, hasMany } from '@adonisjs/lucid/orm'; import type { BelongsTo, HasMany } from '@adonisjs/lucid/types/relations'; -import { Visibility } from '../enums/visibility.js'; +import { Visibility } from '#enums/visibility'; export default class Collection extends AppBaseModel { @column() diff --git a/app/validators/collection.ts b/app/validators/collection.ts index 1277c26..1f9aaf1 100644 --- a/app/validators/collection.ts +++ b/app/validators/collection.ts @@ -1,5 +1,5 @@ +import { Visibility } from '#enums/visibility'; import vine, { SimpleMessagesProvider } from '@vinejs/vine'; -import { Visibility } from '../enums/visibility.js'; const params = vine.object({ id: vine.number(), diff --git a/database/migrations/1714253983443_create_collections_table.ts b/database/migrations/1714253983443_create_collections_table.ts index 26eef62..7880592 100644 --- a/database/migrations/1714253983443_create_collections_table.ts +++ b/database/migrations/1714253983443_create_collections_table.ts @@ -1,6 +1,6 @@ import { defaultTableFields } from '#database/default_table_fields'; +import { Visibility } from '#enums/visibility'; import { BaseSchema } from '@adonisjs/lucid/schema'; -import { Visibility } from '../../app/enums/visibility.js'; export default class CreateCollectionTable extends BaseSchema { static tableName = 'collections'; diff --git a/database/seeders/collection_seeder.ts b/database/seeders/collection_seeder.ts index 6398fd2..4e85344 100644 --- a/database/seeders/collection_seeder.ts +++ b/database/seeders/collection_seeder.ts @@ -1,8 +1,8 @@ +import { Visibility } from '#enums/visibility'; import Collection from '#models/collection'; import User from '#models/user'; import { BaseSeeder } from '@adonisjs/lucid/seeders'; import { faker } from '@faker-js/faker'; -import { Visibility } from '../../app/enums/visibility.js'; export default class extends BaseSeeder { static environment = ['development', 'testing']; diff --git a/docker-config/servers_pgadmin.json b/docker-config/servers_pgadmin.json index 6466d70..43e3b00 100644 --- a/docker-config/servers_pgadmin.json +++ b/docker-config/servers_pgadmin.json @@ -10,4 +10,4 @@ "MaintenanceDB": "my-links" } } -} \ No newline at end of file +} diff --git a/inertia/components/form/form_collection.tsx b/inertia/components/form/form_collection.tsx index fe6e616..082a05e 100644 --- a/inertia/components/form/form_collection.tsx +++ b/inertia/components/form/form_collection.tsx @@ -1,3 +1,4 @@ +import { Visibility } from '#enums/visibility'; import type Collection from '#models/collection'; import { FormEvent } from 'react'; import { useTranslation } from 'react-i18next'; @@ -5,7 +6,6 @@ import Checkbox from '~/components/common/form/checkbox'; import TextBox from '~/components/common/form/textbox'; import BackToDashboard from '~/components/common/navigation/back_to_dashboard'; import FormLayout from '~/components/layouts/form_layout'; -import { Visibility } from '../../../app/enums/visibility'; export type FormCollectionData = { name: string; diff --git a/inertia/components/layouts/content_layout.tsx b/inertia/components/layouts/content_layout.tsx index 5170b62..d1f9cf6 100644 --- a/inertia/components/layouts/content_layout.tsx +++ b/inertia/components/layouts/content_layout.tsx @@ -2,7 +2,7 @@ import styled from '@emotion/styled'; import { ReactNode } from 'react'; import Footer from '~/components/footer/footer'; import TransitionLayout from '~/components/layouts/_transition_layout'; -import Navbar from '../navbar/navbar'; +import Navbar from '~/components/navbar/navbar'; import BaseLayout from './_base_layout'; const ContentLayoutStyle = styled(TransitionLayout)(({ theme }) => ({ diff --git a/inertia/components/navbar/navbar.tsx b/inertia/components/navbar/navbar.tsx index 677aada..79769a1 100644 --- a/inertia/components/navbar/navbar.tsx +++ b/inertia/components/navbar/navbar.tsx @@ -1,3 +1,4 @@ +import PATHS from '#constants/paths'; import styled from '@emotion/styled'; import { Link } from '@inertiajs/react'; import { route } from '@izzyjs/route/client'; @@ -13,7 +14,6 @@ import RoundedImage from '~/components/common/rounded_image'; import UnstyledList from '~/components/common/unstyled/unstyled_list'; import ModalSettings from '~/components/settings/modal'; import useUser from '~/hooks/use_user'; -import PATHS from '../../../app/constants/paths'; type NavbarListDirection = { right?: boolean; diff --git a/inertia/components/visibilty/visibilty.tsx b/inertia/components/visibilty/visibilty.tsx index 54a3f68..74c71d6 100644 --- a/inertia/components/visibilty/visibilty.tsx +++ b/inertia/components/visibilty/visibilty.tsx @@ -1,6 +1,6 @@ +import { Visibility } from '#enums/visibility'; import styled from '@emotion/styled'; import { IoEarthOutline } from 'react-icons/io5'; -import { Visibility } from '../../../app/enums/visibility'; const VisibilityStyle = styled.span(({ theme }) => ({ fontWeight: 300, diff --git a/inertia/i18n/locales/en/about.json b/inertia/i18n/locales/en/about.json index fc7ac29..abac1d9 100644 --- a/inertia/i18n/locales/en/about.json +++ b/inertia/i18n/locales/en/about.json @@ -29,4 +29,4 @@ }, "look-title": "Take a look", "website-screenshot-alt": "A screenshot of MyLinks" -} \ No newline at end of file +} diff --git a/inertia/i18n/locales/en/common.json b/inertia/i18n/locales/en/common.json index ba09c9f..5563e7e 100644 --- a/inertia/i18n/locales/en/common.json +++ b/inertia/i18n/locales/en/common.json @@ -55,4 +55,4 @@ "footer": { "made_by": "Made with ❤\uFE0F by" } -} \ No newline at end of file +} diff --git a/inertia/i18n/locales/en/home.json b/inertia/i18n/locales/en/home.json index 229840a..5324323 100644 --- a/inertia/i18n/locales/en/home.json +++ b/inertia/i18n/locales/en/home.json @@ -2,4 +2,4 @@ "select-collection": "Please select a collection", "or-create-one": "or create one", "no-link": "No link for {{name}}" -} \ No newline at end of file +} diff --git a/inertia/i18n/locales/en/legal.json b/inertia/i18n/locales/en/legal.json index 1851847..ac5e1d0 100644 --- a/inertia/i18n/locales/en/legal.json +++ b/inertia/i18n/locales/en/legal.json @@ -7,4 +7,4 @@ "changes": "We reserve the right to update these Terms and Conditions of Use. We encourage you to regularly check this page to stay informed of any changes.", "thanks": "Thank you for using MyLinks!" } -} \ No newline at end of file +} diff --git a/inertia/i18n/locales/en/login.json b/inertia/i18n/locales/en/login.json index 9602b80..41c3e1e 100644 --- a/inertia/i18n/locales/en/login.json +++ b/inertia/i18n/locales/en/login.json @@ -3,4 +3,4 @@ "informative-text": "Authentication required to use MyLinks", "continue-with": "Continue with {{provider}}", "accept-terms": "By continuing, you accept the" -} \ No newline at end of file +} diff --git a/inertia/i18n/locales/en/privacy.json b/inertia/i18n/locales/en/privacy.json index 9a89f82..a9832fc 100644 --- a/inertia/i18n/locales/en/privacy.json +++ b/inertia/i18n/locales/en/privacy.json @@ -11,13 +11,7 @@ "user": { "title": "1.2 User Data", "description": "To create personalized collections and links and associate them with their author, we collect the following information:", - "fields": [ - "Google ID", - "Lastname", - "Firstname", - "Email", - "Avatar" - ] + "fields": ["Google ID", "Lastname", "Firstname", "Email", "Avatar"] } }, "data_use": { @@ -40,4 +34,4 @@ "title": "5. GDPR Compliance", "description": "MyLinks complies with the General Data Protection Regulation (GDPR) of the European Union." } -} \ No newline at end of file +} diff --git a/inertia/i18n/locales/en/terms.json b/inertia/i18n/locales/en/terms.json index c9bed55..986578e 100644 --- a/inertia/i18n/locales/en/terms.json +++ b/inertia/i18n/locales/en/terms.json @@ -51,4 +51,4 @@ "title": "6. Termination", "description": "MyLinks reserves the right to terminate or suspend your access to the service, with or without notice, in case of violation of these Terms and Conditions of Use." } -} \ No newline at end of file +} diff --git a/inertia/i18n/locales/fr/about.json b/inertia/i18n/locales/fr/about.json index c7f11af..18040b4 100644 --- a/inertia/i18n/locales/fr/about.json +++ b/inertia/i18n/locales/fr/about.json @@ -29,4 +29,4 @@ }, "look-title": "Jetez un coup d'oeil", "website-screenshot-alt": "Une capture d'écran de MyLinks" -} \ No newline at end of file +} diff --git a/inertia/i18n/locales/fr/common.json b/inertia/i18n/locales/fr/common.json index 2470702..a63c08a 100644 --- a/inertia/i18n/locales/fr/common.json +++ b/inertia/i18n/locales/fr/common.json @@ -55,4 +55,4 @@ "footer": { "made_by": "Fait avec ❤\uFE0F par" } -} \ No newline at end of file +} diff --git a/inertia/i18n/locales/fr/home.json b/inertia/i18n/locales/fr/home.json index bc3a7d2..d61115d 100644 --- a/inertia/i18n/locales/fr/home.json +++ b/inertia/i18n/locales/fr/home.json @@ -2,4 +2,4 @@ "select-collection": "Veuillez sélectionner une collection", "or-create-one": "ou en créer une", "no-link": "Aucun lien pour {{name}}" -} \ No newline at end of file +} diff --git a/inertia/i18n/locales/fr/legal.json b/inertia/i18n/locales/fr/legal.json index c80c981..23efbf3 100644 --- a/inertia/i18n/locales/fr/legal.json +++ b/inertia/i18n/locales/fr/legal.json @@ -7,4 +7,4 @@ "changes": "Nous nous réservons le droit de mettre à jour ces Conditions Générales d'Utilisation. Nous vous encourageons à consulter régulièrement cette page pour rester informé des changements éventuels.", "thanks": "Merci d'utiliser MyLinks !" } -} \ No newline at end of file +} diff --git a/inertia/i18n/locales/fr/login.json b/inertia/i18n/locales/fr/login.json index 601dfd1..2ae2260 100644 --- a/inertia/i18n/locales/fr/login.json +++ b/inertia/i18n/locales/fr/login.json @@ -3,4 +3,4 @@ "informative-text": "Authentification requise pour utiliser MyLinks", "continue-with": "Continuer avec {{provider}}", "accept-terms": "En poursuivant, vous acceptez les" -} \ No newline at end of file +} diff --git a/inertia/i18n/locales/fr/privacy.json b/inertia/i18n/locales/fr/privacy.json index c1eb814..3a3463f 100644 --- a/inertia/i18n/locales/fr/privacy.json +++ b/inertia/i18n/locales/fr/privacy.json @@ -40,4 +40,4 @@ "title": "5. Conformité au RGPD", "description": "MyLinks est conforme au Règlement Général sur la Protection des Données (RGPD) de l'Union européenne." } -} \ No newline at end of file +} diff --git a/inertia/i18n/locales/fr/terms.json b/inertia/i18n/locales/fr/terms.json index cfbe8a5..6b5324c 100644 --- a/inertia/i18n/locales/fr/terms.json +++ b/inertia/i18n/locales/fr/terms.json @@ -51,4 +51,4 @@ "title": "6. Résiliation", "description": "MyLinks se réserve le droit de résilier ou de suspendre votre accès au service, avec ou sans préavis, en cas de violation de ces Conditions Générales d'Utilisation." } -} \ No newline at end of file +} diff --git a/inertia/pages/collections/create.tsx b/inertia/pages/collections/create.tsx index 96c3a78..14787bd 100644 --- a/inertia/pages/collections/create.tsx +++ b/inertia/pages/collections/create.tsx @@ -1,3 +1,4 @@ +import { Visibility } from '#enums/visibility'; import { useForm } from '@inertiajs/react'; import { route } from '@izzyjs/route/client'; import { useMemo } from 'react'; @@ -5,7 +6,6 @@ import { useTranslation } from 'react-i18next'; import FormCollection, { FormCollectionData, } from '~/components/form/form_collection'; -import { Visibility } from '../../../app/enums/visibility'; export default function CreateCollectionPage({ disableHomeLink, diff --git a/inertia/tsconfig.json b/inertia/tsconfig.json index 6869ac1..77c19a3 100644 --- a/inertia/tsconfig.json +++ b/inertia/tsconfig.json @@ -14,7 +14,8 @@ "isolatedModules": true, "noEmit": true, "paths": { - "~/*": ["./*"] + "~/*": ["./*"], + "@/*": ["../*"] }, "types": ["vite/client", "@emotion/styled", "@emotion/react"] }, diff --git a/package.json b/package.json index ce4614e..1c410d3 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "#exceptions/*": "./app/exceptions/*.js", "#models/*": "./app/models/*.js", "#constants/*": "./app/constants/*.js", + "#enums/*": "./app/enums/*.js", "#mails/*": "./app/mails/*.js", "#services/*": "./app/services/*.js", "#listeners/*": "./app/listeners/*.js", @@ -31,7 +32,8 @@ "#database/*": "./database/*.js", "#tests/*": "./tests/*.js", "#start/*": "./start/*.js", - "#config/*": "./config/*.js" + "#config/*": "./config/*.js", + "#lib/*": "./app/lib/*.js" }, "devDependencies": { "@adonisjs/assembler": "^7.6.1", diff --git a/public/manifest.json b/public/manifest.json index 7c1be2e..cfec5dc 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -3,10 +3,7 @@ "short_name": "MyLinks", "description": "MyLinks is a free and open source software, that lets you manage your favorite links in an intuitive interface", "launch_handler": { - "client_mode": [ - "focus-existing", - "auto" - ] + "client_mode": ["focus-existing", "auto"] }, "icons": [ { @@ -21,4 +18,4 @@ "start_url": "/", "display": "standalone", "orientation": "portrait" -} \ No newline at end of file +}