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**
- Local file system
- Amazon S3 (including [DigitalOcean Spaces])
- **Multiple data storage methods** using [ass StorageEngines] (JSON by default)
- **Multiple data storage methods** using [ass StorageEngines]
- **File**
- JSON (default, [ass-storage-engine])
- YAML (soon!)
- **Database**
- PostgreSQL ([ass-psql])
- Mongo (soon!)
- MongoDB ([ass-mongoose][GH AMongoose])
- MySQL (soon!)
[Git Submodules]: https://git-scm.com/book/en/v2/Git-Tools-Submodules
@ -340,9 +340,21 @@ module.exports = {
**Supported StorageEngines:**
| 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) |
| **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) |
| :--: | ----------- | :---: |
| **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] 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.

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

106
package-lock.json generated

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

@ -35,7 +35,9 @@
"url": "https://patreon.com/tycrek"
},
"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",
"any-shell-escape": "^0.1.1",
"aws-sdk": "^2.930.0",
@ -51,7 +53,7 @@
"jimp": "^0.16.1",
"luxon": "^1.26.0",
"marked": "^2.0.7",
"multer": "^2.0.0-rc.2",
"multer": "2.0.0-rc.2",
"node-fetch": "^2.6.1",
"node-vibrant": "*",
"prompt": "^1.1.0",

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

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

Loading…
Cancel
Save