Initial commit

This commit is contained in:
Andrew
2024-02-02 14:36:51 +03:00
commit ab35775e94
27 changed files with 16432 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
node_modules/
dist/build/
+60
View File
@@ -0,0 +1,60 @@
FROM node:18-alpine as build
ARG APP_DIRECTORY
ARG NODE_ENV
# Set working directory
WORKDIR ${APP_DIRECTORY}
# Upgrade & install system dependencies
RUN apk update
RUN apk add --no-cache \
build-base gcc autoconf automake zlib-dev libpng-dev vips-dev git \
> /dev/null 2>&1
# Copy dependency files
COPY package.json package-lock.json ./
# Install production dependencies
RUN npm config set registry https://registry.npmjs.org/
RUN npm install -g node-gyp
RUN npm ci --omit=dev --loglevel verbose
# Add node_modules/.bin to PATH
ENV PATH ${APP_DIRECTORY}/node_modules/.bin:$PATH
# Copy source files and build
WORKDIR ${APP_DIRECTORY}/app
COPY . .
RUN npm run build
FROM node:18-alpine as production
ARG APP_DIRECTORY
ARG NODE_ENV
ENV TIMEZONE "UTC"
# Set local timezone
RUN ln -snf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime && echo ${TIMEZONE} > /etc/timezone
# Upgrade & install image processing dependency
RUN apk upgrade --no-cache && \
apk add --no-cache vips-dev
# Copy node_modules over to the parent directory
WORKDIR ${APP_DIRECTORY}
COPY --from=build ${APP_DIRECTORY}/node_modules ./node_modules
# Copy app files
WORKDIR ${APP_DIRECTORY}/app
COPY --from=build ${APP_DIRECTORY}/app .
# Add node_modules/.bin to PATH
ENV PATH ${APP_DIRECTORY}/node_modules/.bin:$PATH
# Set user and group rights
RUN chown -R node:node ${APP_DIRECTORY}
# Run as node
USER node
CMD ["npm", "run", "develop"]
+18
View File
@@ -0,0 +1,18 @@
export default ({ env }) => ({
auth: {
secret: env('ADMIN_JWT_SECRET'),
},
apiToken: {
salt: env('API_TOKEN_SALT'),
},
transfer: {
token: {
salt: env('TRANSFER_TOKEN_SALT'),
},
},
flags: {
nps: env.bool('FLAG_NPS', true),
promoteEE: env.bool('FLAG_PROMOTE_EE', true),
},
url: env('APP_ADMIN_PREFIX', '/dashboard'),
});
+8
View File
@@ -0,0 +1,8 @@
export default {
rest: {
prefix: '/data',
defaultLimit: 25,
maxLimit: 100,
withCount: true,
},
};
+93
View File
@@ -0,0 +1,93 @@
import path from 'path';
export default ({ env }) => {
const client = env('DATABASE_CLIENT', 'sqlite');
const connections = {
mysql: {
connection: {
connectionString: env('DATABASE_URL'),
host: env('DATABASE_HOST', 'localhost'),
port: env.int('DATABASE_PORT', 3306),
database: env('DATABASE_NAME', 'strapi'),
user: env('DATABASE_USERNAME', 'strapi'),
password: env('DATABASE_PASSWORD', 'strapi'),
ssl: env.bool('DATABASE_SSL', false) && {
key: env('DATABASE_SSL_KEY', undefined),
cert: env('DATABASE_SSL_CERT', undefined),
ca: env('DATABASE_SSL_CA', undefined),
capath: env('DATABASE_SSL_CAPATH', undefined),
cipher: env('DATABASE_SSL_CIPHER', undefined),
rejectUnauthorized: env.bool(
'DATABASE_SSL_REJECT_UNAUTHORIZED',
true
),
},
},
pool: { min: env.int('DATABASE_POOL_MIN', 2), max: env.int('DATABASE_POOL_MAX', 10) },
},
mysql2: {
connection: {
host: env('DATABASE_HOST', 'localhost'),
port: env.int('DATABASE_PORT', 3306),
database: env('DATABASE_NAME', 'strapi'),
user: env('DATABASE_USERNAME', 'strapi'),
password: env('DATABASE_PASSWORD', 'strapi'),
ssl: env.bool('DATABASE_SSL', false) && {
key: env('DATABASE_SSL_KEY', undefined),
cert: env('DATABASE_SSL_CERT', undefined),
ca: env('DATABASE_SSL_CA', undefined),
capath: env('DATABASE_SSL_CAPATH', undefined),
cipher: env('DATABASE_SSL_CIPHER', undefined),
rejectUnauthorized: env.bool(
'DATABASE_SSL_REJECT_UNAUTHORIZED',
true
),
},
},
pool: { min: env.int('DATABASE_POOL_MIN', 2), max: env.int('DATABASE_POOL_MAX', 10) },
},
postgres: {
connection: {
connectionString: env('DATABASE_URL'),
host: env('DATABASE_HOST', 'localhost'),
port: env.int('DATABASE_PORT', 5432),
database: env('DATABASE_NAME', 'strapi'),
user: env('DATABASE_USERNAME', 'strapi'),
password: env('DATABASE_PASSWORD', 'strapi'),
ssl: env.bool('DATABASE_SSL', false) && {
key: env('DATABASE_SSL_KEY', undefined),
cert: env('DATABASE_SSL_CERT', undefined),
ca: env('DATABASE_SSL_CA', undefined),
capath: env('DATABASE_SSL_CAPATH', undefined),
cipher: env('DATABASE_SSL_CIPHER', undefined),
rejectUnauthorized: env.bool(
'DATABASE_SSL_REJECT_UNAUTHORIZED',
true
),
},
schema: env('DATABASE_SCHEMA', 'public'),
},
pool: { min: env.int('DATABASE_POOL_MIN', 2), max: env.int('DATABASE_POOL_MAX', 10) },
},
sqlite: {
connection: {
filename: path.join(
__dirname,
'..',
'..',
env('DATABASE_FILENAME', '.tmp/data.db')
),
},
useNullAsDefault: true,
},
};
return {
connection: {
client,
...connections[client],
acquireConnectionTimeout: env.int('DATABASE_CONNECTION_TIMEOUT', 60000),
},
};
};
+13
View File
@@ -0,0 +1,13 @@
export default [
'strapi::logger',
'strapi::errors',
'strapi::security',
'strapi::cors',
'strapi::poweredBy',
'strapi::query',
'strapi::body',
'strapi::session',
'strapi::favicon',
'strapi::public',
{ resolve: './src/middlewares/redirect' }
];
+1
View File
@@ -0,0 +1 @@
export default () => ({});
+11
View File
@@ -0,0 +1,11 @@
export default ({ env }) => ({
host: env('HOST', '0.0.0.0'),
port: env.int('PORT', 1337),
app: {
keys: env.array('APP_KEYS'),
},
webhooks: {
populateRelations: env.bool('WEBHOOKS_POPULATE_RELATIONS', false),
},
url: env('APP_URL', 'https://api.enderman.ch/cms'),
});
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

