mirror of
https://github.com/diced/zipline.git
synced 2025-04-04 23:21:17 -05:00
fix issues with stats & new config
This commit is contained in:
parent
e718506c2f
commit
e9fe41e7d2
12 changed files with 5 additions and 10 deletions
0
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file → Executable file
0
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file → Executable file
0
.github/workflows/codeql-analysis.yml
vendored
Normal file → Executable file
0
.github/workflows/codeql-analysis.yml
vendored
Normal file → Executable file
0
CODE_OF_CONDUCT.md
Normal file → Executable file
0
CODE_OF_CONDUCT.md
Normal file → Executable file
0
LICENSE
Normal file → Executable file
0
LICENSE
Normal file → Executable file
0
README.md
Normal file → Executable file
0
README.md
Normal file → Executable file
0
public/css/spectre-exp.css
Normal file → Executable file
0
public/css/spectre-exp.css
Normal file → Executable file
0
public/css/spectre-icons.css
Normal file → Executable file
0
public/css/spectre-icons.css
Normal file → Executable file
0
public/css/spectre.css
Normal file → Executable file
0
public/css/spectre.css
Normal file → Executable file
0
scripts/update.sh
Normal file → Executable file
0
scripts/update.sh
Normal file → Executable file
|
@ -272,8 +272,8 @@ export class APIController {
|
|||
@Get('stats')
|
||||
private async getStats(req: Request, res: Response) {
|
||||
const memory = process.memoryUsage();
|
||||
const views: number = (await this.orm.repos.image.find()).map((a) => a.views).reduce((a, b) => Number(a) + Number(b));
|
||||
const clicks: number = (await this.orm.repos.shorten.find()).map((a) => a.clicks).reduce((a, b) => Number(a) + Number(b));
|
||||
const views: number = (await this.orm.repos.image.find()).map((a) => a.views).reduce((a, b) => Number(a) + Number(b), 0);
|
||||
const clicks: number = (await this.orm.repos.shorten.find()).map((a) => a.clicks).reduce((a, b) => Number(a) + Number(b), 0);
|
||||
return res.status(200).json({
|
||||
memory,
|
||||
uploadedStatistics: {
|
||||
|
|
|
@ -26,7 +26,7 @@ if (!findFile('config.json', process.cwd())) {
|
|||
|
||||
const config = JSON.parse(readFileSync(findFile('config.json', process.cwd()), 'utf8'))
|
||||
|
||||
if (!config.upload?.route) {
|
||||
if (!config.uploader?.route) {
|
||||
Logger.get('Zipline.Config').error(`Missing needed property on configuration: upload.route`)
|
||||
process.exit(1);
|
||||
}
|
||||
|
@ -46,12 +46,7 @@ export interface ORMHandler {
|
|||
const pk = JSON.parse(readFileSync(findFile('package.json', process.cwd()), 'utf8'));
|
||||
|
||||
(async () => {
|
||||
const gitPackage = JSON.parse(await GitHub.getFile('package.json'));
|
||||
const comparedVersion = compare(gitPackage.version, pk.version);
|
||||
if (comparedVersion == 1) {
|
||||
Logger.get(`Zipline`).info(`Zipline is ${chalk.bold.redBright('outdated')}, you should run ${chalk.bold.whiteBright('./scripts/update.sh')} to get the best features.`);
|
||||
process.exit(0);
|
||||
}
|
||||
if (compare(JSON.parse(await GitHub.getFile('package.json')).version, pk.version) == 1) Logger.get(`Zipline`).info(`Zipline is ${chalk.bold.redBright('outdated')}, you should run ${chalk.bold.whiteBright('./scripts/update.sh')} to get the best features.`);
|
||||
Logger.get('Zipline').info(`Starting Zipline ${pk.version}`);
|
||||
const connection = await createConnection(config.orm as ConnectionOptions);
|
||||
const orm: ORMHandler = {
|
||||
|
|
2
src/structures/GitHub.ts
Normal file → Executable file
2
src/structures/GitHub.ts
Normal file → Executable file
|
@ -2,7 +2,7 @@ import fetch from 'node-fetch';
|
|||
|
||||
export class GitHub {
|
||||
public static async getFile(filePath: string) {
|
||||
const res = await fetch('https://raw.githubusercontent.com/zipline-project/zipline/master/' + filePath);
|
||||
const res = await fetch('https://raw.githubusercontent.com/ZiplineProject/Zipline/master/' + filePath);
|
||||
return res.text();
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue