Merge branch 'master' into tailwind

pull/101/head
tycrek 3 years ago
commit 36179e8ec0
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

6
.github/README.md vendored

@ -51,7 +51,7 @@ ass was designed with developers in mind. If you are a developer & want somethin
- Download & delete resources
- Fully customizable Discord embeds
- Built-in web viewer with video & audio player
- Embed images, gifs, & images directly in Discord
- Embed images, gifs, & videos directly in Discord
- Personal upload log using customizable Discord Webhooks
- macOS/Linux support with alternative clients such as [Flameshot] ([script for ass]) & [MagicCap]
- **Multiple URL styles**
@ -192,7 +192,7 @@ docker-compose up --force-recreate --build -d && docker image prune -f # && dock
<summary><em>Expand for local installation steps</em></summary>
<br>
1. You should have **Node.js 14.17** & **npm 8 or later** installed.
1. You should have **Node.js 16** & **npm 8 or later** installed.
2. Clone this repo using `git clone https://github.com/tycrek/ass.git && cd ass/`
3. Run `npm i -g typescript` to install TypeScript globally
4. Run `npm i --save-dev` to install the required dependencies (`--save-dev` is **required** for compilation)
@ -403,7 +403,7 @@ ass has a number of pre-made npm scripts for you to use. **All** of these script
| `docker-resetup` | Alias for `docker-compose exec ass npm run setup && docker-compose restart` |
[tlog Socket plugin]: https://github.com/tycrek/tlog#socket
[`FORCE_COLOR`]: https://nodejs.org/dist/latest-v14.x/docs/api/cli.html#cli_force_color_1_2_3
[`FORCE_COLOR`]: https://nodejs.org/dist/latest-v16.x/docs/api/cli.html#cli_force_color_1_2_3
## Flameshot users (Linux)

@ -12,11 +12,11 @@ jobs:
# Checkout repo
- uses: actions/checkout@v2
# Set up Node 14
# Set up Node 16
- name: Setup Node.js environment
uses: actions/setup-node@v2.4.1
with:
node-version: 14.17.5
node-version: 16.14.0
# Install npm 8 & TypeScript
- name: Install global packages

@ -3,8 +3,8 @@
# - tycrek <t@tycrek.com> (https://tycrek.com/)
# - Zusier <zusier@pm.me> (https://github.com/Zusier)
# Node 14 image
FROM node:14.17.5
# Node 16 image
FROM node:16.14.0
# Set working directory
WORKDIR /opt/ass/

@ -5,16 +5,23 @@ KEY="" # Your ass upload token
DOMAIN="" # Your upload domain (without http:// or https://)
flameshot config -f "$IMAGENAME" # Make sure that Flameshot names the file correctly
flameshot gui -r -p "$IMAGEPATH" # Prompt the screenshot GUI
flameshot gui -r -p "$IMAGEPATH" > /dev/null # Prompt the screenshot GUI, also append the random gibberish to /dev/null
# Upload the image and copy the response URL
URL=$(curl -X POST \
FILE="$IMAGEPATH$IMAGENAME.png" # File path and file name combined
# Check if file exists to handle Curl and rm errors
# then upload the image and copy the response URL
if [ -f "$FILE" ]; then
echo "$FILE exists."
URL=$(curl -X POST \
-H "Content-Type: multipart/form-data" \
-H "Accept: application/json" \
-H "User-Agent: ShareX/13.4.0" \
-H "Authorization: $KEY" \
-F "file=@$IMAGEPATH$IMAGENAME.png" "https://$DOMAIN/" | grep -Po '(?<="resource":")[^"]+')
# printf instead of echo as echo appends a newline
printf "%s" "$URL" | xclip -sel clip
rm "$IMAGEPATH$IMAGENAME.png" # Delete the image locally
# printf instead of echo as echo appends a newline
printf "%s" "$URL" | xclip -sel clip
rm "$IMAGEPATH$IMAGENAME.png" # Delete the image locally
else
echo "Aborted."
fi

1385
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -4,8 +4,8 @@
"description": "The superior self-hosted ShareX server",
"main": "ass.js",
"engines": {
"node": ">=14.7.x <16",
"npm": ">=8.1.x"
"node": ">=16.14.x",
"npm": ">=8.3.x"
},
"scripts": {
"dev": "npm run build && npm start",
@ -38,7 +38,7 @@
},
"dependencies": {
"@skynetlabs/skynet-nodejs": "^2.3.0",
"@tsconfig/node14": "^1.0.1",
"@tsconfig/node16": "^1.0.1",
"@tycrek/express-nofavicon": "^1.0.3",
"@tycrek/express-postcss": "^0.1.0",
"@tycrek/isprod": "^2.0.2",
@ -61,7 +61,7 @@
"jimp": "^0.16.1",
"luxon": "^2.0.2",
"marked": "^3.0.7",
"node-fetch": "^2.6.5",
"node-fetch": "^2.6.7",
"node-vibrant": "^3.1.6",
"postcss-font-magician": "^3.0.0",
"prompt": "^1.2.0",

@ -74,10 +74,12 @@ router.get('/direct*', (req: AssRequest, res: AssResponse, next) => data.get(req
sia: () => SkynetDownload(fileData)
.then((stream) => stream.pipe(res))
.then(() => SkynetDelete(fileData)),
local: () => {
local: () => fs.pathExists(path(fileData.path))
.then((exists) => {
if (!exists) throw new Error('File does not exist');
res.header('Accept-Ranges', 'bytes').header('Content-Length', `${fileData.size}`).type(fileData.mimetype);
fs.createReadStream(fileData.path).pipe(res);
}
})
};
return uploaders[fileData.randomId.startsWith('sia://') ? 'sia' : s3enabled ? 's3' : 'local']();

@ -84,6 +84,6 @@ function getImageThumbnail(file: FileData) {
*/
export default (file: FileData): Promise<string> =>
new Promise((resolve, reject) =>
(file.is.video ? getVideoThumbnail : file.is.image ? getImageThumbnail : () => Promise.resolve())(file)
(file.is.video ? getVideoThumbnail : (file.is.image && !file.mimetype.includes('webp')) ? getImageThumbnail : () => Promise.resolve())(file)
.then(() => resolve((file.is.video || file.is.image) ? getNewName(file.randomId) : file.is.audio ? 'views/ass-audio-icon.png' : 'views/ass-file-icon.png'))
.catch(reject));

@ -26,4 +26,4 @@ function getVibrant(file: FileData, resolve: Function, reject: Function) {
* @param {*} file The file to get a colour from
* @returns The Vibrant colour as a Hex value (or random Hex value for videos)
*/
export default (file: FileData): Promise<string> => new Promise((resolve, reject) => !file.is.image ? resolve(randomHexColour()) : getVibrant(file, resolve, reject)); // skipcq: JS-0229
export default (file: FileData): Promise<string> => new Promise((resolve, reject) => (!file.is.image || file.mimetype.includes('webp')) ? resolve(randomHexColour()) : getVibrant(file, resolve, reject)); // skipcq: JS-0229

@ -1,5 +1,5 @@
{
"extends": "@tsconfig/node14/tsconfig.json",
"extends": "@tsconfig/node16/tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"lib": [

Loading…
Cancel
Save