Skip to content

Commit

Permalink
chore: switch to biome for linting and fix errors and ignore some for…
Browse files Browse the repository at this point in the history
… now
  • Loading branch information
escapedcat committed Dec 8, 2024
1 parent e6efd21 commit 2e00128
Show file tree
Hide file tree
Showing 182 changed files with 13,003 additions and 12,208 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ jobs:
run: npm run test
- name: Run Typecheck
run: npm run tsc
- name: Run Eslint
- name: Run Linting and formatting
run: npm run lint
8 changes: 0 additions & 8 deletions .prettierignore

This file was deleted.

6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

3 changes: 1 addition & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"recommendations": [
"ecmel.vscode-html-css",
"bradlc.vscode-tailwindcss",
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint"
"biomejs.biome"
]
}
82 changes: 41 additions & 41 deletions backend-mock/apps.js
Original file line number Diff line number Diff line change
@@ -1,75 +1,75 @@
const express = require("express");
const express = require('express');
const router = express.Router();
const util = require("./sse/util");
const util = require('./sse/util');

router.post("/install/:id", (req, res) => {
console.info("call to /api/apps/install for app", req.params.id);
router.post('/install/:id', (req, res) => {
console.info('call to /api/apps/install for app', req.params.id);
// send information that btc-pay is currently installing
util.sendSSE("install", {
id: "rtl",
mode: "on",
result: "running",
details: "",
util.sendSSE('install', {
id: 'rtl',
mode: 'on',
result: 'running',
details: '',
});
setTimeout(() => {
installApp();
}, 5000);
res.status(200).send();
});

router.post("/uninstall/:id", (req, res) => {
console.info("call to /api/apps/uninstall for app", req.params.id);
router.post('/uninstall/:id', (req, res) => {
console.info('call to /api/apps/uninstall for app', req.params.id);
// TODO: Create the same example as install but with uninstall
res.status(200).send();
});

router.get("/status_advanced/electrs", (req, res) => {
console.info("call to /api/apps/status_advanced/electrs");
router.get('/status_advanced/electrs', (req, res) => {
console.info('call to /api/apps/status_advanced/electrs');
res.status(200).send(
JSON.stringify({
version: "v0.10.2",
localIP: "192.168.0.1",
publicIP: "127.0.0.1",
portTCP: "50001",
portSSL: "50002",
version: 'v0.10.2',
localIP: '192.168.0.1',
publicIP: '127.0.0.1',
portTCP: '50001',
portSSL: '50002',
// not a real onion address
TORaddress:
"gr7l4dtesftz3t48p2nhbpzwhs5fm2t4fgnavh9v0tdvp80z2jzg5xw1@rzqwnilfge21ma7gr9v40zf7btz4u8rmz7353ua4vtl77yb328vqfl6369az0nv8.onion",
'gr7l4dtesftz3t48p2nhbpzwhs5fm2t4fgnavh9v0tdvp80z2jzg5xw1@rzqwnilfge21ma7gr9v40zf7btz4u8rmz7353ua4vtl77yb328vqfl6369az0nv8.onion',
initialSyncDone: true,
}),
);
});

const installApp = () => {
console.info("call to installApp");
console.info('call to installApp');

// inform Frontend that app finished installing
util.sendSSE("install", {
id: "rtl",
mode: "on",
result: "win",
httpsForced: "0",
httpsSelfsigned: "1",
details: "OK",
util.sendSSE('install', {
id: 'rtl',
mode: 'on',
result: 'win',
httpsForced: '0',
httpsSelfsigned: '1',
details: 'OK',
});

util.sendSSE("installed_app_status", [
{ id: "lnbits", installed: false, status: "offline", error: "" },
{ id: "thunderhub", installed: false, status: "offline", error: "" },
{ id: "btcpayserver", installed: false, status: "offline", error: "" },
{ id: "mempool", installed: false, status: "offline", error: "" },
{ id: "btc-rpc-explorer", installed: false, status: "offline", error: "" },
util.sendSSE('installed_app_status', [
{ id: 'lnbits', installed: false, status: 'offline', error: '' },
{ id: 'thunderhub', installed: false, status: 'offline', error: '' },
{ id: 'btcpayserver', installed: false, status: 'offline', error: '' },
{ id: 'mempool', installed: false, status: 'offline', error: '' },
{ id: 'btc-rpc-explorer', installed: false, status: 'offline', error: '' },
{
id: "rtl",
id: 'rtl',
installed: true,
status: "online",
address: "http://192.168.1.100:3000",
httpsForced: "0",
httpsSelfsigned: "1",
hiddenService: "4pt2ludsdsdns48dwnd2899rqf63pcdwdwdwh7dwaeukn1w.onion",
authMethod: "password_b",
status: 'online',
address: 'http://192.168.1.100:3000',
httpsForced: '0',
httpsSelfsigned: '1',
hiddenService: '4pt2ludsdsdns48dwnd2899rqf63pcdwdwdwh7dwaeukn1w.onion',
authMethod: 'password_b',
details: {},
error: "",
error: '',
},
]);
};
Expand Down
10 changes: 5 additions & 5 deletions backend-mock/auth.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const jwt = require("jsonwebtoken");
require("dotenv").config();
const jwt = require('jsonwebtoken');
require('dotenv').config();

const signToken = () => {
console.info("call to signToken");
console.info('call to signToken');
return jwt.sign(
{ user_id: "admin", expires: Date.now() + 630_000 },
process.env.JWT_SECRET || "secret",
{ user_id: 'admin', expires: Date.now() + 630_000 },
process.env.JWT_SECRET || 'secret',
);
};

Expand Down
56 changes: 28 additions & 28 deletions backend-mock/index.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
const express = require("express");
const cors = require("cors");
const btcInfo = require("./sse/btc_info");
const lnInfo = require("./sse/ln_info");
const installedAppStatus = require("./sse/installed_app_status");
const systemInfo = require("./sse/system_info");
const hardwareInfo = require("./sse/hardware_info");
const walletBalance = require("./sse/wallet_balance");
const systemStartupInfo = require("./sse/system_startup_info");
const util = require("./sse/util");
const setup = require("./setup");
const system = require("./system");
const apps = require("./apps");
const lightning = require("./lightning");
const express = require('express');
const cors = require('cors');
const btcInfo = require('./sse/btc_info');
const lnInfo = require('./sse/ln_info');
const installedAppStatus = require('./sse/installed_app_status');
const systemInfo = require('./sse/system_info');
const hardwareInfo = require('./sse/hardware_info');
const walletBalance = require('./sse/wallet_balance');
const systemStartupInfo = require('./sse/system_startup_info');
const util = require('./sse/util');
const setup = require('./setup');
const system = require('./system');
const apps = require('./apps');
const lightning = require('./lightning');

require("dotenv").config();
require('dotenv').config();

const app = express();
app.use(
cors({ credentials: true, origin: "http://localhost:3000" }),
cors({ credentials: true, origin: 'http://localhost:3000' }),
express.json(),
);
app.get("/index.html", (req, res) => {
app.get('/index.html', (req, res) => {
// only to satisfy playwright webserver check
res.send("ok");
res.send('ok');
});
app.use("/api/system", system);
app.use("/api/setup", setup);
app.use("/api/apps", apps);
app.use("/api/lightning", lightning);
app.use('/api/system', system);
app.use('/api/setup', setup);
app.use('/api/apps', apps);
app.use('/api/lightning', lightning);

const PORT = 8000;

Expand All @@ -41,11 +41,11 @@ app.listen(PORT, () => {
* Main SSE Handler
*/
const eventsHandler = (request, response) => {
console.info("call to /api/sse/subscribe");
console.info('call to /api/sse/subscribe');
const headers = {
"Content-Type": "text/event-stream",
Connection: "keep-alive",
"Cache-Control": "no-cache",
'Content-Type': 'text/event-stream',
'Connection': 'keep-alive',
'Cache-Control': 'no-cache',
};
response.writeHead(200, headers);

Expand All @@ -68,12 +68,12 @@ const eventsHandler = (request, response) => {
installedAppStatus.appStatus();
walletBalance.walletBalance();

request.on("close", () => {
request.on('close', () => {
// do nothing
});
};

/**
* SSE Handler call
*/
app.get("/api/sse/subscribe", eventsHandler);
app.get('/api/sse/subscribe', eventsHandler);
Loading

0 comments on commit 2e00128

Please sign in to comment.