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,10 +6,7 @@
|
|||
"plugin:optimize-regex/recommended",
|
||||
"plugin:sonarjs/recommended"
|
||||
],
|
||||
"plugins": [
|
||||
"eslint-plugin-optimize-regex",
|
||||
"sonarjs"
|
||||
],
|
||||
"plugins": ["eslint-plugin-optimize-regex", "sonarjs"],
|
||||
"rules": {
|
||||
"sonarjs/cognitive-complexity": ["warn", 20]
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ const populateTweetProperties = async (
|
|||
text: unescapeText(linkFixer(tweet, translateAPI?.translation || '')),
|
||||
source_lang: translateAPI?.sourceLanguage || '',
|
||||
target_lang: translateAPI?.destinationLanguage || '',
|
||||
source_lang_en: translateAPI?.localizedSourceLanguage || '',
|
||||
source_lang_en: translateAPI?.localizedSourceLanguage || ''
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,9 @@ const statusRequest = async (
|
|||
const userAgent = request.headers.get('User-Agent') || '';
|
||||
|
||||
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 (
|
||||
url.pathname.match(/\/status(es)?\/\d+\.(mp4|png|jpg)/g) !== null ||
|
||||
|
@ -234,10 +236,11 @@ const sentryWrapper = async (event: FetchEvent): Promise<void> => {
|
|||
});
|
||||
}
|
||||
|
||||
event.respondWith((async (): Promise<Response> => {
|
||||
event.respondWith(
|
||||
(async (): Promise<Response> => {
|
||||
try {
|
||||
return await cacheWrapper(event)
|
||||
} catch(err: unknown) {
|
||||
return await cacheWrapper(event);
|
||||
} catch (err: unknown) {
|
||||
sentry && sentry.captureException(err);
|
||||
|
||||
return new Response(Strings.ERROR_HTML, {
|
||||
|
@ -249,8 +252,9 @@ const sentryWrapper = async (event: FetchEvent): Promise<void> => {
|
|||
status: 500
|
||||
});
|
||||
}
|
||||
})())
|
||||
}
|
||||
})()
|
||||
);
|
||||
};
|
||||
|
||||
/*
|
||||
Event to receive web requests on Cloudflare Worker
|
||||
|
|
|
@ -13,4 +13,4 @@ export const unescapeText = (text: string) => {
|
|||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/&/g, '&');
|
||||
}
|
||||
};
|
||||
|
|
|
@ -11,7 +11,9 @@ const gitBranch = require('child_process')
|
|||
.toString()
|
||||
.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();
|
||||
|
||||
|
@ -43,7 +45,7 @@ let plugins = [
|
|||
new webpack.DefinePlugin({
|
||||
RELEASE_NAME: `'${releaseName}'`
|
||||
})
|
||||
]
|
||||
];
|
||||
|
||||
if (process.env.SENTRY_AUTH_TOKEN) {
|
||||
plugins.push(
|
||||
|
@ -52,9 +54,9 @@ if (process.env.SENTRY_AUTH_TOKEN) {
|
|||
include: './dist',
|
||||
urlPrefix: '~/',
|
||||
ignore: ['node_modules', 'webpack.config.js'],
|
||||
authToken: process.env.SENTRY_AUTH_TOKEN,
|
||||
authToken: process.env.SENTRY_AUTH_TOKEN
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
|
Loading…
Add table
Reference in a new issue