Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f767a9483b | |||
| b9a95f1c61 | |||
| bea25616a0 |
747
package-lock.json
generated
747
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
26
package.json
26
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artix-checkupdates-web",
|
||||
"version": "4.1.4",
|
||||
"version": "4.1.6",
|
||||
"description": "Determine packages that need attention",
|
||||
"main": "./distribution/index.js",
|
||||
"type": "module",
|
||||
@@ -30,26 +30,26 @@
|
||||
},
|
||||
"homepage": "https://github.com/CorySanin/artix-checkupdates-web#readme",
|
||||
"dependencies": {
|
||||
"artix-checkupdates": "1.0.2",
|
||||
"better-sqlite3": "12.2.0",
|
||||
"dayjs": "1.11.13",
|
||||
"artix-checkupdates": "1.1.0",
|
||||
"better-sqlite3": "12.4.1",
|
||||
"dayjs": "1.11.19",
|
||||
"ejs": "3.1.10",
|
||||
"express": "5.1.0",
|
||||
"express-useragent": "1.0.15",
|
||||
"express-useragent": "2.0.1",
|
||||
"irc-framework": "4.14.0",
|
||||
"json5": "2.2.3",
|
||||
"ky": "1.8.2",
|
||||
"ky": "1.14.0",
|
||||
"node-cron": "4.2.1",
|
||||
"prom-client": "15.1.3",
|
||||
"sharp": "0.34.3"
|
||||
"sharp": "0.34.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sindresorhus/tsconfig": "8.0.1",
|
||||
"@types/better-sqlite3": "^7.6.13",
|
||||
"@types/express": "^5.0.3",
|
||||
"@sindresorhus/tsconfig": "8.1.0",
|
||||
"@types/better-sqlite3": "7.6.13",
|
||||
"@types/express": "5.0.5",
|
||||
"@types/express-useragent": "1.0.5",
|
||||
"@types/node": "^24.3.0",
|
||||
"forking-build-shit": "1.0.1",
|
||||
"typescript": "5.9.2"
|
||||
"@types/node": "^24.10.0",
|
||||
"forking-build-shit":"1.0.5",
|
||||
"typescript": "5.9.3"
|
||||
}
|
||||
}
|
||||
|
||||
11
src/web.mts
11
src/web.mts
@@ -2,13 +2,12 @@ import fs from 'fs';
|
||||
import * as fsp from 'node:fs/promises';
|
||||
import { DB } from './db.mjs';
|
||||
import express from 'express';
|
||||
import exuseragent from 'express-useragent';
|
||||
import * as useragent from 'express-useragent';
|
||||
import prom from 'prom-client';
|
||||
import sharp from 'sharp';
|
||||
import * as path from 'path';
|
||||
import type http from "http";
|
||||
import type { Request, Response } from "express";
|
||||
import type { Details } from "express-useragent";
|
||||
import type { Config } from './config.js';
|
||||
import type { PackageDBEntry } from './db.mjs';
|
||||
import type { SaveData } from './daemon.mjs';
|
||||
@@ -132,11 +131,11 @@ class Web {
|
||||
app.set('view engine', 'ejs');
|
||||
app.set('view options', VIEWOPTIONS);
|
||||
|
||||
app.use(exuseragent.express());
|
||||
app.use(useragent.express());
|
||||
|
||||
function sendError(req: Request, res: Response, status: number, description: string) {
|
||||
console.log(`${status} (${description}): ${req.url} requested by ${req.ip} "${req.headers['user-agent']}"`);
|
||||
if ((req.useragent as Details).browser === 'curl') {
|
||||
if (req.useragent?.browser === 'curl') {
|
||||
res.send('404: not found\n');
|
||||
return;
|
||||
}
|
||||
@@ -179,7 +178,7 @@ class Web {
|
||||
app.get('/', async (req, res) => {
|
||||
let packages = prepPackages(saveData.move, 'Move');
|
||||
packages = packages.concat(prepPackages(saveData.update, 'Update'));
|
||||
if ((req.useragent as Details).browser === 'curl') {
|
||||
if (req.useragent?.browser === 'curl') {
|
||||
res.send(renderForCurl(packages));
|
||||
return;
|
||||
}
|
||||
@@ -211,7 +210,7 @@ class Web {
|
||||
let packages = prepPackages(db.getPackagesByMaintainer(maintainer, 'move'), 'Move');
|
||||
packages = packages.concat(prepPackages(db.getPackagesByMaintainer(maintainer, 'udate'), 'Update'));
|
||||
if (packagesOwned > 0) {
|
||||
if ((req.useragent as Details).browser === 'curl') {
|
||||
if (req.useragent?.browser === 'curl') {
|
||||
res.send(`${maintainer}'s pending actions\n\n${renderForCurl(packages)}`);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user