mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 22:53:25 +00:00
refactor: use tabs instead of spaces
This commit is contained in:
@@ -2,18 +2,18 @@ import env from '#start/env';
|
||||
import { defineConfig, services } from '@adonisjs/ally';
|
||||
|
||||
const allyConfig = defineConfig({
|
||||
google: services.google({
|
||||
clientId: env.get('GOOGLE_CLIENT_ID'),
|
||||
clientSecret: env.get('GOOGLE_CLIENT_SECRET'),
|
||||
callbackUrl: env.get('GOOGLE_CLIENT_CALLBACK_URL'),
|
||||
prompt: 'select_account',
|
||||
display: 'page',
|
||||
scopes: ['userinfo.email', 'userinfo.profile'],
|
||||
}),
|
||||
google: services.google({
|
||||
clientId: env.get('GOOGLE_CLIENT_ID'),
|
||||
clientSecret: env.get('GOOGLE_CLIENT_SECRET'),
|
||||
callbackUrl: env.get('GOOGLE_CLIENT_CALLBACK_URL'),
|
||||
prompt: 'select_account',
|
||||
display: 'page',
|
||||
scopes: ['userinfo.email', 'userinfo.profile'],
|
||||
}),
|
||||
});
|
||||
|
||||
export default allyConfig;
|
||||
|
||||
declare module '@adonisjs/ally/types' {
|
||||
interface SocialProviders extends InferSocialProviders<typeof allyConfig> {}
|
||||
interface SocialProviders extends InferSocialProviders<typeof allyConfig> {}
|
||||
}
|
||||
|
||||
@@ -16,25 +16,25 @@ export const appKey = new Secret(env.get('APP_KEY'));
|
||||
* The configuration settings used by the HTTP server
|
||||
*/
|
||||
export const http = defineConfig({
|
||||
generateRequestId: true,
|
||||
allowMethodSpoofing: false,
|
||||
generateRequestId: true,
|
||||
allowMethodSpoofing: false,
|
||||
|
||||
/**
|
||||
* Enabling async local storage will let you access HTTP context
|
||||
* from anywhere inside your application.
|
||||
*/
|
||||
useAsyncLocalStorage: false,
|
||||
/**
|
||||
* Enabling async local storage will let you access HTTP context
|
||||
* from anywhere inside your application.
|
||||
*/
|
||||
useAsyncLocalStorage: false,
|
||||
|
||||
/**
|
||||
* Manage cookies configuration. The settings for the session id cookie are
|
||||
* defined inside the "config/session.ts" file.
|
||||
*/
|
||||
cookie: {
|
||||
domain: '',
|
||||
path: '/',
|
||||
maxAge: '2h',
|
||||
httpOnly: true,
|
||||
secure: app.inProduction,
|
||||
sameSite: 'lax',
|
||||
},
|
||||
/**
|
||||
* Manage cookies configuration. The settings for the session id cookie are
|
||||
* defined inside the "config/session.ts" file.
|
||||
*/
|
||||
cookie: {
|
||||
domain: '',
|
||||
path: '/',
|
||||
maxAge: '2h',
|
||||
httpOnly: true,
|
||||
secure: app.inProduction,
|
||||
sameSite: 'lax',
|
||||
},
|
||||
});
|
||||
|
||||
@@ -3,15 +3,15 @@ import { InferAuthEvents, Authenticators } from '@adonisjs/auth/types';
|
||||
import { sessionGuard, sessionUserProvider } from '@adonisjs/auth/session';
|
||||
|
||||
const authConfig = defineConfig({
|
||||
default: 'web',
|
||||
guards: {
|
||||
web: sessionGuard({
|
||||
useRememberMeTokens: false,
|
||||
provider: sessionUserProvider({
|
||||
model: () => import('#models/user'),
|
||||
}),
|
||||
}),
|
||||
},
|
||||
default: 'web',
|
||||
guards: {
|
||||
web: sessionGuard({
|
||||
useRememberMeTokens: false,
|
||||
provider: sessionUserProvider({
|
||||
model: () => import('#models/user'),
|
||||
}),
|
||||
}),
|
||||
},
|
||||
});
|
||||
|
||||
export default authConfig;
|
||||
@@ -21,8 +21,8 @@ export default authConfig;
|
||||
* guards.
|
||||
*/
|
||||
declare module '@adonisjs/auth/types' {
|
||||
interface Authenticators extends InferAuthenticators<typeof authConfig> {}
|
||||
interface Authenticators extends InferAuthenticators<typeof authConfig> {}
|
||||
}
|
||||
declare module '@adonisjs/core/types' {
|
||||
interface EventsList extends InferAuthEvents<Authenticators> {}
|
||||
interface EventsList extends InferAuthEvents<Authenticators> {}
|
||||
}
|
||||
|
||||
@@ -1,55 +1,55 @@
|
||||
import { defineConfig } from '@adonisjs/core/bodyparser';
|
||||
|
||||
const bodyParserConfig = defineConfig({
|
||||
/**
|
||||
* The bodyparser middleware will parse the request body
|
||||
* for the following HTTP methods.
|
||||
*/
|
||||
allowedMethods: ['POST', 'PUT', 'PATCH', 'DELETE'],
|
||||
/**
|
||||
* The bodyparser middleware will parse the request body
|
||||
* for the following HTTP methods.
|
||||
*/
|
||||
allowedMethods: ['POST', 'PUT', 'PATCH', 'DELETE'],
|
||||
|
||||
/**
|
||||
* Config for the "application/x-www-form-urlencoded"
|
||||
* content-type parser
|
||||
*/
|
||||
form: {
|
||||
convertEmptyStringsToNull: true,
|
||||
types: ['application/x-www-form-urlencoded'],
|
||||
},
|
||||
/**
|
||||
* Config for the "application/x-www-form-urlencoded"
|
||||
* content-type parser
|
||||
*/
|
||||
form: {
|
||||
convertEmptyStringsToNull: true,
|
||||
types: ['application/x-www-form-urlencoded'],
|
||||
},
|
||||
|
||||
/**
|
||||
* Config for the JSON parser
|
||||
*/
|
||||
json: {
|
||||
convertEmptyStringsToNull: true,
|
||||
types: [
|
||||
'application/json',
|
||||
'application/json-patch+json',
|
||||
'application/vnd.api+json',
|
||||
'application/csp-report',
|
||||
],
|
||||
},
|
||||
/**
|
||||
* Config for the JSON parser
|
||||
*/
|
||||
json: {
|
||||
convertEmptyStringsToNull: true,
|
||||
types: [
|
||||
'application/json',
|
||||
'application/json-patch+json',
|
||||
'application/vnd.api+json',
|
||||
'application/csp-report',
|
||||
],
|
||||
},
|
||||
|
||||
/**
|
||||
* Config for the "multipart/form-data" content-type parser.
|
||||
* File uploads are handled by the multipart parser.
|
||||
*/
|
||||
multipart: {
|
||||
/**
|
||||
* Enabling auto process allows bodyparser middleware to
|
||||
* move all uploaded files inside the tmp folder of your
|
||||
* operating system
|
||||
*/
|
||||
autoProcess: true,
|
||||
convertEmptyStringsToNull: true,
|
||||
processManually: [],
|
||||
/**
|
||||
* Config for the "multipart/form-data" content-type parser.
|
||||
* File uploads are handled by the multipart parser.
|
||||
*/
|
||||
multipart: {
|
||||
/**
|
||||
* Enabling auto process allows bodyparser middleware to
|
||||
* move all uploaded files inside the tmp folder of your
|
||||
* operating system
|
||||
*/
|
||||
autoProcess: true,
|
||||
convertEmptyStringsToNull: true,
|
||||
processManually: [],
|
||||
|
||||
/**
|
||||
* Maximum limit of data to parse including all files
|
||||
* and fields
|
||||
*/
|
||||
limit: '20mb',
|
||||
types: ['multipart/form-data'],
|
||||
},
|
||||
/**
|
||||
* Maximum limit of data to parse including all files
|
||||
* and fields
|
||||
*/
|
||||
limit: '20mb',
|
||||
types: ['multipart/form-data'],
|
||||
},
|
||||
});
|
||||
|
||||
export default bodyParserConfig;
|
||||
|
||||
@@ -7,13 +7,13 @@ import { defineConfig } from '@adonisjs/cors';
|
||||
* https://docs.adonisjs.com/guides/security/cors
|
||||
*/
|
||||
const corsConfig = defineConfig({
|
||||
enabled: true,
|
||||
origin: [],
|
||||
methods: ['GET', 'HEAD', 'POST', 'PUT', 'DELETE'],
|
||||
headers: true,
|
||||
exposeHeaders: [],
|
||||
credentials: true,
|
||||
maxAge: 90,
|
||||
enabled: true,
|
||||
origin: [],
|
||||
methods: ['GET', 'HEAD', 'POST', 'PUT', 'DELETE'],
|
||||
headers: true,
|
||||
exposeHeaders: [],
|
||||
credentials: true,
|
||||
maxAge: 90,
|
||||
});
|
||||
|
||||
export default corsConfig;
|
||||
|
||||
@@ -2,26 +2,26 @@ import env from '#start/env';
|
||||
import { defineConfig } from '@adonisjs/lucid';
|
||||
|
||||
const dbConfig = defineConfig({
|
||||
connection: 'postgres',
|
||||
connections: {
|
||||
postgres: {
|
||||
client: 'pg',
|
||||
connection: {
|
||||
host: env.get('DB_HOST'),
|
||||
port: env.get('DB_PORT'),
|
||||
user: env.get('DB_USER'),
|
||||
password: env.get('DB_PASSWORD'),
|
||||
database: env.get('DB_DATABASE'),
|
||||
},
|
||||
migrations: {
|
||||
naturalSort: true,
|
||||
paths: ['database/migrations'],
|
||||
},
|
||||
seeders: {
|
||||
paths: ['./database/seeders/main'],
|
||||
},
|
||||
},
|
||||
},
|
||||
connection: 'postgres',
|
||||
connections: {
|
||||
postgres: {
|
||||
client: 'pg',
|
||||
connection: {
|
||||
host: env.get('DB_HOST'),
|
||||
port: env.get('DB_PORT'),
|
||||
user: env.get('DB_USER'),
|
||||
password: env.get('DB_PASSWORD'),
|
||||
database: env.get('DB_DATABASE'),
|
||||
},
|
||||
migrations: {
|
||||
naturalSort: true,
|
||||
paths: ['database/migrations'],
|
||||
},
|
||||
seeders: {
|
||||
paths: ['./database/seeders/main'],
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export default dbConfig;
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { defineConfig, drivers } from '@adonisjs/core/hash';
|
||||
|
||||
const hashConfig = defineConfig({
|
||||
default: 'scrypt',
|
||||
default: 'scrypt',
|
||||
|
||||
list: {
|
||||
scrypt: drivers.scrypt({
|
||||
cost: 16384,
|
||||
blockSize: 8,
|
||||
parallelization: 1,
|
||||
maxMemory: 33554432,
|
||||
}),
|
||||
},
|
||||
list: {
|
||||
scrypt: drivers.scrypt({
|
||||
cost: 16384,
|
||||
blockSize: 8,
|
||||
parallelization: 1,
|
||||
maxMemory: 33554432,
|
||||
}),
|
||||
},
|
||||
});
|
||||
|
||||
export default hashConfig;
|
||||
@@ -20,5 +20,5 @@ export default hashConfig;
|
||||
* in your application.
|
||||
*/
|
||||
declare module '@adonisjs/core/types' {
|
||||
export interface HashersList extends InferHashers<typeof hashConfig> {}
|
||||
export interface HashersList extends InferHashers<typeof hashConfig> {}
|
||||
}
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
import {
|
||||
DARK_THEME_DEFAULT_VALUE,
|
||||
PREFER_DARK_THEME,
|
||||
DARK_THEME_DEFAULT_VALUE,
|
||||
PREFER_DARK_THEME,
|
||||
} from '#constants/session';
|
||||
import { defineConfig } from '@adonisjs/inertia';
|
||||
|
||||
export default defineConfig({
|
||||
/**
|
||||
* Path to the Edge view that will be used as the root view for Inertia responses
|
||||
*/
|
||||
rootView: 'inertia_layout',
|
||||
/**
|
||||
* Path to the Edge view that will be used as the root view for Inertia responses
|
||||
*/
|
||||
rootView: 'inertia_layout',
|
||||
|
||||
/**
|
||||
* Data that should be shared with all rendered pages
|
||||
*/
|
||||
sharedData: {
|
||||
errors: (ctx) => ctx.session?.flashMessages.get('errors'),
|
||||
preferDarkTheme: (ctx) =>
|
||||
ctx.session?.get(PREFER_DARK_THEME, DARK_THEME_DEFAULT_VALUE),
|
||||
auth: async (ctx) => {
|
||||
await ctx.auth?.check();
|
||||
return {
|
||||
user: ctx.auth?.user || null,
|
||||
isAuthenticated: ctx.auth?.isAuthenticated || false,
|
||||
};
|
||||
},
|
||||
},
|
||||
/**
|
||||
* Data that should be shared with all rendered pages
|
||||
*/
|
||||
sharedData: {
|
||||
errors: (ctx) => ctx.session?.flashMessages.get('errors'),
|
||||
preferDarkTheme: (ctx) =>
|
||||
ctx.session?.get(PREFER_DARK_THEME, DARK_THEME_DEFAULT_VALUE),
|
||||
auth: async (ctx) => {
|
||||
await ctx.auth?.check();
|
||||
return {
|
||||
user: ctx.auth?.user || null,
|
||||
isAuthenticated: ctx.auth?.isAuthenticated || false,
|
||||
};
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* Options for the server-side rendering
|
||||
*/
|
||||
ssr: {
|
||||
enabled: true,
|
||||
entrypoint: 'inertia/app/ssr.tsx',
|
||||
},
|
||||
/**
|
||||
* Options for the server-side rendering
|
||||
*/
|
||||
ssr: {
|
||||
enabled: true,
|
||||
entrypoint: 'inertia/app/ssr.tsx',
|
||||
},
|
||||
});
|
||||
|
||||
@@ -3,25 +3,25 @@ import app from '@adonisjs/core/services/app';
|
||||
import { defineConfig, targets } from '@adonisjs/core/logger';
|
||||
|
||||
const loggerConfig = defineConfig({
|
||||
default: 'app',
|
||||
default: 'app',
|
||||
|
||||
/**
|
||||
* The loggers object can be used to define multiple loggers.
|
||||
* By default, we configure only one logger (named "app").
|
||||
*/
|
||||
loggers: {
|
||||
app: {
|
||||
enabled: true,
|
||||
name: env.get('APP_NAME'),
|
||||
level: env.get('LOG_LEVEL'),
|
||||
transport: {
|
||||
targets: targets()
|
||||
.pushIf(!app.inProduction, targets.pretty())
|
||||
.pushIf(app.inProduction, targets.file({ destination: 1 }))
|
||||
.toArray(),
|
||||
},
|
||||
},
|
||||
},
|
||||
/**
|
||||
* The loggers object can be used to define multiple loggers.
|
||||
* By default, we configure only one logger (named "app").
|
||||
*/
|
||||
loggers: {
|
||||
app: {
|
||||
enabled: true,
|
||||
name: env.get('APP_NAME'),
|
||||
level: env.get('LOG_LEVEL'),
|
||||
transport: {
|
||||
targets: targets()
|
||||
.pushIf(!app.inProduction, targets.pretty())
|
||||
.pushIf(app.inProduction, targets.file({ destination: 1 }))
|
||||
.toArray(),
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export default loggerConfig;
|
||||
@@ -31,5 +31,5 @@ export default loggerConfig;
|
||||
* in your application.
|
||||
*/
|
||||
declare module '@adonisjs/core/types' {
|
||||
export interface LoggersList extends InferLoggers<typeof loggerConfig> {}
|
||||
export interface LoggersList extends InferLoggers<typeof loggerConfig> {}
|
||||
}
|
||||
|
||||
@@ -2,48 +2,48 @@ import env from '#start/env';
|
||||
import { defineConfig, stores } from '@adonisjs/session';
|
||||
|
||||
const sessionConfig = defineConfig({
|
||||
enabled: true,
|
||||
cookieName: 'adonis-session',
|
||||
enabled: true,
|
||||
cookieName: 'adonis-session',
|
||||
|
||||
/**
|
||||
* When set to true, the session id cookie will be deleted
|
||||
* once the user closes the browser.
|
||||
*/
|
||||
clearWithBrowser: false,
|
||||
/**
|
||||
* When set to true, the session id cookie will be deleted
|
||||
* once the user closes the browser.
|
||||
*/
|
||||
clearWithBrowser: false,
|
||||
|
||||
/**
|
||||
* Define how long to keep the session data alive without
|
||||
* any activity.
|
||||
*/
|
||||
age: '7d',
|
||||
/**
|
||||
* Define how long to keep the session data alive without
|
||||
* any activity.
|
||||
*/
|
||||
age: '7d',
|
||||
|
||||
/**
|
||||
* Configuration for session cookie and the
|
||||
* cookie store
|
||||
*/
|
||||
cookie: {
|
||||
path: '/',
|
||||
httpOnly: true,
|
||||
secure: true,
|
||||
/**
|
||||
* Configuration for session cookie and the
|
||||
* cookie store
|
||||
*/
|
||||
cookie: {
|
||||
path: '/',
|
||||
httpOnly: true,
|
||||
secure: true,
|
||||
|
||||
// TODO: set this to lax and found a solution to keep auth when using extension
|
||||
sameSite: 'none',
|
||||
},
|
||||
// TODO: set this to lax and found a solution to keep auth when using extension
|
||||
sameSite: 'none',
|
||||
},
|
||||
|
||||
/**
|
||||
* The store to use. Make sure to validate the environment
|
||||
* variable in order to infer the store name without any
|
||||
* errors.
|
||||
*/
|
||||
store: env.get('SESSION_DRIVER'),
|
||||
/**
|
||||
* The store to use. Make sure to validate the environment
|
||||
* variable in order to infer the store name without any
|
||||
* errors.
|
||||
*/
|
||||
store: env.get('SESSION_DRIVER'),
|
||||
|
||||
/**
|
||||
* List of configured stores. Refer documentation to see
|
||||
* list of available stores and their config.
|
||||
*/
|
||||
stores: {
|
||||
cookie: stores.cookie(),
|
||||
},
|
||||
/**
|
||||
* List of configured stores. Refer documentation to see
|
||||
* list of available stores and their config.
|
||||
*/
|
||||
stores: {
|
||||
cookie: stores.cookie(),
|
||||
},
|
||||
});
|
||||
|
||||
export default sessionConfig;
|
||||
|
||||
@@ -1,50 +1,50 @@
|
||||
import { defineConfig } from '@adonisjs/shield';
|
||||
|
||||
const shieldConfig = defineConfig({
|
||||
/**
|
||||
* Configure CSP policies for your app. Refer documentation
|
||||
* to learn more
|
||||
*/
|
||||
csp: {
|
||||
enabled: false,
|
||||
directives: {},
|
||||
reportOnly: false,
|
||||
},
|
||||
/**
|
||||
* Configure CSP policies for your app. Refer documentation
|
||||
* to learn more
|
||||
*/
|
||||
csp: {
|
||||
enabled: false,
|
||||
directives: {},
|
||||
reportOnly: false,
|
||||
},
|
||||
|
||||
/**
|
||||
* Configure CSRF protection options. Refer documentation
|
||||
* to learn more
|
||||
*/
|
||||
csrf: {
|
||||
enabled: false,
|
||||
exceptRoutes: [],
|
||||
enableXsrfCookie: true,
|
||||
methods: ['POST', 'PUT', 'PATCH', 'DELETE'],
|
||||
},
|
||||
/**
|
||||
* Configure CSRF protection options. Refer documentation
|
||||
* to learn more
|
||||
*/
|
||||
csrf: {
|
||||
enabled: false,
|
||||
exceptRoutes: [],
|
||||
enableXsrfCookie: true,
|
||||
methods: ['POST', 'PUT', 'PATCH', 'DELETE'],
|
||||
},
|
||||
|
||||
/**
|
||||
* Control how your website should be embedded inside
|
||||
* iFrames
|
||||
*/
|
||||
xFrame: {
|
||||
enabled: false,
|
||||
},
|
||||
/**
|
||||
* Control how your website should be embedded inside
|
||||
* iFrames
|
||||
*/
|
||||
xFrame: {
|
||||
enabled: false,
|
||||
},
|
||||
|
||||
/**
|
||||
* Force browser to always use HTTPS
|
||||
*/
|
||||
hsts: {
|
||||
enabled: true,
|
||||
maxAge: '180 days',
|
||||
},
|
||||
/**
|
||||
* Force browser to always use HTTPS
|
||||
*/
|
||||
hsts: {
|
||||
enabled: true,
|
||||
maxAge: '180 days',
|
||||
},
|
||||
|
||||
/**
|
||||
* Disable browsers from sniffing the content type of a
|
||||
* response and always rely on the "content-type" header.
|
||||
*/
|
||||
contentTypeSniffing: {
|
||||
enabled: true,
|
||||
},
|
||||
/**
|
||||
* Disable browsers from sniffing the content type of a
|
||||
* response and always rely on the "content-type" header.
|
||||
*/
|
||||
contentTypeSniffing: {
|
||||
enabled: true,
|
||||
},
|
||||
});
|
||||
|
||||
export default shieldConfig;
|
||||
|
||||
@@ -8,10 +8,10 @@ import { defineConfig } from '@adonisjs/static';
|
||||
* https://docs.adonisjs.com/guides/static-assets
|
||||
*/
|
||||
const staticServerConfig = defineConfig({
|
||||
enabled: true,
|
||||
etag: true,
|
||||
lastModified: true,
|
||||
dotFiles: 'ignore',
|
||||
enabled: true,
|
||||
etag: true,
|
||||
lastModified: true,
|
||||
dotFiles: 'ignore',
|
||||
});
|
||||
|
||||
export default staticServerConfig;
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
import { defineConfig } from '@adonisjs/vite';
|
||||
|
||||
const viteBackendConfig = defineConfig({
|
||||
/**
|
||||
* The output of vite will be written inside this
|
||||
* directory. The path should be relative from
|
||||
* the application root.
|
||||
*/
|
||||
buildDirectory: 'public/assets',
|
||||
/**
|
||||
* The output of vite will be written inside this
|
||||
* directory. The path should be relative from
|
||||
* the application root.
|
||||
*/
|
||||
buildDirectory: 'public/assets',
|
||||
|
||||
/**
|
||||
* The path to the manifest file generated by the
|
||||
* "vite build" command.
|
||||
*/
|
||||
manifestFile: 'public/assets/.vite/manifest.json',
|
||||
/**
|
||||
* The path to the manifest file generated by the
|
||||
* "vite build" command.
|
||||
*/
|
||||
manifestFile: 'public/assets/.vite/manifest.json',
|
||||
|
||||
/**
|
||||
* Feel free to change the value of the "assetsUrl" to
|
||||
* point to a CDN in production.
|
||||
*/
|
||||
assetsUrl: '/assets',
|
||||
/**
|
||||
* Feel free to change the value of the "assetsUrl" to
|
||||
* point to a CDN in production.
|
||||
*/
|
||||
assetsUrl: '/assets',
|
||||
|
||||
scriptAttributes: {
|
||||
defer: true,
|
||||
},
|
||||
scriptAttributes: {
|
||||
defer: true,
|
||||
},
|
||||
});
|
||||
|
||||
export default viteBackendConfig;
|
||||
|
||||
Reference in New Issue
Block a user