Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5f121e6894 | |||
| 3f0cde7ced | |||
| f767a9483b | |||
| b9a95f1c61 | |||
| bea25616a0 | |||
| ace2c3c180 | |||
| 3019f9132f | |||
| a04ffade6f | |||
| a243892fd4 | |||
| 1db899b5c8 | |||
| fc71bc08db | |||
|
|
c560100a8b |
@@ -6,7 +6,7 @@ FROM baseimg AS build-env
|
||||
|
||||
WORKDIR /usr/notifier
|
||||
|
||||
RUN pacman -Sy --noconfirm nodejs npm typescript
|
||||
RUN pacman -Sy --noconfirm nodejs-lts-jod npm typescript python
|
||||
|
||||
COPY package*.json ./
|
||||
|
||||
@@ -16,7 +16,7 @@ COPY . .
|
||||
|
||||
RUN tsc && \
|
||||
npm run-script build && \
|
||||
npm ci --only=production
|
||||
npm ci --omit=dev
|
||||
|
||||
|
||||
FROM baseimg AS deploy
|
||||
@@ -28,7 +28,7 @@ HEALTHCHECK --timeout=15m \
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
RUN pacman -Sy --noconfirm curl artools-pkg artix-checkupdates git nodejs npm openssh icu glibc openssl openssl-1.1 &&\
|
||||
RUN pacman -Sy --noconfirm curl artools-pkg artix-checkupdates git nodejs-lts-jod npm openssh icu glibc openssl openssl-1.1 &&\
|
||||
mkdir -p /root/.config/artools/ /root/.cache/ && \
|
||||
useradd -m artix
|
||||
|
||||
|
||||
2345
package-lock.json
generated
2345
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
31
package.json
31
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artix-checkupdates-web",
|
||||
"version": "4.1.1",
|
||||
"version": "4.1.7",
|
||||
"description": "Determine packages that need attention",
|
||||
"main": "./distribution/index.js",
|
||||
"type": "module",
|
||||
@@ -30,27 +30,26 @@
|
||||
},
|
||||
"homepage": "https://github.com/CorySanin/artix-checkupdates-web#readme",
|
||||
"dependencies": {
|
||||
"artix-checkupdates": "1.0.2",
|
||||
"better-sqlite3": "11.9.1",
|
||||
"dayjs": "1.11.13",
|
||||
"artix-checkupdates": "1.1.0",
|
||||
"better-sqlite3": "12.4.5",
|
||||
"dayjs": "1.11.19",
|
||||
"ejs": "3.1.10",
|
||||
"express": "4.21.2",
|
||||
"express-useragent": "1.0.15",
|
||||
"express": "5.1.0",
|
||||
"express-useragent": "2.0.2",
|
||||
"irc-framework": "4.14.0",
|
||||
"json5": "2.2.3",
|
||||
"ky": "1.7.5",
|
||||
"node-cron": "3.0.3",
|
||||
"ky": "1.14.0",
|
||||
"node-cron": "4.2.1",
|
||||
"prom-client": "15.1.3",
|
||||
"sharp": "0.33.5"
|
||||
"sharp": "0.34.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sindresorhus/tsconfig": "7.0.0",
|
||||
"@types/better-sqlite3": "^7.6.12",
|
||||
"@types/express": "^5.0.0",
|
||||
"@sindresorhus/tsconfig": "8.1.0",
|
||||
"@types/better-sqlite3": "7.6.13",
|
||||
"@types/express": "5.0.5",
|
||||
"@types/express-useragent": "1.0.5",
|
||||
"@types/node": "22.10.7",
|
||||
"@types/node-cron": "3.0.11",
|
||||
"forking-build-shit": "0.0.2",
|
||||
"typescript": "5.7.3"
|
||||
"@types/node": "^24.10.1",
|
||||
"forking-build-shit":"1.0.5",
|
||||
"typescript": "5.9.3"
|
||||
}
|
||||
}
|
||||
|
||||
14
src/web.mts
14
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;
|
||||
}
|
||||
@@ -224,7 +223,8 @@ class Web {
|
||||
},
|
||||
maintainer,
|
||||
packagesOwned,
|
||||
packages
|
||||
packages,
|
||||
userbar: `${req.protocol}://${req.host}/userbar/${maintainer}.png`
|
||||
},
|
||||
function (err, html) {
|
||||
if (!err) {
|
||||
|
||||
@@ -52,12 +52,20 @@ p {
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: #53bffc;
|
||||
|
||||
&:focus,
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
a:hover,
|
||||
a:focus {
|
||||
color: #92D7FC;
|
||||
text-decoration: underline;
|
||||
a,
|
||||
details.userbar summary {
|
||||
|
||||
&:focus,
|
||||
&:hover {
|
||||
color: #92D7FC;
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
@@ -152,6 +160,10 @@ table tr td:last-child {
|
||||
min-width: 6em;
|
||||
}
|
||||
|
||||
details summary::marker {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: .5em .75em;
|
||||
width: 80%;
|
||||
@@ -164,6 +176,34 @@ table tr td:last-child {
|
||||
}
|
||||
}
|
||||
|
||||
.userbar {
|
||||
margin-top: 1em;
|
||||
|
||||
summary {
|
||||
cursor: pointer;
|
||||
display: list-item;
|
||||
|
||||
&>h5 {
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
|
||||
textarea {
|
||||
margin-top: .5em;
|
||||
background-color: #1a1a1a;
|
||||
color: inherit;
|
||||
max-width: 100%;
|
||||
width: 400px;
|
||||
min-height: 70px;
|
||||
border: 1px solid #858585;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width:910px) {
|
||||
.container {
|
||||
width: initial;
|
||||
|
||||
@@ -9,6 +9,6 @@
|
||||
<meta name="apple-mobile-web-app-title" content="Artix Checkupdates">
|
||||
<meta name="application-name" content="Artix Checkupdates">
|
||||
<meta name="theme-color" content="#212121">
|
||||
<link rel="stylesheet" href="/assets/css/styles.css?v=3">
|
||||
<link rel="stylesheet" href="/assets/css/styles.css?v=4">
|
||||
<link rel="shortcut icon" href="/assets/svg/artix_logo.svg">
|
||||
</head>
|
||||
@@ -29,6 +29,8 @@
|
||||
</tr>
|
||||
<% }); %>
|
||||
</table>
|
||||
|
||||
<%- include("userbar", {url: userbar}) %>
|
||||
</div>
|
||||
<%- include("footer", locals) %>
|
||||
</body>
|
||||
6
views/userbar.ejs
Normal file
6
views/userbar.ejs
Normal file
@@ -0,0 +1,6 @@
|
||||
<details class="userbar">
|
||||
<summary><h5>Dynamic Userbar BBCode</h5></summary>
|
||||
<textarea readonly>[img width=350 height=61]<%= url %>[/img]</textarea>
|
||||
<h6>Preview</h6>
|
||||
<img height="61" width="350" src="<%= url %>" alt="Artix maintainer userbar preview" />
|
||||
</details>
|
||||
Reference in New Issue
Block a user