Compare commits
19 Commits
0d87a3f4bc
...
3.1.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a368f935b2 | ||
|
|
a4396ddf18 | ||
|
|
b45d06bbe0 | ||
|
|
7e7a010d5e | ||
|
|
e493e3e932 | ||
|
|
850722cb7d | ||
|
|
7fefabd9bf | ||
|
|
6e2d3d8c7a | ||
|
|
99759a85d1 | ||
|
|
3d88bcaa48 | ||
|
|
15e580942c | ||
|
|
8efa281a48 | ||
|
|
2dd96ff647 | ||
|
|
c54c1cc3da | ||
|
|
af08964fcc | ||
|
|
151ac0602a | ||
|
|
fb0345bf68 | ||
|
|
e28d5ebea8 | ||
|
|
e2494e8cf0 |
@@ -13,7 +13,7 @@ storage
|
|||||||
|
|
||||||
# Additional good to have ignores for dockerignore
|
# Additional good to have ignores for dockerignore
|
||||||
Dockerfile*
|
Dockerfile*
|
||||||
docker-compose*
|
compose*
|
||||||
.dockerignore
|
.dockerignore
|
||||||
*.md
|
*.md
|
||||||
.git
|
.git
|
||||||
|
|||||||
@@ -10,12 +10,5 @@ charset = utf-8
|
|||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
|
|
||||||
[*.json]
|
|
||||||
insert_final_newline = unset
|
|
||||||
|
|
||||||
[**.min.js]
|
[**.min.js]
|
||||||
indent_style = unset
|
indent_style = unset
|
||||||
insert_final_newline = unset
|
|
||||||
|
|
||||||
[*.md]
|
|
||||||
trim_trailing_whitespace = false
|
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
{
|
{
|
||||||
"hooks": {
|
"hooks": {
|
||||||
"before:init": [
|
"before:init": ["pnpm lint", "pnpm run typecheck"]
|
||||||
"pnpm format",
|
|
||||||
"pnpm lint"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"git": {
|
"git": {
|
||||||
"commitMessage": "chore: release v${version}",
|
"commitMessage": "chore: release v${version}",
|
||||||
@@ -17,4 +14,4 @@
|
|||||||
"npm": {
|
"npm": {
|
||||||
"publish": false
|
"publish": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
3
.vscode/extensions.json
vendored
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"recommendations": ["vunguyentuan.vscode-css-variables"]
|
|
||||||
}
|
|
||||||
4
.vscode/settings.json
vendored
@@ -7,7 +7,7 @@
|
|||||||
"explorer.fileNesting.enabled": true,
|
"explorer.fileNesting.enabled": true,
|
||||||
"explorer.fileNesting.patterns": {
|
"explorer.fileNesting.patterns": {
|
||||||
"*.js": "${capture}.js.map, ${capture}.min.js, ${capture}.d.ts",
|
"*.js": "${capture}.js.map, ${capture}.min.js, ${capture}.d.ts",
|
||||||
"package.json": "pnpm-lock.yaml, tsconfig.json, eslint.config.js, .babelrc, vite.config.ts, .editorconfig",
|
"package.json": "pnpm-lock.yaml, pnpm-workspace.yaml, tsconfig.json, eslint.config.js, .babelrc, vite.config.ts, .editorconfig",
|
||||||
"Makefile": "*compose.yml, Dockerfile, servers_pgadmin.json, .dockerignore"
|
"Makefile": "*compose.yml, Dockerfile, servers_pgadmin.json, .dockerignore"
|
||||||
},
|
},
|
||||||
"cssVariables.lookupFiles": [
|
"cssVariables.lookupFiles": [
|
||||||
@@ -17,4 +17,4 @@
|
|||||||
"**/*.less",
|
"**/*.less",
|
||||||
"node_modules/@mantine/core/styles.css"
|
"node_modules/@mantine/core/styles.css"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# Source : https://github.com/adonisjs-community/adonis-packages/blob/main/Dockerfile
|
# Source : https://github.com/adonisjs-community/adonis-packages/blob/main/Dockerfile
|
||||||
|
|
||||||
FROM node:22.11-alpine3.20 AS base
|
FROM node:24.1-alpine3.20 AS base
|
||||||
|
|
||||||
RUN apk --no-cache add curl
|
RUN apk --no-cache add curl
|
||||||
RUN corepack enable
|
RUN corepack enable
|
||||||
|
|||||||
11
Makefile
@@ -1,21 +1,28 @@
|
|||||||
dev:
|
dev:
|
||||||
@docker compose down
|
@docker compose down
|
||||||
@docker compose -f dev.compose.yml pull
|
@docker compose -f dev.compose.yml pull
|
||||||
@docker compose -f dev.compose.yml up -d --wait
|
@docker compose -f dev.compose.yml up -d --wait --remove-orphans
|
||||||
@node ace migration:fresh
|
@node ace migration:fresh
|
||||||
@pnpm run dev
|
@pnpm run dev
|
||||||
|
|
||||||
prod:
|
prod:
|
||||||
@docker compose -f dev.compose.yml down
|
@docker compose -f dev.compose.yml down
|
||||||
@docker compose pull
|
@docker compose pull
|
||||||
@docker compose up -d --build --wait
|
@docker compose up -d --build --wait --remove-orphans
|
||||||
|
|
||||||
seed:
|
seed:
|
||||||
@node ace db:seed
|
@node ace db:seed
|
||||||
|
|
||||||
|
fresh:
|
||||||
|
@node ace migration:fresh
|
||||||
|
|
||||||
down:
|
down:
|
||||||
@-docker compose down
|
@-docker compose down
|
||||||
@-docker compose -f dev.compose.yml down
|
@-docker compose -f dev.compose.yml down
|
||||||
|
|
||||||
release:
|
release:
|
||||||
@pnpm run release
|
@pnpm run release
|
||||||
|
|
||||||
|
docker-weight:
|
||||||
|
@DOCKER_IMAGE_WEIGHT=$$(docker save axekin-axekin:latest | wc -c | awk '{printf "%.3f", $$1/1024/1024}'); \
|
||||||
|
echo "Docker image weight: $${DOCKER_IMAGE_WEIGHT} Mo"
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
- [Main Features](#main-features)
|
- [Main Features](#main-features)
|
||||||
- [Getting Started](#getting-started)
|
- [Getting Started](#getting-started)
|
||||||
- [Setup](#setup)
|
- [Setup](#setup)
|
||||||
@@ -24,7 +25,7 @@
|
|||||||
- [Contributing](#contributing)
|
- [Contributing](#contributing)
|
||||||
- [License](#license)
|
- [License](#license)
|
||||||
|
|
||||||
## Main Features
|
## Main Features
|
||||||
|
|
||||||
- **Organize bookmarks with collections**: Keep your links tidy and easily accessible by grouping them into customizable collections.
|
- **Organize bookmarks with collections**: Keep your links tidy and easily accessible by grouping them into customizable collections.
|
||||||
- **Intuitive link management**: Add, edit, and manage your bookmarks effortlessly with a user-friendly interface.
|
- **Intuitive link management**: Add, edit, and manage your bookmarks effortlessly with a user-friendly interface.
|
||||||
@@ -124,6 +125,7 @@ ssh-copy-id -i ./id_rsa.pub user@host
|
|||||||
> Source: https://github.com/appleboy/ssh-action#setting-up-a-ssh-key
|
> Source: https://github.com/appleboy/ssh-action#setting-up-a-ssh-key
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
We welcome contributions! Please visit our Trello board for project management and roadmap details. You can contribute by:
|
We welcome contributions! Please visit our Trello board for project management and roadmap details. You can contribute by:
|
||||||
|
|
||||||
- Creating issues for bugs, features, or discussions.
|
- Creating issues for bugs, features, or discussions.
|
||||||
@@ -133,4 +135,4 @@ For detailed contribution guidelines, refer to the CONTRIBUTING.md file.
|
|||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
This project is licensed under the [GPLv3 License](./LICENCE).
|
This project is licensed under the [GPLv3 License](./LICENCE).
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ export default defineConfig({
|
|||||||
],
|
],
|
||||||
|
|
||||||
assetsBundler: false,
|
assetsBundler: false,
|
||||||
unstable_assembler: {
|
hooks: {
|
||||||
onBuildStarting: [() => import('@adonisjs/vite/build_hook')],
|
onBuildStarting: [() => import('@adonisjs/vite/build_hook')],
|
||||||
onDevServerStarted: [() => import('@izzyjs/route/dev_hook')],
|
onDevServerStarted: [() => import('@izzyjs/route/dev_hook')],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ export default class Collection extends AppBaseModel {
|
|||||||
@column()
|
@column()
|
||||||
declare visibility: Visibility;
|
declare visibility: Visibility;
|
||||||
|
|
||||||
@column()
|
|
||||||
declare nextId: number;
|
|
||||||
|
|
||||||
@column()
|
@column()
|
||||||
declare authorId: number;
|
declare authorId: number;
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ export const createCollectionValidator = vine.compile(
|
|||||||
name: vine.string().trim().minLength(1).maxLength(254),
|
name: vine.string().trim().minLength(1).maxLength(254),
|
||||||
description: vine.string().trim().maxLength(254).nullable(),
|
description: vine.string().trim().maxLength(254).nullable(),
|
||||||
visibility: vine.enum(Visibility),
|
visibility: vine.enum(Visibility),
|
||||||
nextId: vine.number().optional(),
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ export const updateCollectionValidator = vine.compile(
|
|||||||
name: vine.string().trim().minLength(1).maxLength(254),
|
name: vine.string().trim().minLength(1).maxLength(254),
|
||||||
description: vine.string().trim().maxLength(254).nullable(),
|
description: vine.string().trim().maxLength(254).nullable(),
|
||||||
visibility: vine.enum(Visibility),
|
visibility: vine.enum(Visibility),
|
||||||
nextId: vine.number().optional(),
|
|
||||||
|
|
||||||
params,
|
params,
|
||||||
})
|
})
|
||||||
|
|||||||
18
app/core/middlewares/service_worker_scope_extender.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import { HttpContext } from '@adonisjs/core/http';
|
||||||
|
|
||||||
|
const HEADER_NAME = 'Service-Worker-Allowed';
|
||||||
|
|
||||||
|
export default class ServiceWorkerScopeExtender {
|
||||||
|
async handle(
|
||||||
|
{ request, response, logger }: HttpContext,
|
||||||
|
next: () => Promise<void>
|
||||||
|
) {
|
||||||
|
if (request.url().startsWith('/assets/sw.js')) {
|
||||||
|
response.header(HEADER_NAME, '/');
|
||||||
|
logger.debug(
|
||||||
|
`Header ${HEADER_NAME} for ${request.url()} set to ${response.getHeader(HEADER_NAME)}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
await next();
|
||||||
|
}
|
||||||
|
}
|
||||||
43
compose.yml
@@ -15,33 +15,6 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- '${DB_PORT}:5432'
|
- '${DB_PORT}:5432'
|
||||||
|
|
||||||
pgadmin:
|
|
||||||
container_name: pgadmin
|
|
||||||
image: dpage/pgadmin4:8
|
|
||||||
restart: always
|
|
||||||
entrypoint: /bin/sh -c "chmod 0600 /pgpass; /entrypoint.sh;"
|
|
||||||
healthcheck:
|
|
||||||
test: ['CMD', 'wget', '-O', '-', 'http://localhost:80/misc/ping']
|
|
||||||
interval: 2s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 30
|
|
||||||
env_file: .env
|
|
||||||
environment:
|
|
||||||
- PGADMIN_DEFAULT_EMAIL=myemail@gmail.com
|
|
||||||
- PGADMIN_DEFAULT_PASSWORD=a12345678
|
|
||||||
- PGADMIN_CONFIG_SERVER_MODE=False
|
|
||||||
- PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED=False
|
|
||||||
depends_on:
|
|
||||||
- postgres
|
|
||||||
ports:
|
|
||||||
- '5050:80'
|
|
||||||
user: root
|
|
||||||
configs:
|
|
||||||
- source: servers.json
|
|
||||||
target: /pgadmin4/servers.json
|
|
||||||
- source: pgpass
|
|
||||||
target: /pgpass
|
|
||||||
|
|
||||||
my-links:
|
my-links:
|
||||||
container_name: my-links
|
container_name: my-links
|
||||||
restart: always
|
restart: always
|
||||||
@@ -61,19 +34,3 @@ services:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres-volume:
|
postgres-volume:
|
||||||
|
|
||||||
configs:
|
|
||||||
pgpass:
|
|
||||||
content: postgres:${DB_PORT}:*:${DB_USER}:${DB_PASSWORD}
|
|
||||||
servers.json:
|
|
||||||
content: |
|
|
||||||
{"Servers": {"1": {
|
|
||||||
"Group": "Servers",
|
|
||||||
"Name": "project",
|
|
||||||
"Host": "postgres",
|
|
||||||
"Port": ${DB_PORT},
|
|
||||||
"MaintenanceDB": "${DB_DATABASE}",
|
|
||||||
"Username": "${DB_USER}",
|
|
||||||
"PassFile": "/pgpass",
|
|
||||||
"SSLMode": "prefer"
|
|
||||||
}}}
|
|
||||||
|
|||||||
12
config/project.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
const PROJECT_NAME = 'MyLinks';
|
||||||
|
const PROJECT_DESCRIPTION =
|
||||||
|
'Another bookmark manager that lets you manage and share your favorite links in an intuitive interface';
|
||||||
|
const PROJECT_URL = 'https://www.mylinks.app';
|
||||||
|
const APP_COLOR = '#f0eef6';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: PROJECT_NAME,
|
||||||
|
description: PROJECT_DESCRIPTION,
|
||||||
|
url: PROJECT_URL,
|
||||||
|
color: APP_COLOR,
|
||||||
|
};
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import { BaseSchema } from '@adonisjs/lucid/schema';
|
||||||
|
|
||||||
|
export default class extends BaseSchema {
|
||||||
|
protected tableName = 'collections';
|
||||||
|
|
||||||
|
async up() {
|
||||||
|
this.schema.alterTable('collections', (table) => {
|
||||||
|
table.dropColumn('next_id');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async down() {
|
||||||
|
this.schema.alterTable('collections', (table) => {
|
||||||
|
table
|
||||||
|
.integer('next_id')
|
||||||
|
.references('id')
|
||||||
|
.inTable('collections')
|
||||||
|
.defaultTo(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,8 @@ import User from '#user/models/user';
|
|||||||
import { BaseSeeder } from '@adonisjs/lucid/seeders';
|
import { BaseSeeder } from '@adonisjs/lucid/seeders';
|
||||||
import { faker } from '@faker-js/faker';
|
import { faker } from '@faker-js/faker';
|
||||||
|
|
||||||
|
const ID_OFFSET = 100;
|
||||||
|
|
||||||
export default class extends BaseSeeder {
|
export default class extends BaseSeeder {
|
||||||
static environment = ['development', 'testing'];
|
static environment = ['development', 'testing'];
|
||||||
|
|
||||||
@@ -11,7 +13,7 @@ export default class extends BaseSeeder {
|
|||||||
const users = await getUserIds();
|
const users = await getUserIds();
|
||||||
|
|
||||||
const collections = faker.helpers.multiple(
|
const collections = faker.helpers.multiple(
|
||||||
() => createRandomCollection(users),
|
(_, index) => createRandomCollection(users, ID_OFFSET + index),
|
||||||
{
|
{
|
||||||
count: 50,
|
count: 50,
|
||||||
}
|
}
|
||||||
@@ -25,16 +27,13 @@ export async function getUserIds() {
|
|||||||
return users.map(({ id }) => id);
|
return users.map(({ id }) => id);
|
||||||
}
|
}
|
||||||
|
|
||||||
let collectionId = 0;
|
function createRandomCollection(userIds: User['id'][], id: number) {
|
||||||
function createRandomCollection(userIds: User['id'][]) {
|
|
||||||
const authorId = faker.helpers.arrayElements(userIds, 1).at(0);
|
const authorId = faker.helpers.arrayElements(userIds, 1).at(0);
|
||||||
collectionId++;
|
|
||||||
return {
|
return {
|
||||||
id: collectionId,
|
id,
|
||||||
name: faker.string.alphanumeric({ length: { min: 5, max: 25 } }),
|
name: faker.string.alphanumeric({ length: { min: 5, max: 25 } }),
|
||||||
description: faker.string.alphanumeric({ length: { min: 0, max: 254 } }),
|
description: faker.string.alphanumeric({ length: { min: 0, max: 254 } }),
|
||||||
visibility: Visibility.PRIVATE,
|
visibility: Visibility.PRIVATE,
|
||||||
nextId: collectionId + 1,
|
|
||||||
authorId,
|
authorId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import User from '#user/models/user';
|
|||||||
import { BaseSeeder } from '@adonisjs/lucid/seeders';
|
import { BaseSeeder } from '@adonisjs/lucid/seeders';
|
||||||
import { faker } from '@faker-js/faker';
|
import { faker } from '@faker-js/faker';
|
||||||
|
|
||||||
|
const ID_OFFSET = 100;
|
||||||
|
|
||||||
export default class extends BaseSeeder {
|
export default class extends BaseSeeder {
|
||||||
static environment = ['development', 'testing'];
|
static environment = ['development', 'testing'];
|
||||||
|
|
||||||
@@ -12,9 +14,12 @@ export default class extends BaseSeeder {
|
|||||||
const users = await getUserIds();
|
const users = await getUserIds();
|
||||||
|
|
||||||
const links = await Promise.all(
|
const links = await Promise.all(
|
||||||
faker.helpers.multiple(async () => createRandomLink(users), {
|
faker.helpers.multiple(
|
||||||
count: 500,
|
async (_, index) => createRandomLink(users, ID_OFFSET + index),
|
||||||
})
|
{
|
||||||
|
count: 500,
|
||||||
|
}
|
||||||
|
)
|
||||||
);
|
);
|
||||||
await Link.createMany(links.filter((a) => typeof a !== 'undefined') as any);
|
await Link.createMany(links.filter((a) => typeof a !== 'undefined') as any);
|
||||||
}
|
}
|
||||||
@@ -25,7 +30,7 @@ async function getCollectionIds(authorId: User['id']) {
|
|||||||
return collection.map(({ id }) => id);
|
return collection.map(({ id }) => id);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createRandomLink(userIds: User['id'][]) {
|
async function createRandomLink(userIds: User['id'][], id: number) {
|
||||||
const authorId = faker.helpers.arrayElements(userIds, 1).at(0)!;
|
const authorId = faker.helpers.arrayElements(userIds, 1).at(0)!;
|
||||||
const collections = await getCollectionIds(authorId);
|
const collections = await getCollectionIds(authorId);
|
||||||
|
|
||||||
@@ -35,7 +40,7 @@ async function createRandomLink(userIds: User['id'][]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: faker.string.uuid(),
|
id,
|
||||||
name: faker.string.alphanumeric({ length: { min: 5, max: 25 } }),
|
name: faker.string.alphanumeric({ length: { min: 5, max: 25 } }),
|
||||||
description: faker.string.alphanumeric({ length: { min: 0, max: 254 } }),
|
description: faker.string.alphanumeric({ length: { min: 0, max: 254 } }),
|
||||||
url: faker.internet.url(),
|
url: faker.internet.url(),
|
||||||
|
|||||||
@@ -3,22 +3,27 @@ import { GoogleToken } from '@adonisjs/ally/types';
|
|||||||
import { BaseSeeder } from '@adonisjs/lucid/seeders';
|
import { BaseSeeder } from '@adonisjs/lucid/seeders';
|
||||||
import { faker } from '@faker-js/faker';
|
import { faker } from '@faker-js/faker';
|
||||||
|
|
||||||
|
const ID_OFFSET = 100;
|
||||||
|
|
||||||
export default class extends BaseSeeder {
|
export default class extends BaseSeeder {
|
||||||
static environment = ['development', 'testing'];
|
static environment = ['development', 'testing'];
|
||||||
|
|
||||||
async run() {
|
async run() {
|
||||||
const users = faker.helpers.multiple(createRandomUser, {
|
const users = faker.helpers.multiple(
|
||||||
count: 25,
|
(_, index) => createRandomUser(ID_OFFSET + index),
|
||||||
});
|
{
|
||||||
|
count: 25,
|
||||||
|
}
|
||||||
|
);
|
||||||
await User.createMany(users);
|
await User.createMany(users);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createRandomUser() {
|
export function createRandomUser(index: number) {
|
||||||
return {
|
return {
|
||||||
id: faker.number.int(),
|
id: index,
|
||||||
email: faker.internet.email(),
|
email: faker.internet.email(),
|
||||||
name: faker.internet.userName(),
|
name: faker.internet.username(),
|
||||||
nickName: faker.internet.displayName(),
|
nickName: faker.internet.displayName(),
|
||||||
avatarUrl: faker.image.avatar(),
|
avatarUrl: faker.image.avatar(),
|
||||||
isAdmin: false,
|
isAdmin: false,
|
||||||
|
|||||||
@@ -15,48 +15,5 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "${DB_PORT}:5432"
|
- "${DB_PORT}:5432"
|
||||||
|
|
||||||
pgadmin:
|
|
||||||
container_name: pgadmin
|
|
||||||
image: dpage/pgadmin4:8
|
|
||||||
restart: always
|
|
||||||
entrypoint: /bin/sh -c "chmod 0600 /pgpass; /entrypoint.sh;"
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "wget", "-O", "-", "http://localhost:80/misc/ping"]
|
|
||||||
interval: 2s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 30
|
|
||||||
env_file: .env
|
|
||||||
environment:
|
|
||||||
- PGADMIN_DEFAULT_EMAIL=myemail@gmail.com
|
|
||||||
- PGADMIN_DEFAULT_PASSWORD=a12345678
|
|
||||||
- PGADMIN_CONFIG_SERVER_MODE=False
|
|
||||||
- PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED=False
|
|
||||||
depends_on:
|
|
||||||
- postgres
|
|
||||||
ports:
|
|
||||||
- "5050:80"
|
|
||||||
user: root
|
|
||||||
configs:
|
|
||||||
- source: servers.json
|
|
||||||
target: /pgadmin4/servers.json
|
|
||||||
- source: pgpass
|
|
||||||
target: /pgpass
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres-volume:
|
postgres-volume:
|
||||||
|
|
||||||
configs:
|
|
||||||
pgpass:
|
|
||||||
content: postgres:${DB_PORT}:*:${DB_USER}:${DB_PASSWORD}
|
|
||||||
servers.json:
|
|
||||||
content: |
|
|
||||||
{"Servers": {"1": {
|
|
||||||
"Group": "Servers",
|
|
||||||
"Name": "project",
|
|
||||||
"Host": "postgres",
|
|
||||||
"Port": ${DB_PORT},
|
|
||||||
"MaintenanceDB": "${DB_DATABASE}",
|
|
||||||
"Username": "${DB_USER}",
|
|
||||||
"PassFile": "/pgpass",
|
|
||||||
"SSLMode": "prefer"
|
|
||||||
}}}
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 957 B After Width: | Height: | Size: 957 B |
|
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 9.0 KiB |
@@ -1,4 +1,7 @@
|
|||||||
import { configApp } from '@adonisjs/eslint-config';
|
import { configApp } from '@adonisjs/eslint-config';
|
||||||
export default configApp({
|
export default configApp({
|
||||||
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
|
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
|
||||||
|
rules: {
|
||||||
|
'unicorn/filename-case': 'off',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-size: var(--mantine-font-size-sm);
|
font-size: var(--mantine-font-size-sm);
|
||||||
color: light-dark(var(--mantine-color-gray-7), var(--mantine-color-dark-1));
|
color: light-dark(var(--mantine-color-gray-7), var(--mantine-color-dark-1));
|
||||||
padding: var(--mantine-spacing-xs) var(--mantine-spacing-sm);
|
padding: rem(8px) rem(12px);
|
||||||
border-radius: var(--mantine-radius-sm);
|
border-radius: var(--mantine-radius-sm);
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,6 @@ export default function CollectionItem({
|
|||||||
}
|
}
|
||||||
}, [collection.id, activeCollection?.id]);
|
}, [collection.id, activeCollection?.id]);
|
||||||
|
|
||||||
const linksCount = collection?.links.length ?? 0;
|
|
||||||
const showLinks = linksCount > 0;
|
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link
|
||||||
className={classes.link}
|
className={classes.link}
|
||||||
@@ -39,11 +37,6 @@ export default function CollectionItem({
|
|||||||
<Text lineClamp={1} maw={'200px'} style={{ wordBreak: 'break-all' }}>
|
<Text lineClamp={1} maw={'200px'} style={{ wordBreak: 'break-all' }}>
|
||||||
{collection.name}
|
{collection.name}
|
||||||
</Text>
|
</Text>
|
||||||
{showLinks && (
|
|
||||||
<Text style={{ whiteSpace: 'nowrap' }} c="dimmed" ml="sm">
|
|
||||||
— {linksCount}
|
|
||||||
</Text>
|
|
||||||
)}
|
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,13 +3,12 @@ import { FormEvent } from 'react';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import BackToDashboard from '~/components/common/navigation/back_to_dashboard';
|
import BackToDashboard from '~/components/common/navigation/back_to_dashboard';
|
||||||
import { FormLayout, FormLayoutProps } from '~/layouts/form_layout';
|
import { FormLayout, FormLayoutProps } from '~/layouts/form_layout';
|
||||||
import { Collection, Visibility } from '~/types/app';
|
import { Visibility } from '~/types/app';
|
||||||
|
|
||||||
export type FormCollectionData = {
|
export type FormCollectionData = {
|
||||||
name: string;
|
name: string;
|
||||||
description: string | null;
|
description: string | null;
|
||||||
visibility: Visibility;
|
visibility: Visibility;
|
||||||
nextId?: Collection['id'];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
interface FormCollectionProps extends FormLayoutProps {
|
interface FormCollectionProps extends FormLayoutProps {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export default function Navbar() {
|
|||||||
<header className={classes.header}>
|
<header className={classes.header}>
|
||||||
<Group justify="space-between" h="100%">
|
<Group justify="space-between" h="100%">
|
||||||
<Link href="/">
|
<Link href="/">
|
||||||
<Image src="/logo-light.png" h={35} alt="MyLinks's logo" />
|
<Image src="/logo.png" h={35} alt="MyLinks's logo" />
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
<Group h="100%" gap={0} visibleFrom="sm">
|
<Group h="100%" gap={0} visibleFrom="sm">
|
||||||
|
|||||||
@@ -1,22 +1,17 @@
|
|||||||
import { router, usePage } from '@inertiajs/react';
|
import { router } from '@inertiajs/react';
|
||||||
import { ColorSchemeScript, createTheme, MantineProvider } from '@mantine/core';
|
import { ColorSchemeScript, MantineProvider } from '@mantine/core';
|
||||||
|
import '@mantine/core/styles.css';
|
||||||
|
import '@mantine/spotlight/styles.css';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { ReactNode, useEffect } from 'react';
|
import { ReactNode, useEffect } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { InertiaPage } from '~/types/inertia';
|
|
||||||
|
|
||||||
import '@mantine/core/styles.css';
|
|
||||||
import '@mantine/spotlight/styles.css';
|
|
||||||
import '../styles/index.css';
|
import '../styles/index.css';
|
||||||
|
|
||||||
const theme = createTheme({});
|
|
||||||
const TRANSITION_IN_CLASS = '__transition_fadeIn';
|
const TRANSITION_IN_CLASS = '__transition_fadeIn';
|
||||||
const TRANSITION_OUT_CLASS = '__transition_fadeOut';
|
const TRANSITION_OUT_CLASS = '__transition_fadeOut';
|
||||||
|
|
||||||
export default function BaseLayout({ children }: { children: ReactNode }) {
|
export default function BaseLayout({ children }: { children: ReactNode }) {
|
||||||
const { i18n } = useTranslation();
|
const { i18n } = useTranslation();
|
||||||
const { language } = usePage<InertiaPage>().props;
|
|
||||||
i18n.changeLanguage(language);
|
|
||||||
dayjs.locale(i18n.language);
|
dayjs.locale(i18n.language);
|
||||||
|
|
||||||
const findAppElement = () => document.getElementById('app');
|
const findAppElement = () => document.getElementById('app');
|
||||||
@@ -34,7 +29,6 @@ export default function BaseLayout({ children }: { children: ReactNode }) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const currentLocation = new URL(window.location.href);
|
const currentLocation = new URL(window.location.href);
|
||||||
flipClass(TRANSITION_IN_CLASS, TRANSITION_OUT_CLASS);
|
|
||||||
|
|
||||||
const removeStartEventListener = router.on(
|
const removeStartEventListener = router.on(
|
||||||
'start',
|
'start',
|
||||||
@@ -58,7 +52,7 @@ export default function BaseLayout({ children }: { children: ReactNode }) {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ColorSchemeScript />
|
<ColorSchemeScript />
|
||||||
<MantineProvider theme={theme}>{children}</MantineProvider>
|
<MantineProvider>{children}</MantineProvider>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ export default function EditCollectionPage({
|
|||||||
name: collection.name,
|
name: collection.name,
|
||||||
description: collection.description,
|
description: collection.description,
|
||||||
visibility: collection.visibility,
|
visibility: collection.visibility,
|
||||||
nextId: collection.nextId,
|
|
||||||
});
|
});
|
||||||
const canSubmit = useMemo<boolean>(() => {
|
const canSubmit = useMemo<boolean>(() => {
|
||||||
const trimmedName = data.name.trim();
|
const trimmedName = data.name.trim();
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ export const useFavorites = () =>
|
|||||||
);
|
);
|
||||||
|
|
||||||
export function useCollectionsSetter() {
|
export function useCollectionsSetter() {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
const { _setCollections, setActiveCollection } = useCollectionStore();
|
const { _setCollections, setActiveCollection } = useCollectionStore();
|
||||||
return { _setCollections, setActiveCollection };
|
return { _setCollections, setActiveCollection };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ export type Collection = CommonBase & {
|
|||||||
name: string;
|
name: string;
|
||||||
description: string | null;
|
description: string | null;
|
||||||
visibility: Visibility;
|
visibility: Visibility;
|
||||||
nextId: number;
|
|
||||||
authorId: number;
|
authorId: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
112
package.json
@@ -1,18 +1,20 @@
|
|||||||
{
|
{
|
||||||
"name": "my-links",
|
"name": "my-links",
|
||||||
"version": "3.0.3",
|
"version": "3.1.3",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node bin/server.js",
|
"start": "node bin/server.js",
|
||||||
"build": "node ace build",
|
"build": "node ace build",
|
||||||
"dev": "node ace serve --watch",
|
"dev": "node ace serve --hmr",
|
||||||
"test": "node ace test",
|
"test": "node ace test",
|
||||||
"lint": "eslint . --report-unused-disable-directives --max-warnings 0",
|
"lint": "eslint . --report-unused-disable-directives --max-warnings 0",
|
||||||
"format": "prettier --write --parser typescript '**/*.{ts,tsx}'",
|
"format": "prettier --write --parser typescript '**/*.{ts,tsx}'",
|
||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
|
"check": "pnpm run lint && pnpm run typecheck",
|
||||||
"prepare": "husky",
|
"prepare": "husky",
|
||||||
"release": "release-it"
|
"release": "release-it",
|
||||||
|
"generate-icons": "pwa-assets-generator"
|
||||||
},
|
},
|
||||||
"imports": {
|
"imports": {
|
||||||
"#admin/*": "./app/admin/*.js",
|
"#admin/*": "./app/admin/*.js",
|
||||||
@@ -34,66 +36,68 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@adonisjs/assembler": "^7.8.2",
|
"@adonisjs/assembler": "^7.8.2",
|
||||||
"@adonisjs/eslint-config": "2.0.0-beta.6",
|
"@adonisjs/eslint-config": "2.1.0",
|
||||||
"@adonisjs/prettier-config": "^1.4.0",
|
"@adonisjs/prettier-config": "^1.4.5",
|
||||||
"@adonisjs/tsconfig": "^1.4.0",
|
"@adonisjs/tsconfig": "^1.4.1",
|
||||||
"@faker-js/faker": "^9.2.0",
|
"@faker-js/faker": "^9.9.0",
|
||||||
"@japa/assert": "^3.0.0",
|
"@japa/assert": "^4.1.1",
|
||||||
"@japa/plugin-adonisjs": "^3.0.1",
|
"@japa/plugin-adonisjs": "^4.0.0",
|
||||||
"@japa/runner": "^3.1.4",
|
"@japa/runner": "^4.3.0",
|
||||||
"@swc/core": "^1.9.1",
|
"@swc/core": "^1.13.3",
|
||||||
"@types/luxon": "^3.4.2",
|
"@types/luxon": "^3.7.1",
|
||||||
"@types/node": "^20.14.10",
|
"@types/node": "^22.14.0",
|
||||||
"@types/react": "^18.3.12",
|
"@types/react": "^19.1.9",
|
||||||
"@types/react-dom": "^18.3.1",
|
"@types/react-dom": "^19.1.7",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.13.0",
|
"@typescript-eslint/eslint-plugin": "^8.39.0",
|
||||||
"@vitejs/plugin-react": "^4.3.3",
|
"@vite-pwa/assets-generator": "^1.0.0",
|
||||||
"eslint": "^9.14.0",
|
"@vitejs/plugin-react": "^4.7.0",
|
||||||
"hot-hook": "^0.3.1",
|
"eslint": "^9.32.0",
|
||||||
"husky": "^9.1.6",
|
"hot-hook": "^0.4.0",
|
||||||
"lint-staged": "^15.2.10",
|
"husky": "^9.1.7",
|
||||||
"pino-pretty": "^12.1.0",
|
"lint-staged": "^15.5.0",
|
||||||
"postcss": "^8.4.47",
|
"pino-pretty": "^13.1.1",
|
||||||
"postcss-preset-mantine": "^1.17.0",
|
"postcss": "^8.5.6",
|
||||||
|
"postcss-preset-mantine": "^1.18.0",
|
||||||
"postcss-simple-vars": "^7.0.1",
|
"postcss-simple-vars": "^7.0.1",
|
||||||
"prettier": "^3.3.3",
|
"prettier": "^3.6.2",
|
||||||
"release-it": "^17.10.0",
|
"release-it": "^18.1.2",
|
||||||
"ts-node-maintained": "^10.9.4",
|
"ts-node-maintained": "^10.9.6",
|
||||||
"typescript": "~5.6.3",
|
"typescript": "~5.9.2",
|
||||||
"vite": "^5.4.10"
|
"vite": "^6.2.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@adonisjs/ally": "^5.0.2",
|
"@adonisjs/ally": "^5.1.0",
|
||||||
"@adonisjs/auth": "^9.2.4",
|
"@adonisjs/auth": "^9.4.2",
|
||||||
"@adonisjs/core": "^6.14.1",
|
"@adonisjs/core": "^6.19.0",
|
||||||
"@adonisjs/cors": "^2.2.1",
|
"@adonisjs/cors": "^2.2.1",
|
||||||
"@adonisjs/inertia": "^1.2.3",
|
"@adonisjs/inertia": "^3.1.1",
|
||||||
"@adonisjs/lucid": "^21.3.0",
|
"@adonisjs/lucid": "^21.8.0",
|
||||||
"@adonisjs/session": "^7.5.0",
|
"@adonisjs/session": "^7.5.1",
|
||||||
"@adonisjs/shield": "^8.1.1",
|
"@adonisjs/shield": "^8.2.0",
|
||||||
"@adonisjs/static": "^1.1.1",
|
"@adonisjs/static": "^1.1.1",
|
||||||
"@adonisjs/vite": "^3.0.0",
|
"@adonisjs/vite": "^4.0.0",
|
||||||
"@inertiajs/react": "^1.2.0",
|
"@inertiajs/react": "^2.0.17",
|
||||||
"@izzyjs/route": "^1.2.0",
|
"@izzyjs/route": "^1.2.0",
|
||||||
"@mantine/core": "^7.13.5",
|
"@mantine/core": "^7.17.3",
|
||||||
"@mantine/hooks": "^7.13.5",
|
"@mantine/hooks": "^7.17.3",
|
||||||
"@mantine/spotlight": "^7.13.5",
|
"@mantine/spotlight": "^7.17.3",
|
||||||
"@vinejs/vine": "^2.1.0",
|
"@vinejs/vine": "^3.0.1",
|
||||||
"bentocache": "^1.0.0-beta.9",
|
"bentocache": "^1.5.0",
|
||||||
"dayjs": "^1.11.13",
|
"dayjs": "^1.11.13",
|
||||||
"edge.js": "^6.2.0",
|
"edge.js": "^6.3.0",
|
||||||
"i18next": "^23.16.5",
|
"i18next": "^24.2.3",
|
||||||
"knex": "^3.1.0",
|
"knex": "^3.1.0",
|
||||||
"luxon": "^3.5.0",
|
"luxon": "^3.7.1",
|
||||||
"node-html-parser": "^6.1.13",
|
"node-html-parser": "^7.0.1",
|
||||||
"pg": "^8.13.1",
|
"pg": "^8.16.3",
|
||||||
"react": "^18.3.1",
|
"react": "^19.1.1",
|
||||||
"react-dom": "^18.3.1",
|
"react-dom": "^19.1.1",
|
||||||
"react-hotkeys-hook": "^4.6.1",
|
"react-hotkeys-hook": "^4.6.1",
|
||||||
"react-i18next": "^15.1.1",
|
"react-i18next": "^15.6.1",
|
||||||
"react-icons": "^5.3.0",
|
"react-icons": "^5.5.0",
|
||||||
"reflect-metadata": "^0.2.2",
|
"reflect-metadata": "^0.2.2",
|
||||||
"zustand": "^5.0.1"
|
"vite-plugin-pwa": "^1.0.2",
|
||||||
|
"zustand": "^5.0.7"
|
||||||
},
|
},
|
||||||
"hotHook": {
|
"hotHook": {
|
||||||
"boundaries": [
|
"boundaries": [
|
||||||
@@ -115,6 +119,6 @@
|
|||||||
"*.js,*.ts,*.jsx,*.tsx": "eslint --cache --fix"
|
"*.js,*.ts,*.jsx,*.tsx": "eslint --cache --fix"
|
||||||
},
|
},
|
||||||
"volta": {
|
"volta": {
|
||||||
"node": "22.11.0"
|
"node": "24.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
8410
pnpm-lock.yaml
generated
4
pnpm-workspace.yaml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
onlyBuiltDependencies:
|
||||||
|
- '@swc/core'
|
||||||
|
- esbuild
|
||||||
|
- sharp
|
||||||
BIN
public/apple-touch-icon-180x180.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
public/favicon.ico
Normal file
|
After Width: | Height: | Size: 821 B |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
@@ -1,21 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "MyLinks",
|
|
||||||
"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"]
|
|
||||||
},
|
|
||||||
"icons": [
|
|
||||||
{
|
|
||||||
"src": "/favicon.png",
|
|
||||||
"sizes": "192x192",
|
|
||||||
"type": "image/png",
|
|
||||||
"purpose": "any maskable"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"theme_color": "#f0eef6",
|
|
||||||
"background_color": "#f0eef6",
|
|
||||||
"start_url": "/",
|
|
||||||
"display": "standalone",
|
|
||||||
"orientation": "portrait"
|
|
||||||
}
|
|
||||||
BIN
public/maskable-icon-512x512.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
public/pwa-192x192.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
public/pwa-512x512.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
public/pwa-64x64.png
Normal file
|
After Width: | Height: | Size: 555 B |
|
Before Width: | Height: | Size: 44 KiB |
13
pwa-assets.config.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
/* eslint-disable @unicorn/filename-case */
|
||||||
|
import {
|
||||||
|
defineConfig,
|
||||||
|
minimal2023Preset as preset,
|
||||||
|
} from '@vite-pwa/assets-generator/config';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
headLinkOptions: {
|
||||||
|
preset: '2023',
|
||||||
|
},
|
||||||
|
preset,
|
||||||
|
images: ['public/favicon.png'],
|
||||||
|
});
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
/>
|
/>
|
||||||
<link
|
<link
|
||||||
rel='manifest'
|
rel='manifest'
|
||||||
href='/manifest.json'
|
href='/assets/manifest.webmanifest'
|
||||||
/>
|
/>
|
||||||
<link
|
<link
|
||||||
rel='apple-touch-icon'
|
rel='apple-touch-icon'
|
||||||
@@ -30,6 +30,13 @@
|
|||||||
href='/favicon.png'
|
href='/favicon.png'
|
||||||
/>
|
/>
|
||||||
<title inertia>MyLinks</title>
|
<title inertia>MyLinks</title>
|
||||||
|
<script defer>
|
||||||
|
if('serviceWorker' in navigator) {
|
||||||
|
window.addEventListener('load', () => {
|
||||||
|
navigator.serviceWorker.register('/assets/sw.js', { scope: '/' })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
@routes()
|
@routes()
|
||||||
@inertiaHead()
|
@inertiaHead()
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ server.errorHandler(() => import('#core/exceptions/handler'));
|
|||||||
*/
|
*/
|
||||||
server.use([
|
server.use([
|
||||||
() => import('#core/middlewares/container_bindings_middleware'),
|
() => import('#core/middlewares/container_bindings_middleware'),
|
||||||
|
() => import('#core/middlewares/service_worker_scope_extender'),
|
||||||
() => import('@adonisjs/static/static_middleware'),
|
() => import('@adonisjs/static/static_middleware'),
|
||||||
() => import('#core/middlewares/log_request'),
|
() => import('#core/middlewares/log_request'),
|
||||||
() => import('@adonisjs/cors/cors_middleware'),
|
() => import('@adonisjs/cors/cors_middleware'),
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
{
|
{
|
||||||
"extends": "@adonisjs/tsconfig/tsconfig.app.json",
|
"extends": "@adonisjs/tsconfig/tsconfig.app.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": "./",
|
"rootDir": "./",
|
||||||
"outDir": "./build"
|
"outDir": "./build"
|
||||||
},
|
},
|
||||||
"exclude": ["./inertia/**/*", "node_modules", "build"]
|
"exclude": [
|
||||||
}
|
"./inertia/**/*",
|
||||||
|
"node_modules",
|
||||||
|
"build"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,23 +1,111 @@
|
|||||||
|
import project from '#config/project';
|
||||||
import { getDirname } from '@adonisjs/core/helpers';
|
import { getDirname } from '@adonisjs/core/helpers';
|
||||||
import inertia from '@adonisjs/inertia/client';
|
import inertia from '@adonisjs/inertia/client';
|
||||||
import adonisjs from '@adonisjs/vite/client';
|
import adonisjs from '@adonisjs/vite/client';
|
||||||
import react from '@vitejs/plugin-react';
|
import react from '@vitejs/plugin-react';
|
||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
|
import { VitePWA } from 'vite-plugin-pwa';
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [
|
plugins: [
|
||||||
|
VitePWA({
|
||||||
|
registerType: 'autoUpdate',
|
||||||
|
injectRegister: false,
|
||||||
|
strategies: 'generateSW',
|
||||||
|
devOptions: {
|
||||||
|
enabled: true,
|
||||||
|
},
|
||||||
|
manifest: {
|
||||||
|
name: project.name,
|
||||||
|
short_name: project.name,
|
||||||
|
description: project.description,
|
||||||
|
theme_color: project.color,
|
||||||
|
background_color: project.color,
|
||||||
|
scope: '/',
|
||||||
|
display: 'standalone',
|
||||||
|
orientation: 'portrait',
|
||||||
|
icons: [
|
||||||
|
{
|
||||||
|
src: '/pwa-64x64.png',
|
||||||
|
sizes: '64x64',
|
||||||
|
type: 'image/png',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src: '/pwa-192x192.png',
|
||||||
|
sizes: '192x192',
|
||||||
|
type: 'image/png',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src: '/pwa-512x512.png',
|
||||||
|
sizes: '512x512',
|
||||||
|
type: 'image/png',
|
||||||
|
purpose: 'any',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src: '/maskable-icon-512x512.png',
|
||||||
|
sizes: '512x512',
|
||||||
|
type: 'image/png',
|
||||||
|
purpose: 'maskable',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
launch_handler: {
|
||||||
|
client_mode: ['focus-existing', 'auto'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
workbox: {
|
||||||
|
clientsClaim: true,
|
||||||
|
skipWaiting: true,
|
||||||
|
globPatterns: ['**/*.{js,css,html,png,svg,ico,json,woff2}'],
|
||||||
|
globIgnores: ['sw*.js', '**/manifest.webmanifest*'],
|
||||||
|
// undefined is required for solving the following error :
|
||||||
|
// Uncaught (in promise) non-precached-url: non-precached-url :: [{"url":"/index.html"}]
|
||||||
|
// Source : https://github.com/vite-pwa/nuxt/issues/53#issuecomment-1615266204
|
||||||
|
navigateFallback: undefined,
|
||||||
|
runtimeCaching: [
|
||||||
|
{
|
||||||
|
urlPattern: /\.(?:js|css|woff2|woff|ttf|eot|otf)$/,
|
||||||
|
handler: 'CacheFirst',
|
||||||
|
options: {
|
||||||
|
cacheName: 'static-assets-cache',
|
||||||
|
expiration: {
|
||||||
|
maxEntries: 50,
|
||||||
|
maxAgeSeconds: 60 * 60 * 24 * 30,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
urlPattern: /\.(?:png|jpg|jpeg|svg|gif|webp|ico)$/,
|
||||||
|
handler: 'CacheFirst',
|
||||||
|
options: {
|
||||||
|
cacheName: 'images-cache',
|
||||||
|
expiration: {
|
||||||
|
maxEntries: 100,
|
||||||
|
maxAgeSeconds: 60 * 60 * 24 * 30,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
urlPattern: /\/.*$/,
|
||||||
|
handler: 'NetworkFirst',
|
||||||
|
options: {
|
||||||
|
cacheName: 'html-cache',
|
||||||
|
expiration: {
|
||||||
|
maxEntries: 20,
|
||||||
|
maxAgeSeconds: 60 * 60 * 24 * 7,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}),
|
||||||
inertia({ ssr: { enabled: true, entrypoint: 'inertia/app/ssr.tsx' } }),
|
inertia({ ssr: { enabled: true, entrypoint: 'inertia/app/ssr.tsx' } }),
|
||||||
react(),
|
react(),
|
||||||
adonisjs({
|
adonisjs({
|
||||||
entrypoints: ['inertia/app/app.tsx'],
|
entrypoints: [`${getDirname(import.meta.url)}/inertia/app/app.tsx`],
|
||||||
reload: ['resources/views/**/*.edge'],
|
reload: ['resources/views/**/*.edge'],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|
||||||
/**
|
|
||||||
* Define aliases for importing modules from
|
|
||||||
* your frontend code
|
|
||||||
*/
|
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'~/': `${getDirname(import.meta.url)}/inertia/`,
|
'~/': `${getDirname(import.meta.url)}/inertia/`,
|
||||||
|
|||||||