+15820
View File
File diff suppressed because it is too large Load Diff
+35
View File
@@ -0,0 +1,35 @@
{
"name": "cms",
"private": true,
"version": "0.1.0",
"description": "A Strapi application",
"scripts": {
"develop": "strapi develop",
"start": "strapi start",
"build": "strapi build",
"strapi": "strapi"
},
"devDependencies": {},
"dependencies": {
"@strapi/strapi": "4.19.1",
"@strapi/plugin-users-permissions": "4.19.1",
"@strapi/plugin-i18n": "4.19.1",
"@strapi/plugin-cloud": "4.19.1",
"pg": "8.8.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-router-dom": "5.3.4",
"styled-components": "5.3.3"
},
"author": {
"name": "A Strapi developer"
},
"strapi": {
"uuid": "46664143-0881-4173-b3bf-0cc5ed6810d6"
},
"engines": {
"node": ">=18.0.0 <=20.x.x",
"npm": ">=6.0.0"
},
"license": "MIT"
}
+3
View File
@@ -0,0 +1,3 @@
# To prevent search engines from seeing the site altogether, uncomment the next two lines:
# User-Agent: *
# Disallow: /
View File
+35
View File
@@ -0,0 +1,35 @@
export default {
config: {
locales: [
// 'ar',
// 'fr',
// 'cs',
// 'de',
// 'dk',
// 'es',
// 'he',
// 'id',
// 'it',
// 'ja',
// 'ko',
// 'ms',
// 'nl',
// 'no',
// 'pl',
// 'pt-BR',
// 'pt',
// 'ru',
// 'sk',
// 'sv',
// 'th',
// 'tr',
// 'uk',
// 'vi',
// 'zh-Hans',
// 'zh',
],
},
bootstrap(app) {
console.log(app);
},
};
+13
View File
@@ -0,0 +1,13 @@
{
"extends": "@strapi/typescript-utils/tsconfigs/admin",
"include": [
"../plugins/**/admin/src/**/*",
"./"
],
"exclude": [
"node_modules/",
"build/",
"dist/",
"**/*.test.ts"
]
}
@@ -0,0 +1,9 @@
'use strict';
/* eslint-disable no-unused-vars */
module.exports = (config, webpack) => {
// Note: we provide webpack above so you should not `require` it
// Perform customizations to webpack config
// Important: return the modified config
return config;
};
View File
View File
+18
View File
@@ -0,0 +1,18 @@
export default {
/**
* An asynchronous register function that runs before
* your application is initialized.
*
* This gives you an opportunity to extend code.
*/
register(/*{ strapi }*/) {},
/**
* An asynchronous bootstrap function that runs before
* your application gets started.
*
* This gives you an opportunity to set up your data model,
* run jobs, or perform some special logic.
*/
bootstrap(/*{ strapi }*/) {},
};
+10
View File
@@ -0,0 +1,10 @@
export default (_config, { strapi }) => {
const redirects = ['/', '/index.html'].map((path) => ({
method: 'GET',
path,
handler: (ctx: any) => ctx.redirect('https://youareanidiot.cc'),
config: { auth: false },
}))
strapi.server.routes(redirects)
}
+23
View File
@@ -0,0 +1,23 @@
{
"extends": "@strapi/typescript-utils/tsconfigs/server",
"compilerOptions": {
"outDir": "dist",
"rootDir": "."
},
"include": [
"./",
"./**/*.ts",
"./**/*.js",
"src/**/*.json"
],
"exclude": [
"node_modules/",
"build/",
"dist/",
".cache/",
".tmp/",
"src/admin/",
"**/*.test.*",
"src/plugins/**"
]
}