chore: Adds initial support for eslint.
This commit is contained in:
parent
8b4f3715e9
commit
7e80b298a2
34 changed files with 3441 additions and 649 deletions
10
api/eslint.config.js
Normal file
10
api/eslint.config.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
import globals from "globals";
|
||||
import pluginJs from "@eslint/js";
|
||||
import tseslint from "typescript-eslint";
|
||||
|
||||
|
||||
export default [
|
||||
{languageOptions: { globals: globals.node }},
|
||||
pluginJs.configs.recommended,
|
||||
...tseslint.configs.recommended,
|
||||
];
|
1327
api/package-lock.json
generated
1327
api/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -14,14 +14,18 @@
|
|||
"author": "greysoh",
|
||||
"license": "BSD-3-Clause",
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.2.0",
|
||||
"@types/bcrypt": "^5.0.2",
|
||||
"@types/node": "^20.12.7",
|
||||
"@types/ssh2": "^1.15.0",
|
||||
"@types/ws": "^8.5.10",
|
||||
"eslint": "^8.57.0",
|
||||
"globals": "^15.2.0",
|
||||
"nodemon": "^3.0.3",
|
||||
"prettier": "^3.2.5",
|
||||
"prisma": "^5.13.0",
|
||||
"typescript": "^5.3.3"
|
||||
"typescript": "^5.3.3",
|
||||
"typescript-eslint": "^7.8.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fastify/websocket": "^10.0.1",
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// @eslint-ignore-file
|
||||
|
||||
export type ParameterReturnedValue = {
|
||||
success: boolean;
|
||||
message?: string;
|
||||
|
|
|
@ -10,4 +10,4 @@ export const backendProviders: Record<string, typeof BackendBaseClass> = {
|
|||
|
||||
if (process.env.NODE_ENV != "production") {
|
||||
backendProviders["dummy"] = BackendBaseClass;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -216,7 +216,7 @@ export class PassyFireBackendProvider implements BackendBaseClass {
|
|||
static checkParametersBackendInstance(data: string): ParameterReturnedValue {
|
||||
try {
|
||||
parseBackendProviderString(data);
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
} catch (e: Error) {
|
||||
return {
|
||||
success: false,
|
||||
|
|
|
@ -69,7 +69,7 @@ export function route(instance: PassyFireBackendProvider) {
|
|||
},
|
||||
},
|
||||
(req, res) => {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
const body: {
|
||||
username: string;
|
||||
password: string;
|
||||
|
@ -115,7 +115,7 @@ export function route(instance: PassyFireBackendProvider) {
|
|||
},
|
||||
},
|
||||
async (req, res) => {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
const body: {
|
||||
token: string;
|
||||
} = req.body;
|
||||
|
@ -132,7 +132,7 @@ export function route(instance: PassyFireBackendProvider) {
|
|||
req.hostname.indexOf(":") + 1,
|
||||
);
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
// parseInt(...) can take a number just fine, at least in Node.JS
|
||||
const port = parseInt(unparsedPort == "" ? proxiedPort : unparsedPort);
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ export function requestHandler(
|
|||
let state: "authentication" | "data" = "authentication";
|
||||
let socket: dgram.Socket | net.Socket | undefined;
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
let connectedClient: ConnectedClientExt = {};
|
||||
|
||||
ws.on("close", () => {
|
||||
|
|
|
@ -92,7 +92,7 @@ export class SSHBackendProvider implements BackendBaseClass {
|
|||
this.logs.push(`Failed to start SSHBackendProvider! Error: '${e}'`);
|
||||
this.state = "stopped";
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
this.sshInstance = null;
|
||||
|
||||
return false;
|
||||
|
@ -112,7 +112,7 @@ export class SSHBackendProvider implements BackendBaseClass {
|
|||
|
||||
this.sshInstance.dispose();
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
this.sshInstance = null;
|
||||
|
||||
this.logs.push("Successfully stopped SSHBackendProvider.");
|
||||
|
@ -255,7 +255,7 @@ export class SSHBackendProvider implements BackendBaseClass {
|
|||
static checkParametersBackendInstance(data: string): ParameterReturnedValue {
|
||||
try {
|
||||
parseBackendProviderString(data);
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
} catch (e: Error) {
|
||||
return {
|
||||
success: false,
|
||||
|
|
|
@ -27,7 +27,7 @@ export const permissionListDisabled: Record<string, boolean> = {
|
|||
};
|
||||
|
||||
// FIXME: This solution fucking sucks.
|
||||
export let permissionListEnabled: Record<string, boolean> = JSON.parse(
|
||||
export const permissionListEnabled: Record<string, boolean> = JSON.parse(
|
||||
JSON.stringify(permissionListDisabled),
|
||||
);
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ export function route(routeOptions: RouteOptions) {
|
|||
},
|
||||
},
|
||||
async (req, res) => {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
const body: {
|
||||
token: string;
|
||||
name: string;
|
||||
|
|
|
@ -33,7 +33,7 @@ export function route(routeOptions: RouteOptions) {
|
|||
},
|
||||
},
|
||||
async (req, res) => {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
const body: {
|
||||
token: string;
|
||||
id?: number;
|
||||
|
|
|
@ -30,7 +30,7 @@ export function route(routeOptions: RouteOptions) {
|
|||
},
|
||||
},
|
||||
async (req, res) => {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
const body: {
|
||||
token: string;
|
||||
id: number;
|
||||
|
|
|
@ -27,7 +27,7 @@ export function route(routeOptions: RouteOptions) {
|
|||
},
|
||||
},
|
||||
async (req, res) => {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
const body: {
|
||||
token: string;
|
||||
id: number;
|
||||
|
|
|
@ -50,7 +50,7 @@ export function route(routeOptions: RouteOptions) {
|
|||
},
|
||||
},
|
||||
async (req, res) => {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
const body: {
|
||||
token: string;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ export function route(routeOptions: RouteOptions) {
|
|||
},
|
||||
},
|
||||
async (req, res) => {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
const body: {
|
||||
token: string;
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ export function route(routeOptions: RouteOptions) {
|
|||
},
|
||||
},
|
||||
async (req, res) => {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
const body: {
|
||||
token: string;
|
||||
id: number;
|
||||
|
|
|
@ -30,7 +30,7 @@ export function route(routeOptions: RouteOptions) {
|
|||
},
|
||||
},
|
||||
async (req, res) => {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
const body: {
|
||||
token: string;
|
||||
id: number;
|
||||
|
@ -59,7 +59,7 @@ export function route(routeOptions: RouteOptions) {
|
|||
});
|
||||
|
||||
// Other restrictions in place make it so that it MUST be either TCP or UDP
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
const protocol: "tcp" | "udp" = forward.protocol;
|
||||
|
||||
backends[forward.destProviderID].addConnection(
|
||||
|
|
|
@ -30,7 +30,7 @@ export function route(routeOptions: RouteOptions) {
|
|||
},
|
||||
},
|
||||
async (req, res) => {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
const body: {
|
||||
token: string;
|
||||
id: number;
|
||||
|
@ -59,7 +59,7 @@ export function route(routeOptions: RouteOptions) {
|
|||
});
|
||||
|
||||
// Other restrictions in place make it so that it MUST be either TCP or UDP
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
const protocol: "tcp" | "udp" = forward.protocol;
|
||||
|
||||
backends[forward.destProviderID].removeConnection(
|
||||
|
|
|
@ -22,7 +22,7 @@ export function route(routeOptions: RouteOptions) {
|
|||
},
|
||||
},
|
||||
async (req, res) => {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
const body: {
|
||||
token: string;
|
||||
} = req.body;
|
||||
|
|
|
@ -29,7 +29,7 @@ export function route(routeOptions: RouteOptions) {
|
|||
},
|
||||
},
|
||||
async (req, res) => {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
const body: {
|
||||
name: string;
|
||||
email: string;
|
||||
|
@ -87,9 +87,9 @@ export function route(routeOptions: RouteOptions) {
|
|||
}
|
||||
|
||||
if (options.allowUnsafeGlobalTokens) {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
userData.rootToken = generateRandomData();
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
userData.isRootServiceAccount = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ export function route(routeOptions: RouteOptions) {
|
|||
},
|
||||
},
|
||||
async (req, res) => {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
const body: {
|
||||
email?: string;
|
||||
username?: string;
|
||||
|
|
|
@ -31,7 +31,7 @@ export function route(routeOptions: RouteOptions) {
|
|||
},
|
||||
},
|
||||
async (req, res) => {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
const body: {
|
||||
token: string;
|
||||
id?: number;
|
||||
|
|
|
@ -30,7 +30,7 @@ export function route(routeOptions: RouteOptions) {
|
|||
},
|
||||
},
|
||||
async (req, res) => {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
const body: {
|
||||
token: string;
|
||||
uid: number;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue