mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-24 05:05:20 -04:00
Merge branch 'fixes' into 'main'
Inform Sentry about deployments & two little fixes See merge request PronounsPage/PronounsPage!431
This commit is contained in:
commit
52b7d2114e
1
Makefile
1
Makefile
@ -37,6 +37,7 @@ deploy: install
|
||||
yarn ts-node server/migrate.ts
|
||||
ln -sfn ../data/img ./static/img-local
|
||||
ln -sfn ../data/docs ./static/docs-local
|
||||
yarn ts-node server/sentry.ts
|
||||
|
||||
switch:
|
||||
rm -rf cache
|
||||
|
@ -226,6 +226,7 @@ const nuxtConfig: NuxtConfig = {
|
||||
telemetry: false,
|
||||
},
|
||||
config: {
|
||||
environment: process.env.NODE_ENV === 'production' ? config.locale : process.env.NODE_ENV!,
|
||||
attachStacktrace: true,
|
||||
initialScope(scope) {
|
||||
scope.setTag('locale', process.env.LOCALE);
|
||||
|
@ -40,7 +40,7 @@ router.get('/banner/:pronounName*.png', handleErrorAsync(async (req, res) => {
|
||||
const imageSize = 200;
|
||||
let leftRatio = 4;
|
||||
|
||||
const pronounName = req.params.pronounName + req.params[0];
|
||||
const pronounName = (req.params.pronounName + req.params[0]).replace(/(&)+$/, '');
|
||||
|
||||
const result = await new CacheObject('banner', `${pronounName}.png`, 24 * 60).fetch(async () => {
|
||||
const fontName = registerLocaleFont('fontHeadings', ['regular', 'bold']);
|
||||
|
@ -105,6 +105,10 @@ const eventsSummary = (day, locale) => {
|
||||
};
|
||||
};
|
||||
|
||||
const generateURIEncodedPathAlternative = (path) => {
|
||||
return [path, path.replace('@', encodeURIComponent('@'))];
|
||||
};
|
||||
|
||||
const router = Router();
|
||||
|
||||
router.get('/calendar/today', handleErrorAsync(async (req, res) => {
|
||||
@ -132,7 +136,7 @@ router.get(`${routeBase}.ics`, handleErrorAsync(async (req, res) => {
|
||||
renderEvents(events, res, req.query.only_first_days !== undefined);
|
||||
}));
|
||||
|
||||
router.get(`${routeBase}-@:username.ics`, handleErrorAsync(async (req, res) => {
|
||||
router.get(generateURIEncodedPathAlternative(`${routeBase}-@:username.ics`), handleErrorAsync(async (req, res) => {
|
||||
const profiles = await req.db.all(SQL`
|
||||
SELECT events, customEvents FROM profiles p
|
||||
LEFT JOIN users u ON p.userId = u.id
|
||||
|
34
server/sentry.ts
Normal file
34
server/sentry.ts
Normal file
@ -0,0 +1,34 @@
|
||||
import fs from 'fs';
|
||||
|
||||
import SentryCli from '@sentry/cli';
|
||||
|
||||
import './setup.ts';
|
||||
import { loadSuml } from './loader.ts';
|
||||
import allLocales from '../locale/locales.ts';
|
||||
import type { Config } from '../locale/config.ts';
|
||||
|
||||
const __dirname = new URL('.', import.meta.url).pathname;
|
||||
|
||||
async function notifyDeployment(): Promise<void> {
|
||||
if (!process.env.SENTRY_DSN) {
|
||||
process.stdout.write('SENTRY_DSN is not defined, skipping deployment information to Sentry');
|
||||
return;
|
||||
}
|
||||
|
||||
const version = fs.readFileSync(`${__dirname}/../cache/version`, 'utf-8');
|
||||
const config = loadSuml('config') as Config;
|
||||
|
||||
const sentryCli = new SentryCli();
|
||||
await sentryCli.releases.setCommits(version, {
|
||||
auto: true,
|
||||
});
|
||||
await sentryCli.releases.finalize(version);
|
||||
const environment = process.env.NODE_ENV === 'production' ? config.locale : process.env.NODE_ENV!;
|
||||
await sentryCli.releases.newDeploy(version, {
|
||||
env: environment,
|
||||
url: allLocales.find((locale) => locale.code === config.locale)?.url,
|
||||
});
|
||||
process.stdout.write(`Sent deployment information for environment ${environment} to Sentry`);
|
||||
}
|
||||
|
||||
await notifyDeployment();
|
@ -331,7 +331,7 @@ export class Calendar {
|
||||
|
||||
getYear(year) {
|
||||
year = parseInt(year);
|
||||
if (year < this._minYear || year > this._maxYear) {
|
||||
if (year < this._minYear || year > this._maxYear || Number.isNaN(year)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user