Merge pull request #33 from tycrek/gh-packages-migration

pull/34/head
Josh Moore 3 years ago committed by GitHub
commit c2afdd2cb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1 @@
@tycrek:registry=https://npm.pkg.github.com

@ -72,13 +72,13 @@ ass was designed with developers in mind. If you are a developer & want somethin
- **Multiple file storage methods** - **Multiple file storage methods**
- Local file system - Local file system
- Amazon S3 (including [DigitalOcean Spaces]) - Amazon S3 (including [DigitalOcean Spaces])
- **Multiple data storage methods** using [ass StorageEngines] (JSON by default) - **Multiple data storage methods** using [ass StorageEngines]
- **File** - **File**
- JSON (default, [ass-storage-engine]) - JSON (default, [ass-storage-engine])
- YAML (soon!) - YAML (soon!)
- **Database** - **Database**
- PostgreSQL ([ass-psql]) - PostgreSQL ([ass-psql])
- Mongo (soon!) - MongoDB ([ass-mongoose][GH AMongoose])
- MySQL (soon!) - MySQL (soon!)
[Git Submodules]: https://git-scm.com/book/en/v2/Git-Tools-Submodules [Git Submodules]: https://git-scm.com/book/en/v2/Git-Tools-Submodules
@ -340,9 +340,21 @@ module.exports = {
**Supported StorageEngines:** **Supported StorageEngines:**
| Name | Description | Links | | Name | Description | Links |
| ---- | ----------- | ----- | | :--: | ----------- | :---: |
| **JSON** | JSON-based data storage. On disk, data is stored in a JSON file. In memory, data is stored in a [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map). This is the default StorageEngine. | [GitHub](https://github.com/tycrek/ass-storage-engine/), [npm](https://www.npmjs.com/package/@tycrek/ass-storage-engine) | | **JSON** | JSON-based data storage. On disk, data is stored in a JSON file. In memory, data is stored in a [Map]. This is the default StorageEngine. | [GitHub][GH ASE] |
| **PostgreSQL** | Data storage using a [PostgreSQL](https://www.postgresql.org/) database. [node-postgres](https://node-postgres.com/) is used for communicating with the database. | [GitHub](https://github.com/tycrek/ass-psql/), [npm](https://www.npmjs.com/package/@tycrek/ass-psql) | | **PostgreSQL** | Data storage using a [PostgreSQL] database. [node-postgres] is used for communicating with the database. | [GitHub][GH APSQL] |
| **Mongoose** | Data storage using a [MongoDB]() database. [mongoose] is used for communicating with the database. Created by [@dylancl] | [GitHub][GH AMongoose]<br>[NPM][NPM AMongoose] |
[Map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
[GH ASE]: https://github.com/tycrek/ass-storage-engine/
[PostgreSQL]: https://www.postgresql.org/
[node-postgres]: https://node-postgres.com/
[GH APSQL]: https://github.com/tycrek/ass-psql/
[MongoDB]: https://www.mongodb.com/
[mongoose]: https://mongoosejs.com/
[GH AMongoose]: https://github.com/dylancl/ass-mongoose
[NPM AMongoose]: https://www.npmjs.com/package/ass-mongoose
[@dylancl]: https://github.com/dylancl
An ass StorageEngine implements support for one type of database (or file, such as JSON or YAML). This lets ass server hosts pick their database of choice, because all they'll have to do is plugin the connection/authentication details, then ass will handle the rest, using the resource ID as the key. An ass StorageEngine implements support for one type of database (or file, such as JSON or YAML). This lets ass server hosts pick their database of choice, because all they'll have to do is plugin the connection/authentication details, then ass will handle the rest, using the resource ID as the key.

@ -18,6 +18,7 @@ const { host, port, useSsl, isProxied, s3enabled } = require('./config.json');
//#region Imports //#region Imports
const fs = require('fs-extra'); const fs = require('fs-extra');
const express = require('express'); const express = require('express');
const nofavicon = require('@tycrek/express-nofavicon');
const helmet = require('helmet'); const helmet = require('helmet');
const marked = require('marked'); const marked = require('marked');
const uploadRouter = require('./routers/upload'); const uploadRouter = require('./routers/upload');
@ -65,8 +66,8 @@ app.use(helmet.referrerPolicy());
app.use(helmet.dnsPrefetchControl()); app.use(helmet.dnsPrefetchControl());
useSsl && app.use(helmet.hsts({ preload: true })); // skipcq: JS-0093 useSsl && app.use(helmet.hsts({ preload: true })); // skipcq: JS-0093
// Don't process favicon requests (custom middleware) // Don't process favicon requests
app.use((req, res, next) => (req.url.includes('favicon.ico') ? res.sendStatus(CODE_NO_CONTENT) : next())); app.use(nofavicon);
// Index can be overridden by a frontend // Index can be overridden by a frontend
app.get('/', (req, res, next) => app.get('/', (req, res, next) =>

106
package-lock.json generated

@ -9,7 +9,9 @@
"version": "0.8.0", "version": "0.8.0",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@tycrek/ass-storage-engine": "0.2.6", "@tycrek/ass-storage-engine": "0.2.7",
"@tycrek/express-nofavicon": "^1.0.2",
"@tycrek/isprod": "^2.0.2",
"@tycrek/log": ">=0.5.x", "@tycrek/log": ">=0.5.x",
"any-shell-escape": "^0.1.1", "any-shell-escape": "^0.1.1",
"aws-sdk": "^2.930.0", "aws-sdk": "^2.930.0",
@ -25,7 +27,7 @@
"jimp": "^0.16.1", "jimp": "^0.16.1",
"luxon": "^1.26.0", "luxon": "^1.26.0",
"marked": "^2.0.7", "marked": "^2.0.7",
"multer": "^2.0.0-rc.2", "multer": "2.0.0-rc.2",
"node-fetch": "^2.6.1", "node-fetch": "^2.6.1",
"node-vibrant": "*", "node-vibrant": "*",
"prompt": "^1.1.0", "prompt": "^1.1.0",
@ -563,19 +565,12 @@
} }
}, },
"node_modules/@tycrek/ass-storage-engine": { "node_modules/@tycrek/ass-storage-engine": {
"version": "0.2.6", "version": "0.2.7",
"resolved": "https://registry.npmjs.org/@tycrek/ass-storage-engine/-/ass-storage-engine-0.2.6.tgz", "resolved": "https://npm.pkg.github.com/download/@tycrek/ass-storage-engine/0.2.7/df4ac2b8dec3295304758a737a8f5b2866b1a3c450a17aea6a2b6a0b93231fee",
"integrity": "sha512-jSzeM8pBFEO4TNX+l9YXb+9qOFiz+U8GRc01zf9lC9kMD2mHxUIPvezTTHkXV30vGJ0XNd0TiwMKSn171fG1tg==", "integrity": "sha512-vSYB2sdq6hu+u6LHjbM177nmbXt3dMIAD4P1h2MsdFB5A0735ZF6gfl/vh+YpXd+nOl0Mk8QiGVKXCmJqMwBRQ==",
"license": "ISC",
"dependencies": { "dependencies": {
"fs-extra": "^10.0.0" "fs-extra": "^10.0.0"
},
"engines": {
"node": ">=14.x.x",
"npm": ">=7.x.x"
},
"funding": {
"type": "patreon",
"url": "https://patreon.com/tycrek"
} }
}, },
"node_modules/@tycrek/ass-storage-engine/node_modules/fs-extra": { "node_modules/@tycrek/ass-storage-engine/node_modules/fs-extra": {
@ -591,23 +586,28 @@
"node": ">=12" "node": ">=12"
} }
}, },
"node_modules/@tycrek/express-nofavicon": {
"version": "1.0.3",
"resolved": "https://npm.pkg.github.com/download/@tycrek/express-nofavicon/1.0.3/45d58ff8a8d0b996d6432634e06d592ca8e385a69ffe19d84b30ee27bddae7de",
"integrity": "sha512-GPqmhJZ5308/PrMSYYIZCXTCaZHUJfeB/Tvc4oYUHri8T4tprnxbbjC5p1/W8bpJFTqZPhFKcRq9cnZ2vvJ/2A==",
"license": "ISC"
},
"node_modules/@tycrek/isprod": {
"version": "2.0.2",
"resolved": "https://npm.pkg.github.com/download/@tycrek/isprod/2.0.2/a627b888d478fc858a16f41af45ba040e852d29cb1c05324b33dc540f4057dbc",
"integrity": "sha512-01JluxLzmRb61o3cpdA44Eeg0BAXDrTJyZ4HQsEaKgaq3UP1nJ5dnqBW3ZUmYTDpjepdftzy2ns90/HmMnJSdg==",
"license": "ISC"
},
"node_modules/@tycrek/log": { "node_modules/@tycrek/log": {
"version": "0.5.5", "version": "0.5.6",
"resolved": "https://registry.npmjs.org/@tycrek/log/-/log-0.5.5.tgz", "resolved": "https://npm.pkg.github.com/download/@tycrek/log/0.5.6/53ef4c9e0da0eac0fb47d97f434f304c3833a94319dabb3708bc372ca5642a2f",
"integrity": "sha512-yBZQ8iRnxrYd3OeU73UcU6Qht44r/ScdqHJDIzdZNZd+A+3B8WomnGOvIxj12/54OHOXyOUbs/EpgzE1Y/iBrQ==", "integrity": "sha512-rGGUNowoNhtr7pPuoMKJUL52gUraMPUvDfuyoIdAb16esLsXMp01HstQPMr0tMWIAIs1fm6tWUhw/Q4uSa++gA==",
"license": "ISC",
"dependencies": { "dependencies": {
"chalk": "^4.1.1", "chalk": "^4.1.1",
"deepmerge": "^4.2.2", "deepmerge": "^4.2.2",
"luxon": "^1.27.0", "luxon": "^1.27.0",
"use-climate-change-reminder": "^0.0.7" "use-climate-change-reminder": "^0.0.7"
},
"engines": {
"node": ">=14.x.x",
"npm": ">=7.x.x"
},
"funding": {
"type": "patreon",
"url": "https://patreon.com/tycrek"
} }
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
@ -932,9 +932,9 @@
} }
}, },
"node_modules/aws-sdk": { "node_modules/aws-sdk": {
"version": "2.956.0", "version": "2.957.0",
"resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.956.0.tgz", "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.957.0.tgz",
"integrity": "sha512-vSzL66tjeRSBPnLR2Pkx4qS7SPqADT7K9QBjWdMhVd9BF5spyMvJ9hReIEShILp3hq99sHI+MvO+uTUm5s023g==", "integrity": "sha512-TtRv/ebZL7gWgAW8XGlRizs5xhyzlDt2KbrxoPcHcxPTH8KHlbEyOmAXafyB7K/Jf3En5TDdJN1daJ4idSKWSg==",
"hasInstallScript": true, "hasInstallScript": true,
"dependencies": { "dependencies": {
"buffer": "4.9.2", "buffer": "4.9.2",
@ -1089,9 +1089,9 @@
} }
}, },
"node_modules/buffer-from": { "node_modules/buffer-from": {
"version": "1.1.1", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
"integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="
}, },
"node_modules/busboy": { "node_modules/busboy": {
"version": "0.3.1", "version": "0.3.1",
@ -1138,9 +1138,9 @@
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="
}, },
"node_modules/chalk": { "node_modules/chalk": {
"version": "4.1.1", "version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dependencies": { "dependencies": {
"ansi-styles": "^4.1.0", "ansi-styles": "^4.1.0",
"supports-color": "^7.1.0" "supports-color": "^7.1.0"
@ -4176,9 +4176,9 @@
} }
}, },
"@tycrek/ass-storage-engine": { "@tycrek/ass-storage-engine": {
"version": "0.2.6", "version": "0.2.7",
"resolved": "https://registry.npmjs.org/@tycrek/ass-storage-engine/-/ass-storage-engine-0.2.6.tgz", "resolved": "https://npm.pkg.github.com/download/@tycrek/ass-storage-engine/0.2.7/df4ac2b8dec3295304758a737a8f5b2866b1a3c450a17aea6a2b6a0b93231fee",
"integrity": "sha512-jSzeM8pBFEO4TNX+l9YXb+9qOFiz+U8GRc01zf9lC9kMD2mHxUIPvezTTHkXV30vGJ0XNd0TiwMKSn171fG1tg==", "integrity": "sha512-vSYB2sdq6hu+u6LHjbM177nmbXt3dMIAD4P1h2MsdFB5A0735ZF6gfl/vh+YpXd+nOl0Mk8QiGVKXCmJqMwBRQ==",
"requires": { "requires": {
"fs-extra": "^10.0.0" "fs-extra": "^10.0.0"
}, },
@ -4195,10 +4195,20 @@
} }
} }
}, },
"@tycrek/express-nofavicon": {
"version": "1.0.3",
"resolved": "https://npm.pkg.github.com/download/@tycrek/express-nofavicon/1.0.3/45d58ff8a8d0b996d6432634e06d592ca8e385a69ffe19d84b30ee27bddae7de",
"integrity": "sha512-GPqmhJZ5308/PrMSYYIZCXTCaZHUJfeB/Tvc4oYUHri8T4tprnxbbjC5p1/W8bpJFTqZPhFKcRq9cnZ2vvJ/2A=="
},
"@tycrek/isprod": {
"version": "2.0.2",
"resolved": "https://npm.pkg.github.com/download/@tycrek/isprod/2.0.2/a627b888d478fc858a16f41af45ba040e852d29cb1c05324b33dc540f4057dbc",
"integrity": "sha512-01JluxLzmRb61o3cpdA44Eeg0BAXDrTJyZ4HQsEaKgaq3UP1nJ5dnqBW3ZUmYTDpjepdftzy2ns90/HmMnJSdg=="
},
"@tycrek/log": { "@tycrek/log": {
"version": "0.5.5", "version": "0.5.6",
"resolved": "https://registry.npmjs.org/@tycrek/log/-/log-0.5.5.tgz", "resolved": "https://npm.pkg.github.com/download/@tycrek/log/0.5.6/53ef4c9e0da0eac0fb47d97f434f304c3833a94319dabb3708bc372ca5642a2f",
"integrity": "sha512-yBZQ8iRnxrYd3OeU73UcU6Qht44r/ScdqHJDIzdZNZd+A+3B8WomnGOvIxj12/54OHOXyOUbs/EpgzE1Y/iBrQ==", "integrity": "sha512-rGGUNowoNhtr7pPuoMKJUL52gUraMPUvDfuyoIdAb16esLsXMp01HstQPMr0tMWIAIs1fm6tWUhw/Q4uSa++gA==",
"requires": { "requires": {
"chalk": "^4.1.1", "chalk": "^4.1.1",
"deepmerge": "^4.2.2", "deepmerge": "^4.2.2",
@ -4475,9 +4485,9 @@
"integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==" "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg=="
}, },
"aws-sdk": { "aws-sdk": {
"version": "2.956.0", "version": "2.957.0",
"resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.956.0.tgz", "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.957.0.tgz",
"integrity": "sha512-vSzL66tjeRSBPnLR2Pkx4qS7SPqADT7K9QBjWdMhVd9BF5spyMvJ9hReIEShILp3hq99sHI+MvO+uTUm5s023g==", "integrity": "sha512-TtRv/ebZL7gWgAW8XGlRizs5xhyzlDt2KbrxoPcHcxPTH8KHlbEyOmAXafyB7K/Jf3En5TDdJN1daJ4idSKWSg==",
"requires": { "requires": {
"buffer": "4.9.2", "buffer": "4.9.2",
"events": "1.1.1", "events": "1.1.1",
@ -4596,9 +4606,9 @@
"integrity": "sha1-kbx0sR6kBbyRa8aqkI+q+ltKrEs=" "integrity": "sha1-kbx0sR6kBbyRa8aqkI+q+ltKrEs="
}, },
"buffer-from": { "buffer-from": {
"version": "1.1.1", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
"integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="
}, },
"busboy": { "busboy": {
"version": "0.3.1", "version": "0.3.1",
@ -4633,9 +4643,9 @@
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="
}, },
"chalk": { "chalk": {
"version": "4.1.1", "version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"requires": { "requires": {
"ansi-styles": "^4.1.0", "ansi-styles": "^4.1.0",
"supports-color": "^7.1.0" "supports-color": "^7.1.0"

@ -35,7 +35,9 @@
"url": "https://patreon.com/tycrek" "url": "https://patreon.com/tycrek"
}, },
"dependencies": { "dependencies": {
"@tycrek/ass-storage-engine": "0.2.6", "@tycrek/ass-storage-engine": "0.2.7",
"@tycrek/express-nofavicon": "^1.0.2",
"@tycrek/isprod": "^2.0.2",
"@tycrek/log": ">=0.5.x", "@tycrek/log": ">=0.5.x",
"any-shell-escape": "^0.1.1", "any-shell-escape": "^0.1.1",
"aws-sdk": "^2.930.0", "aws-sdk": "^2.930.0",
@ -51,7 +53,7 @@
"jimp": "^0.16.1", "jimp": "^0.16.1",
"luxon": "^1.26.0", "luxon": "^1.26.0",
"marked": "^2.0.7", "marked": "^2.0.7",
"multer": "^2.0.0-rc.2", "multer": "2.0.0-rc.2",
"node-fetch": "^2.6.1", "node-fetch": "^2.6.1",
"node-vibrant": "*", "node-vibrant": "*",
"prompt": "^1.1.0", "prompt": "^1.1.0",

@ -2,7 +2,7 @@ const ffmpeg = require('ffmpeg-static');
const Jimp = require('jimp'); const Jimp = require('jimp');
const shell = require('any-shell-escape'); const shell = require('any-shell-escape');
const { exec } = require('child_process'); const { exec } = require('child_process');
const { path } = require('./utils'); const { isProd, path } = require('./utils');
const { diskFilePath } = require('./config.json'); const { diskFilePath } = require('./config.json');
// Thumbnail parameters // Thumbnail parameters
@ -21,7 +21,7 @@ const THUMBNAIL = {
function getCommand(src, dest) { function getCommand(src, dest) {
return shell([ return shell([
ffmpeg, '-y', ffmpeg, '-y',
'-v', (process.env.NODE_ENV === 'production' ? 'error' : 'debug'), // Log level '-v', (isProd ? 'error' : 'debug'), // Log level
'-i', src, // Input file '-i', src, // Input file
'-ss', '00:00:01.000', // Timestamp of frame to grab '-ss', '00:00:01.000', // Timestamp of frame to grab
'-frames:v', '1', // Number of frames to grab '-frames:v', '1', // Number of frames to grab

@ -104,6 +104,7 @@ GENERATORS.set(idModes.r, randomGen);
GENERATORS.set(idModes.gfy, gfyGen); GENERATORS.set(idModes.gfy, gfyGen);
module.exports = { module.exports = {
isProd: require('@tycrek/isprod')(),
path, path,
getTrueHttp, getTrueHttp,
getTrueDomain, getTrueDomain,

Loading…
Cancel
Save