mirror of
https://github.com/CompeyDev/fxtwitter-docker.git
synced 2025-04-10 21:10:54 +01:00
Run prettier
This commit is contained in:
parent
bc4e08125b
commit
790bcdbd78
7 changed files with 39 additions and 36 deletions
|
@ -6,11 +6,8 @@
|
||||||
"plugin:optimize-regex/recommended",
|
"plugin:optimize-regex/recommended",
|
||||||
"plugin:sonarjs/recommended"
|
"plugin:sonarjs/recommended"
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": ["eslint-plugin-optimize-regex", "sonarjs"],
|
||||||
"eslint-plugin-optimize-regex",
|
|
||||||
"sonarjs"
|
|
||||||
],
|
|
||||||
"rules": {
|
"rules": {
|
||||||
"sonarjs/cognitive-complexity": ["warn", 20]
|
"sonarjs/cognitive-complexity": ["warn", 20]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ In many ways, FixTweet has richer embeds and does more. Here's a table comparing
|
||||||
|
|
||||||
⁴ On GitHub, BetterTwitFix (vxTwitter) claims to support this feature, however in my testing as of mid-July 2022, this does not seem to work.
|
⁴ On GitHub, BetterTwitFix (vxTwitter) claims to support this feature, however in my testing as of mid-July 2022, this does not seem to work.
|
||||||
|
|
||||||
⁵ We've temporarily paused multi-image on Telegram due to issues with its embedding service that can cause images to sometimes not show up at all. ([#15](https://github.com/dangeredwolf/FixTweet/issues/15)) However, multi-image continues to work in Discord and most other platforms.
|
⁵ We've temporarily paused multi-image on Telegram due to issues with its embedding service that can cause images to sometimes not show up at all. ([#15](https://github.com/dangeredwolf/FixTweet/issues/15)) However, multi-image continues to work in Discord and most other platforms.
|
||||||
|
|
||||||
⁶ External media requiring web containers, such as YouTube, won't embed in Telegram because Telegram doesn't support it. Plain media will work in Telegram, and it works either way inside Discord.
|
⁶ External media requiring web containers, such as YouTube, won't embed in Telegram because Telegram doesn't support it. Plain media will work in Telegram, and it works either way inside Discord.
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ const populateTweetProperties = async (
|
||||||
text: unescapeText(linkFixer(tweet, translateAPI?.translation || '')),
|
text: unescapeText(linkFixer(tweet, translateAPI?.translation || '')),
|
||||||
source_lang: translateAPI?.sourceLanguage || '',
|
source_lang: translateAPI?.sourceLanguage || '',
|
||||||
target_lang: translateAPI?.destinationLanguage || '',
|
target_lang: translateAPI?.destinationLanguage || '',
|
||||||
source_lang_en: translateAPI?.localizedSourceLanguage || '',
|
source_lang_en: translateAPI?.localizedSourceLanguage || ''
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
src/env.d.ts
vendored
2
src/env.d.ts
vendored
|
@ -7,4 +7,4 @@ declare const MOSAIC_DOMAIN_LIST: string;
|
||||||
declare const API_HOST: string;
|
declare const API_HOST: string;
|
||||||
|
|
||||||
declare const SENTRY_DSN: string;
|
declare const SENTRY_DSN: string;
|
||||||
declare const RELEASE_NAME: string;
|
declare const RELEASE_NAME: string;
|
||||||
|
|
|
@ -17,7 +17,9 @@ const statusRequest = async (
|
||||||
const userAgent = request.headers.get('User-Agent') || '';
|
const userAgent = request.headers.get('User-Agent') || '';
|
||||||
|
|
||||||
const isBotUA =
|
const isBotUA =
|
||||||
userAgent.match(/bot|facebook|embed|got|firefox\/92|curl|wget|go-http|yahoo|generator|whatsapp|preview|link|proxy|vkshare|images|analyzer|index|crawl|spider/gi) !== null;
|
userAgent.match(
|
||||||
|
/bot|facebook|embed|got|firefox\/92|curl|wget|go-http|yahoo|generator|whatsapp|preview|link|proxy|vkshare|images|analyzer|index|crawl|spider/gi
|
||||||
|
) !== null;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
url.pathname.match(/\/status(es)?\/\d+\.(mp4|png|jpg)/g) !== null ||
|
url.pathname.match(/\/status(es)?\/\d+\.(mp4|png|jpg)/g) !== null ||
|
||||||
|
@ -234,23 +236,25 @@ const sentryWrapper = async (event: FetchEvent): Promise<void> => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
event.respondWith((async (): Promise<Response> => {
|
event.respondWith(
|
||||||
try {
|
(async (): Promise<Response> => {
|
||||||
return await cacheWrapper(event)
|
try {
|
||||||
} catch(err: unknown) {
|
return await cacheWrapper(event);
|
||||||
sentry && sentry.captureException(err);
|
} catch (err: unknown) {
|
||||||
|
sentry && sentry.captureException(err);
|
||||||
|
|
||||||
return new Response(Strings.ERROR_HTML, {
|
return new Response(Strings.ERROR_HTML, {
|
||||||
headers: {
|
headers: {
|
||||||
...Constants.RESPONSE_HEADERS,
|
...Constants.RESPONSE_HEADERS,
|
||||||
'content-type': 'text/html',
|
'content-type': 'text/html',
|
||||||
'cache-control': 'max-age=1'
|
'cache-control': 'max-age=1'
|
||||||
},
|
},
|
||||||
status: 500
|
status: 500
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})())
|
})()
|
||||||
}
|
);
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Event to receive web requests on Cloudflare Worker
|
Event to receive web requests on Cloudflare Worker
|
||||||
|
|
|
@ -13,4 +13,4 @@ export const unescapeText = (text: string) => {
|
||||||
.replace(/</g, '<')
|
.replace(/</g, '<')
|
||||||
.replace(/>/g, '>')
|
.replace(/>/g, '>')
|
||||||
.replace(/&/g, '&');
|
.replace(/&/g, '&');
|
||||||
}
|
};
|
||||||
|
|
|
@ -3,15 +3,17 @@ const webpack = require('webpack');
|
||||||
const SentryWebpackPlugin = require('@sentry/webpack-plugin');
|
const SentryWebpackPlugin = require('@sentry/webpack-plugin');
|
||||||
|
|
||||||
const gitCommit = require('child_process')
|
const gitCommit = require('child_process')
|
||||||
.execSync('git rev-parse --short HEAD')
|
.execSync('git rev-parse --short HEAD')
|
||||||
.toString()
|
.toString()
|
||||||
.trim();
|
.trim();
|
||||||
const gitBranch = require('child_process')
|
const gitBranch = require('child_process')
|
||||||
.execSync('git rev-parse --abbrev-ref HEAD')
|
.execSync('git rev-parse --abbrev-ref HEAD')
|
||||||
.toString()
|
.toString()
|
||||||
.trim();
|
.trim();
|
||||||
|
|
||||||
const releaseName = `fixtweet-${gitBranch}-${gitCommit}-${new Date().toISOString().substring(0,19)}`
|
const releaseName = `fixtweet-${gitBranch}-${gitCommit}-${new Date()
|
||||||
|
.toISOString()
|
||||||
|
.substring(0, 19)}`;
|
||||||
|
|
||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
|
|
||||||
|
@ -43,7 +45,7 @@ let plugins = [
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
RELEASE_NAME: `'${releaseName}'`
|
RELEASE_NAME: `'${releaseName}'`
|
||||||
})
|
})
|
||||||
]
|
];
|
||||||
|
|
||||||
if (process.env.SENTRY_AUTH_TOKEN) {
|
if (process.env.SENTRY_AUTH_TOKEN) {
|
||||||
plugins.push(
|
plugins.push(
|
||||||
|
@ -52,9 +54,9 @@ if (process.env.SENTRY_AUTH_TOKEN) {
|
||||||
include: './dist',
|
include: './dist',
|
||||||
urlPrefix: '~/',
|
urlPrefix: '~/',
|
||||||
ignore: ['node_modules', 'webpack.config.js'],
|
ignore: ['node_modules', 'webpack.config.js'],
|
||||||
authToken: process.env.SENTRY_AUTH_TOKEN,
|
authToken: process.env.SENTRY_AUTH_TOKEN
|
||||||
})
|
})
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue