Allow custom release URL.

This commit is contained in:
Mike Cao 2022-07-15 23:53:31 -07:00
parent 64f1841ae4
commit e4c4019e25
7 changed files with 27 additions and 21 deletions

View file

@ -7,7 +7,8 @@ export const DASHBOARD_CONFIG = 'umami.dashboard';
export const VERSION_CHECK = 'umami.version-check';
export const SHARE_TOKEN_HEADER = 'x-umami-share-token';
export const HOMEPAGE_URL = 'https://umami.is';
export const VERSION_URL = 'https://github.com/mikecao/umami/releases';
export const REPO_URL = 'https://github.com/umami-software/umami';
export const UPDATES_URL = 'https://api.umami.is/v1/updates';
export const DEFAULT_LOCALE = 'en-US';
export const DEFAULT_THEME = 'light';

View file

@ -2,7 +2,7 @@ import { PrismaClient } from '@prisma/client';
import chalk from 'chalk';
BigInt.prototype.toJSON = function () {
return this.toString();
return Number(this);
};
const options = {
@ -18,20 +18,20 @@ function logQuery(e) {
console.log(chalk.yellow(e.params), '->', e.query, chalk.greenBright(`${e.duration}ms`));
}
let prisma;
function getClient(options) {
const prisma = new PrismaClient(options);
if (process.env.NODE_ENV === 'production') {
prisma = new PrismaClient(options);
} else {
if (!global.prisma) {
global.prisma = new PrismaClient(options);
if (process.env.LOG_QUERY) {
prisma.$on('query', logQuery);
}
prisma = global.prisma;
return prisma;
}
if (process.env.LOG_QUERY) {
prisma.$on('query', logQuery);
const prisma = global.prisma || getClient(options);
if (process.env.NODE_ENV !== 'production') {
global.prisma = prisma;
}
export default prisma;