wip
This commit is contained in:
parent
01e85b5e2f
commit
15674358f1
|
@ -1 +1 @@
|
|||
* text=auto eol=lf
|
||||
* text=auto eol=lf
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
"editor.detectIndentation": false,
|
||||
"editor.insertSpaces": false,
|
||||
"files.insertFinalNewline": true,
|
||||
"editor.formatOnPaste": true,
|
||||
"editor.formatOnSave": true,
|
||||
"editor.formatOnPaste": false,
|
||||
"editor.formatOnSave": false,
|
||||
"[javascript]": {
|
||||
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
|
||||
},
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
function isBabelLoader(caller) {
|
||||
return caller && caller.name === 'babel-loader';
|
||||
}
|
||||
|
||||
module.exports = api => {
|
||||
if (api.env('test') && !api.caller(isBabelLoader)) {
|
||||
return {
|
||||
presets: [
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
targets: {
|
||||
node: 'current'
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
};
|
||||
}
|
||||
return {};
|
||||
};
|
|
@ -1,9 +0,0 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
|
@ -1,5 +0,0 @@
|
|||
node_modules/
|
||||
/database/database.sqlite
|
||||
/database/database.sqlite-journal
|
||||
/dist/
|
||||
.env
|
|
@ -1,23 +0,0 @@
|
|||
{
|
||||
"editor.detectIndentation": false,
|
||||
"editor.insertSpaces": false,
|
||||
"files.insertFinalNewline": true,
|
||||
"editor.formatOnPaste": true,
|
||||
"editor.formatOnSave": true,
|
||||
"editor.tabSize": 4,
|
||||
"[javascript]": {
|
||||
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
|
||||
},
|
||||
"[vue]": {
|
||||
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
|
||||
},
|
||||
"vetur.format.enable": true,
|
||||
"files.eol": "\n",
|
||||
"eslint.alwaysShowStatus": true,
|
||||
"eslint.format.enable": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": true
|
||||
},
|
||||
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -1,97 +0,0 @@
|
|||
{
|
||||
"name": "@chibisafe/backend",
|
||||
"version": "5.0.0",
|
||||
"main": "dist/main.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/WeebDev/chibisafe.git"
|
||||
},
|
||||
"author": {
|
||||
"name": "Pitu",
|
||||
"email": "heyitspitu@gmail.com",
|
||||
"url": "https://github.com/Pitu"
|
||||
},
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"dev": "nodemon -r dotenv/config src/main.ts",
|
||||
"start": "NODE_ENV=production node -r dotenv/config dist/main.js",
|
||||
"build": "tsc && cpy ./views ../dist --parents --cwd=src",
|
||||
"migrate": "prisma migrate dev",
|
||||
"migrate:force": "prisma migrate reset && prisma migrate dev",
|
||||
"seed": "prisma db seed --preview-feature",
|
||||
"sqlite": "sqlite_web -p 5002 database/database.sqlite"
|
||||
},
|
||||
"dependencies": {
|
||||
"@prisma/client": "^2.21.2",
|
||||
"@types/cron": "^1.7.2",
|
||||
"adm-zip": "^0.5.5",
|
||||
"axios": "^0.21.1",
|
||||
"bcryptjs": "^2.4.3",
|
||||
"better-sqlite3": "^7.1.5",
|
||||
"blake3": "^2.1.4",
|
||||
"busboy": "^0.3.1",
|
||||
"chrono-node": "^2.3.0",
|
||||
"cors": "^2.8.5",
|
||||
"cron": "^1.8.2",
|
||||
"dotenv": "^8.2.0",
|
||||
"express": "^4.17.1",
|
||||
"express-rate-limit": "^5.2.6",
|
||||
"ffmpeg-probe": "^1.0.6",
|
||||
"file-type": "^16.5.0",
|
||||
"fluent-ffmpeg": "^2.1.2",
|
||||
"fs-jetpack": "^4.1.0",
|
||||
"helmet": "^4.5.0",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"moment": "^2.29.1",
|
||||
"morgan": "^1.10.0",
|
||||
"qoa": "^0.2.0",
|
||||
"randomstring": "^1.2.1",
|
||||
"rotating-file-stream": "^2.1.5",
|
||||
"search-query-parser": "^1.6.0",
|
||||
"sharp": "^0.28.3",
|
||||
"systeminformation": "^5.7.7",
|
||||
"uuid": "^8.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bcryptjs": "^2.4.2",
|
||||
"@types/cors": "^2.8.10",
|
||||
"@types/express": "^4.17.11",
|
||||
"@types/express-rate-limit": "^5.1.2",
|
||||
"@types/jsonwebtoken": "^8.5.1",
|
||||
"@types/morgan": "^1.9.2",
|
||||
"@types/node": "^14.14.41",
|
||||
"@types/sharp": "^0.27.1",
|
||||
"@typescript-eslint/eslint-plugin": "^4.22.0",
|
||||
"@typescript-eslint/parser": "^4.22.0",
|
||||
"cpy-cli": "^3.1.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^7.24.0",
|
||||
"eslint-config-marine": "^8.3.2",
|
||||
"nodemon": "^2.0.7",
|
||||
"prisma": "^2.21.2",
|
||||
"ts-node": "^9.1.1",
|
||||
"typescript": "^4.2.2"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"marine/node"
|
||||
]
|
||||
},
|
||||
"prisma": {
|
||||
"schema": "src/prisma/schema.prisma"
|
||||
},
|
||||
"volta": {
|
||||
"node": "16.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"chibisafe",
|
||||
"lolisafe",
|
||||
"upload",
|
||||
"uploader",
|
||||
"file",
|
||||
"vue",
|
||||
"ssr",
|
||||
"file uploader",
|
||||
"images"
|
||||
]
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
module.exports = {
|
||||
moduleFileExtensions: ['js', 'json', 'vue'],
|
||||
moduleDirectories: ['node_modules'],
|
||||
transform: {
|
||||
'^.+\\.js$': '<rootDir>/node_modules/babel-jest',
|
||||
'.*\\.(vue)$': '<rootDir>/node_modules/vue-jest'
|
||||
},
|
||||
transformIgnorePatterns: ['/node_modules/(?!vue)']
|
||||
};
|
23
knexfile.js
23
knexfile.js
|
@ -1,23 +0,0 @@
|
|||
require('dotenv').config();
|
||||
|
||||
module.exports = {
|
||||
client: process.env.DB_CLIENT,
|
||||
connection: {
|
||||
host: process.env.DB_HOST,
|
||||
user: process.env.DB_USER,
|
||||
password: process.env.DB_PASSWORD,
|
||||
database: process.env.DB_DATABASE,
|
||||
filename: 'database/database.sqlite'
|
||||
},
|
||||
pool: {
|
||||
min: process.env.DATABASE_POOL_MIN || 2,
|
||||
max: process.env.DATABASE_POOL_MAX || 10
|
||||
},
|
||||
migrations: {
|
||||
directory: 'src/api/database/migrations'
|
||||
},
|
||||
seeds: {
|
||||
directory: 'src/api/database/seeds'
|
||||
},
|
||||
useNullAsDefault: process.env.DB_CLIENT === 'sqlite3'
|
||||
};
|
|
@ -1,4 +1,3 @@
|
|||
import dotenv from 'dotenv/config';
|
||||
import autoprefixer from 'autoprefixer';
|
||||
import jetpack from 'fs-jetpack';
|
||||
|
||||
|
@ -8,55 +7,55 @@ const clientConfig = {
|
|||
URL: process.env.DOMAIN,
|
||||
baseURL: `${process.env.DOMAIN}${process.env.ROUTE_PREFIX}`,
|
||||
serviceName: process.env.SERVICE_NAME,
|
||||
maxFileSize: parseInt(process.env.MAX_SIZE, 10),
|
||||
chunkSize: parseInt(process.env.CHUNK_SIZE, 10),
|
||||
maxLinksPerAlbum: parseInt(process.env.MAX_LINKS_PER_ALBUM, 10),
|
||||
maxFileSize: parseInt(process.env.MAX_SIZE, 10,),
|
||||
chunkSize: parseInt(process.env.CHUNK_SIZE, 10,),
|
||||
maxLinksPerAlbum: parseInt(process.env.MAX_LINKS_PER_ALBUM, 10,),
|
||||
publicMode: process.env.PUBLIC_MODE === 'true',
|
||||
userAccounts: process.env.USER_ACCOUNTS === 'true'
|
||||
userAccounts: process.env.USER_ACCOUNTS === 'true',
|
||||
};
|
||||
|
||||
export default {
|
||||
ssr: true,
|
||||
server: {
|
||||
port: process.env.WEBSITE_PORT
|
||||
port: process.env.WEBSITE_PORT,
|
||||
},
|
||||
srcDir: 'src/site/',
|
||||
srcDir: 'src/',
|
||||
head: {
|
||||
title: process.env.SERVICE_NAME,
|
||||
titleTemplate: `%s | ${process.env.SERVICE_NAME}`,
|
||||
// TODO: Add the directory with pictures for favicon and stuff
|
||||
meta: [
|
||||
{ charset: 'utf-8' },
|
||||
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
||||
{ hid: 'theme-color', name: 'theme-color', content: `${process.env.META_THEME_COLOR}` },
|
||||
{ hid: 'description', name: 'description', content: `${process.env.META_DESCRIPTION}` },
|
||||
{ hid: 'keywords', name: 'keywords', content: `${process.env.META_KEYWORDS}` },
|
||||
{ charset: 'utf-8', },
|
||||
{ name: 'viewport', content: 'width=device-width, initial-scale=1', },
|
||||
{ hid: 'theme-color', name: 'theme-color', content: `${process.env.META_THEME_COLOR}`, },
|
||||
{ hid: 'description', name: 'description', content: `${process.env.META_DESCRIPTION}`, },
|
||||
{ hid: 'keywords', name: 'keywords', content: `${process.env.META_KEYWORDS}`, },
|
||||
{
|
||||
hid: 'apple-mobile-web-app-title',
|
||||
name: 'apple-mobile-web-app-title',
|
||||
content: `${process.env.SERVICE_NAME}`
|
||||
content: `${process.env.SERVICE_NAME}`,
|
||||
},
|
||||
{ hid: 'application-name', name: 'application-name', content: `${process.env.SERVICE_NAME}` },
|
||||
{ hid: 'twitter:card', name: 'twitter:card', content: 'summary' },
|
||||
{ hid: 'twitter:site', name: 'twitter:site', content: `${process.env.META_TWITTER_HANDLE}` },
|
||||
{ hid: 'twitter:creator', name: 'twitter:creator', content: `${process.env.META_TWITTER_HANDLE}` },
|
||||
{ hid: 'twitter:title', name: 'twitter:title', content: `${process.env.SERVICE_NAME}` },
|
||||
{ hid: 'twitter:description', name: 'twitter:description', content: `${process.env.META_DESCRIPTION}` },
|
||||
{ hid: 'twitter:image', name: 'twitter:image', content: `${process.env.DOMAIN}/logo.png` },
|
||||
{ hid: 'og:url', property: 'og:url', content: `${process.env.DOMAIN}` },
|
||||
{ hid: 'og:type', property: 'og:type', content: 'website' },
|
||||
{ hid: 'og:title', property: 'og:title', content: `${process.env.SERVICE_NAME}` },
|
||||
{ hid: 'og:description', property: 'og:description', content: `${process.env.META_DESCRIPTION}` },
|
||||
{ hid: 'og:image', property: 'og:image', content: `${process.env.DOMAIN}/logo.png` },
|
||||
{ hid: 'og:image:secure_url', property: 'og:image:secure_url', content: `${process.env.DOMAIN}/logo.png` },
|
||||
{ hid: 'og:site_name', property: 'og:site_name', content: `${process.env.SERVICE_NAME}` }
|
||||
{ hid: 'application-name', name: 'application-name', content: `${process.env.SERVICE_NAME}`, },
|
||||
{ hid: 'twitter:card', name: 'twitter:card', content: 'summary', },
|
||||
{ hid: 'twitter:site', name: 'twitter:site', content: `${process.env.META_TWITTER_HANDLE}`, },
|
||||
{ hid: 'twitter:creator', name: 'twitter:creator', content: `${process.env.META_TWITTER_HANDLE}`, },
|
||||
{ hid: 'twitter:title', name: 'twitter:title', content: `${process.env.SERVICE_NAME}`, },
|
||||
{ hid: 'twitter:description', name: 'twitter:description', content: `${process.env.META_DESCRIPTION}`, },
|
||||
{ hid: 'twitter:image', name: 'twitter:image', content: `${process.env.DOMAIN}/logo.png`, },
|
||||
{ hid: 'og:url', property: 'og:url', content: `${process.env.DOMAIN}`, },
|
||||
{ hid: 'og:type', property: 'og:type', content: 'website', },
|
||||
{ hid: 'og:title', property: 'og:title', content: `${process.env.SERVICE_NAME}`, },
|
||||
{ hid: 'og:description', property: 'og:description', content: `${process.env.META_DESCRIPTION}`, },
|
||||
{ hid: 'og:image', property: 'og:image', content: `${process.env.DOMAIN}/logo.png`, },
|
||||
{ hid: 'og:image:secure_url', property: 'og:image:secure_url', content: `${process.env.DOMAIN}/logo.png`, },
|
||||
{ hid: 'og:site_name', property: 'og:site_name', content: `${process.env.SERVICE_NAME}`, },
|
||||
],
|
||||
link: [
|
||||
{ rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Nunito:300,400,600,700' },
|
||||
{ rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Nunito:300,400,600,700', },
|
||||
|
||||
// This one is a pain in the ass to make it customizable, so you should edit it manually
|
||||
{ type: 'application/json+oembed', href: `${process.env.DOMAIN}/oembed.json` }
|
||||
]
|
||||
{ type: 'application/json+oembed', href: `${process.env.DOMAIN}/oembed.json`, },
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
'~/plugins/axios',
|
||||
|
@ -66,32 +65,32 @@ export default {
|
|||
'~/plugins/vue-timeago',
|
||||
'~/plugins/vuebar',
|
||||
'~/plugins/notifier',
|
||||
'~/plugins/handler'
|
||||
'~/plugins/handler',
|
||||
],
|
||||
css: [],
|
||||
modules: ['@nuxtjs/axios', 'cookie-universal-nuxt'],
|
||||
modules: ['@nuxtjs/axios', 'cookie-universal-nuxt',],
|
||||
router: {
|
||||
linkActiveClass: 'is-active',
|
||||
linkExactActiveClass: 'is-active'
|
||||
linkExactActiveClass: 'is-active',
|
||||
},
|
||||
axios: {
|
||||
baseURL: `${process.env.DOMAIN}${process.env.ROUTE_PREFIX}`
|
||||
baseURL: `${process.env.DOMAIN}${process.env.ROUTE_PREFIX}`,
|
||||
},
|
||||
build: {
|
||||
extractCSS: process.env.NODE_ENV === 'production',
|
||||
postcss: {
|
||||
preset: {
|
||||
autoprefixer
|
||||
}
|
||||
autoprefixer,
|
||||
},
|
||||
},
|
||||
extend(config, { isClient, isDev }) {
|
||||
extend(config, { isClient, isDev, },) {
|
||||
// Extend only webpack config for client-bundle
|
||||
if (isClient) {
|
||||
jetpack.write('dist/config.json', clientConfig);
|
||||
jetpack.write('dist/config.json', clientConfig,);
|
||||
}
|
||||
if (isDev) {
|
||||
config.devtool = isClient ? 'source-map' : 'inline-source-map';
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
File diff suppressed because it is too large
Load Diff
116
package.json
116
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "chibisafe",
|
||||
"version": "4.0.2",
|
||||
"version": "5.0.0",
|
||||
"description": "Blazing fast file uploader and bunker written in node! 🚀",
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
|
@ -31,56 +31,50 @@
|
|||
"url": "https://github.com/WeebDev/chibisafe/issues"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
"node": ">=16.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mdi/font": "^5.8.55",
|
||||
"@nuxtjs/axios": "^5.12.5",
|
||||
"adm-zip": "^0.4.13",
|
||||
"bcrypt": "^5.0.0",
|
||||
"@prisma/client": "^2.21.2",
|
||||
"adm-zip": "^0.5.5",
|
||||
"axios": "^0.21.1",
|
||||
"bcryptjs": "^2.4.3",
|
||||
"better-sqlite3": "^7.1.5",
|
||||
"blake3": "^2.1.4",
|
||||
"body-parser": "^1.18.3",
|
||||
"buefy": "^0.9.4",
|
||||
"busboy": "^0.2.14",
|
||||
"chalk": "^2.4.1",
|
||||
"chrono-node": "^2.1.4",
|
||||
"compression": "^1.7.2",
|
||||
"busboy": "^0.3.1",
|
||||
"chrono-node": "^2.3.0",
|
||||
"cookie-universal-nuxt": "^2.0.14",
|
||||
"cors": "^2.8.5",
|
||||
"cron": "^1.8.2",
|
||||
"dotenv": "^6.2.0",
|
||||
"dumper.js": "^1.3.1",
|
||||
"dotenv": "^8.2.0",
|
||||
"express": "^4.17.1",
|
||||
"express-rate-limit": "^3.4.0",
|
||||
"express-rate-limit": "^5.2.6",
|
||||
"fastify": "^3.18.0",
|
||||
"ffmpeg-probe": "^1.0.6",
|
||||
"file-saver": "^2.0.1",
|
||||
"file-type": "^16.1.0",
|
||||
"file-type": "^16.5.0",
|
||||
"fluent-ffmpeg": "^2.1.2",
|
||||
"fs-jetpack": "^2.2.2",
|
||||
"helmet": "^3.15.1",
|
||||
"fs-jetpack": "^4.1.0",
|
||||
"helmet": "^4.5.0",
|
||||
"imagesloaded": "^4.1.4",
|
||||
"jsonwebtoken": "^8.5.0",
|
||||
"knex": "^0.21.15",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"masonry-layout": "^4.2.2",
|
||||
"moment": "^2.24.0",
|
||||
"moment": "^2.29.1",
|
||||
"morgan": "^1.10.0",
|
||||
"multer": "^1.4.1",
|
||||
"mysql": "^2.16.0",
|
||||
"nuxt": "^2.14.12",
|
||||
"nuxt-dropzone": "^0.2.8",
|
||||
"pg": "^7.8.1",
|
||||
"qoa": "^0.2.0",
|
||||
"randomstring": "^1.1.5",
|
||||
"rotating-file-stream": "^2.1.3",
|
||||
"search-query-parser": "^1.5.5",
|
||||
"serve-static": "^1.13.2",
|
||||
"sharp": "^0.27.0",
|
||||
"sqlite3": "^5.0.0",
|
||||
"systeminformation": "^4.34.5",
|
||||
"uuid": "^3.3.2",
|
||||
"randomstring": "^1.2.1",
|
||||
"rotating-file-stream": "^2.1.5",
|
||||
"search-query-parser": "^1.6.0",
|
||||
"sharp": "^0.28.3",
|
||||
"systeminformation": "^5.7.7",
|
||||
"uuid": "^8.3.2",
|
||||
"v-clipboard": "^2.2.1",
|
||||
"vue-axios": "^2.1.4",
|
||||
"vue-isyourpasswordsafe": "^1.0.2",
|
||||
"vue-isyourpasswordsafe": "^2.0.0",
|
||||
"vue-plyr": "^5.1.0",
|
||||
"vue-timeago": "^3.4.4",
|
||||
"vue2-transitions": "^0.2.3",
|
||||
|
@ -89,47 +83,47 @@
|
|||
"devDependencies": {
|
||||
"@babel/core": "^7.12.10",
|
||||
"@babel/preset-env": "^7.12.11",
|
||||
"@vue/test-utils": "^1.1.2",
|
||||
"@types/bcryptjs": "^2.4.2",
|
||||
"@types/cors": "^2.8.10",
|
||||
"@types/cron": "^1.7.2",
|
||||
"@types/express": "^4.17.11",
|
||||
"@types/express-rate-limit": "^5.1.2",
|
||||
"@types/jsonwebtoken": "^8.5.1",
|
||||
"@types/morgan": "^1.9.2",
|
||||
"@types/node": "^14.14.41",
|
||||
"@types/sharp": "^0.27.1",
|
||||
"@typescript-eslint/eslint-plugin": "^4.22.0",
|
||||
"@typescript-eslint/parser": "^4.22.0",
|
||||
"autoprefixer": "^9.4.7",
|
||||
"axios": "^0.21.1",
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"babel-jest": "^26.6.3",
|
||||
"cross-env": "^5.2.0",
|
||||
"eslint": "^7.17.0",
|
||||
"eslint-config-aqua": "^7.3.0",
|
||||
"cpy-cli": "^3.1.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^7.24.0",
|
||||
"eslint-config-aqua": "^9.0.2",
|
||||
"eslint-config-marine": "^9.0.6",
|
||||
"eslint-import-resolver-nuxt": "^1.0.1",
|
||||
"eslint-plugin-vue": "^5.2.1",
|
||||
"jest": "^26.6.3",
|
||||
"jest-serializer-vue": "^2.0.2",
|
||||
"node-sass": "^5.0.0",
|
||||
"nodemon": "^1.19.3",
|
||||
"node-sass": "^6.0.0",
|
||||
"nodemon": "^2.0.7",
|
||||
"postcss-css-variables": "^0.11.0",
|
||||
"postcss-nested": "^3.0.0",
|
||||
"puppeteer": "^5.5.0",
|
||||
"sass-loader": "^10.1.0",
|
||||
"vue-jest": "^3.0.7"
|
||||
"postcss-nested": "^5.0.5",
|
||||
"prisma": "^2.21.2",
|
||||
"sass-loader": "^12.1.0",
|
||||
"ts-node": "^9.1.1",
|
||||
"typescript": "^4.2.2"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"aqua/node",
|
||||
"aqua/vue"
|
||||
],
|
||||
"parserOptions": {
|
||||
"parser": "babel-eslint",
|
||||
"sourceType": "module"
|
||||
},
|
||||
"settings": {
|
||||
"import/resolver": {
|
||||
"nuxt": {
|
||||
"nuxtSrcDir": "./src/site",
|
||||
"extensions": [
|
||||
".js",
|
||||
".vue"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
"marine/node"
|
||||
]
|
||||
},
|
||||
"prisma": {
|
||||
"schema": "src/prisma/schema.prisma"
|
||||
},
|
||||
"volta": {
|
||||
"node": "16.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"chibisafe",
|
||||
|
|
|
@ -40,7 +40,7 @@ const start = async () => {
|
|||
if (process.env.NODE_ENV === 'production') {
|
||||
const accessLogStream = rfs.createStream('access.log', {
|
||||
interval: '1d', // rotate daily
|
||||
path: path.join(__dirname, '../../logs', 'log')
|
||||
path: path.join(__dirname, '../../../logs', 'log')
|
||||
});
|
||||
server.use(morgan('combined', { stream: accessLogStream }));
|
||||
} else {
|
||||
|
@ -64,7 +64,7 @@ const start = async () => {
|
|||
listen.setTimeout(600000);
|
||||
|
||||
// Serve the uploads
|
||||
server.use(express.static(path.join(__dirname, '../../uploads')));
|
||||
server.use(express.static(path.join(__dirname, '../../../uploads')));
|
||||
|
||||
// void serveNuxt();
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
import { Request, Response, NextFunction } from 'express';
|
||||
import JWT from 'jsonwebtoken';
|
||||
import prisma from '../structures/database';
|
||||
|
||||
interface Decoded {
|
||||
sub: number;
|
||||
}
|
||||
export interface RequestWithUser extends Request {
|
||||
user: {
|
||||
id: number;
|
||||
username: string | null;
|
||||
};
|
||||
}
|
||||
|
||||
export default (req: RequestWithUser, res: Response, next: NextFunction) => {
|
||||
if (!req.headers.authorization) return res.status(401).json({ message: 'No authorization header provided' });
|
||||
|
||||
const token = req.headers.authorization.split(' ')[1];
|
||||
if (!token) return res.status(401).json({ message: 'No authorization header provided' });
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
JWT.verify(token, process.env.secret ?? '', async (error, decoded) => {
|
||||
if (error) return res.status(401).json({ message: 'Invalid token' });
|
||||
const id = (decoded as Decoded | undefined)?.sub ?? null;
|
||||
if (!id) return res.status(401).json({ message: 'Invalid authorization' });
|
||||
|
||||
const user = await prisma.users.findFirst({
|
||||
where: {
|
||||
id
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
username: true
|
||||
}
|
||||
});
|
||||
|
||||
if (!user) return res.status(401).json({ message: 'Invalid authorization' });
|
||||
req.user = user;
|
||||
next();
|
||||
});
|
||||
};
|
|
@ -4,8 +4,8 @@ generator client {
|
|||
|
||||
datasource db {
|
||||
provider = "sqlite"
|
||||
url = "file:../../../database/database.sqlite"
|
||||
shadowDatabaseUrl = "file:../../../database/shadow.sqlite"
|
||||
url = "file:../../../../database/database.sqlite"
|
||||
shadowDatabaseUrl = "file:../../../../database/shadow.sqlite"
|
||||
}
|
||||
|
||||
model albums {
|
|
@ -12,5 +12,5 @@
|
|||
"outDir": "./dist",
|
||||
"sourceRoot": "./"
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx"]
|
||||
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "../api/main.ts", "../api/structures/routes.ts", "../api/structures/interfaces.ts"]
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "Node",
|
||||
"esModuleInterop": true,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"target": "ES2018",
|
||||
"module": "ESNext",
|
||||
"lib": [
|
||||
"ESNext",
|
||||
"ESNext.AsyncIterable",
|
||||
"DOM"
|
||||
],
|
||||
"allowJs": true,
|
||||
"noEmit": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"~/*": [
|
||||
"./*"
|
||||
],
|
||||
"@/*": [
|
||||
"./*"
|
||||
]
|
||||
},
|
||||
"types": [
|
||||
"@nuxt/types",
|
||||
"@nuxtjs/axios",
|
||||
"@nuxtjs/color-mode"
|
||||
]
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue