mirror of
https://github.com/mollersuite/monofile.git
synced 2024-11-25 15:06:26 -08:00
this is a mess and still definitely incomplete
This commit is contained in:
parent
0f9bcba740
commit
c6e9e25973
|
@ -3,11 +3,12 @@
|
||||||
"version": "1.4.0-dev",
|
"version": "1.4.0-dev",
|
||||||
"description": "Discord-based file sharing",
|
"description": "Discord-based file sharing",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node ./out/server/index.js",
|
"start": "node ./out/server/index.js",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "tsc && vite build",
|
"build": "tsc --build src/server && vite build",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
import fs from "fs"
|
import fs from "fs"
|
||||||
import { stat } from "fs/promises"
|
import { stat } from "fs/promises"
|
||||||
import Files from "./lib/files"
|
import Files from "./lib/files.js"
|
||||||
import { program } from "commander"
|
import { program } from "commander"
|
||||||
import { basename } from "path"
|
import { basename } from "path"
|
||||||
import { Writable } from "node:stream"
|
import { Writable } from "node:stream"
|
||||||
const pkg = require(`${process.cwd()}/package.json`)
|
import pkg from "../../package.json" assert { type: "json" }
|
||||||
let config = require(`${process.cwd()}/config.json`)
|
import config from "../../config.json" assert { type: "json" }
|
||||||
|
import { fileURLToPath } from "url"
|
||||||
|
import { dirname } from "path"
|
||||||
|
|
||||||
// init data
|
// init data
|
||||||
|
|
||||||
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||||
if (!fs.existsSync(__dirname + "/../../.data/"))
|
if (!fs.existsSync(__dirname + "/../../.data/"))
|
||||||
fs.mkdirSync(__dirname + "/../../.data/")
|
fs.mkdirSync(__dirname + "/../../.data/")
|
||||||
|
|
||||||
|
@ -65,12 +68,12 @@ program.command("upload")
|
||||||
if (!(fs.existsSync(file) && (await stat(file)).isFile()))
|
if (!(fs.existsSync(file) && (await stat(file)).isFile()))
|
||||||
throw `${file} is not a file`
|
throw `${file} is not a file`
|
||||||
|
|
||||||
let writable = files.writeFileStream({
|
let writable = files.createWriteStream()
|
||||||
filename: basename(file),
|
|
||||||
mime: "application/octet-stream",
|
writable
|
||||||
size: (await stat(file)).size,
|
.setName(file)
|
||||||
uploadId: options.fileid
|
?.setType("application/octet-stream")
|
||||||
})
|
?.setUploadId(options.fileId)
|
||||||
|
|
||||||
if (!(writable instanceof Writable))
|
if (!(writable instanceof Writable))
|
||||||
throw JSON.stringify(writable, null, 3)
|
throw JSON.stringify(writable, null, 3)
|
||||||
|
|
|
@ -3,10 +3,10 @@ import { serveStatic } from "@hono/node-server/serve-static"
|
||||||
import { Hono } from "hono"
|
import { Hono } from "hono"
|
||||||
import fs from "fs"
|
import fs from "fs"
|
||||||
import { readFile } from "fs/promises"
|
import { readFile } from "fs/promises"
|
||||||
import Files from "./lib/files"
|
import Files from "./lib/files.js"
|
||||||
import { getAccount } from "./lib/middleware"
|
import { getAccount } from "./lib/middleware.js"
|
||||||
import APIRouter from "./routes/api"
|
import APIRouter from "./routes/api.js"
|
||||||
import preview from "./routes/preview"
|
import preview from "./routes/preview.js"
|
||||||
|
|
||||||
const pkg = require(`${process.cwd()}/package.json`)
|
const pkg = require(`${process.cwd()}/package.json`)
|
||||||
const app = new Hono()
|
const app = new Hono()
|
||||||
|
@ -117,4 +117,4 @@ serve(
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
export = app
|
export default app
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// working around typescript cause i can't think of anything better :upside_down:
|
||||||
import { type RequestInfo, type RequestInit, type Response, Headers } from "node-fetch"
|
import { type RequestInfo, type RequestInit, type Response, Headers } from "node-fetch"
|
||||||
|
|
||||||
// I jerk off to skibidi toilet. His smile is so fucking hot, oh my god, oh.
|
// I jerk off to skibidi toilet. His smile is so fucking hot, oh my god, oh.
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { REST } from "./DiscordRequests"
|
import { REST } from "./DiscordRequests.js"
|
||||||
import type { APIMessage } from "discord-api-types/v10"
|
import type { APIMessage } from "discord-api-types/v10"
|
||||||
import FormData from "form-data"
|
import FormData from "form-data"
|
||||||
import { Readable } from "node:stream"
|
import { Readable } from "node:stream"
|
||||||
import { Configuration } from "../files"
|
import { Configuration } from "../files.js"
|
||||||
|
|
||||||
const EXPIRE_AFTER = 20 * 60 * 1000
|
const EXPIRE_AFTER = 20 * 60 * 1000
|
||||||
const DISCORD_EPOCH = 1420070400000
|
const DISCORD_EPOCH = 1420070400000
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import crypto from "crypto"
|
import crypto from "crypto"
|
||||||
import * as auth from "./auth";
|
import * as auth from "./auth.js";
|
||||||
import { readFile, writeFile } from "fs/promises"
|
import { readFile, writeFile } from "fs/promises"
|
||||||
import { FileVisibility } from "./files";
|
import { FileVisibility } from "./files.js";
|
||||||
|
|
||||||
// this is probably horrible
|
// this is probably horrible
|
||||||
// but i don't even care anymore
|
// but i don't even care anymore
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
import { readFile, writeFile } from "node:fs/promises"
|
import { readFile, writeFile } from "node:fs/promises"
|
||||||
import { Readable, Writable } from "node:stream"
|
import { Readable, Writable } from "node:stream"
|
||||||
import crypto from "node:crypto"
|
import crypto from "node:crypto"
|
||||||
import { files } from "./accounts"
|
import { files } from "./accounts.js"
|
||||||
import { Client as API } from "./DiscordAPI"
|
import { Client as API } from "./DiscordAPI/index.js"
|
||||||
import type {APIAttachment} from "discord-api-types/v10"
|
import type {APIAttachment} from "discord-api-types/v10"
|
||||||
|
import "dotenv"
|
||||||
|
|
||||||
import * as Accounts from "./accounts"
|
import * as Accounts from "./accounts.js"
|
||||||
|
|
||||||
export let id_check_regex = /[A-Za-z0-9_\-\.\!\=\:\&\$\,\+\;\@\~\*\(\)\']+/
|
export let id_check_regex = /[A-Za-z0-9_\-\.\!\=\:\&\$\,\+\;\@\~\*\(\)\']+/
|
||||||
export let alphanum = Array.from(
|
export let alphanum = Array.from(
|
||||||
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
|
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
|
||||||
)
|
)
|
||||||
|
|
||||||
require("dotenv").config()
|
|
||||||
|
|
||||||
// bad solution but whatever
|
// bad solution but whatever
|
||||||
|
|
||||||
export type FileVisibility = "public" | "anonymous" | "private"
|
export type FileVisibility = "public" | "anonymous" | "private"
|
||||||
|
@ -96,71 +95,157 @@ async function startPushingWebStream(stream: Readable, webStream: ReadableStream
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace StreamHelpers {
|
export class WebError extends Error {
|
||||||
|
|
||||||
export interface UploadStream {
|
readonly statusCode: number = 500
|
||||||
uploaded: number // number of bytes uploaded
|
|
||||||
stream : Readable
|
constructor(status: number, message: string) {
|
||||||
|
super(message)
|
||||||
|
this.statusCode = status
|
||||||
}
|
}
|
||||||
|
|
||||||
export class StreamBuffer {
|
}
|
||||||
|
|
||||||
readonly targetSize: number
|
export class UploadStream extends Writable {
|
||||||
filled: number = 0
|
|
||||||
current?: Readable
|
|
||||||
messages: string[] = []
|
|
||||||
writable?: Writable
|
|
||||||
|
|
||||||
private newmessage_debounce : boolean = true
|
uploadId?: string
|
||||||
|
name?: string
|
||||||
|
mime?: string
|
||||||
|
owner?: string
|
||||||
|
|
||||||
api: API
|
files: Files
|
||||||
files: Files
|
|
||||||
|
|
||||||
constructor( files: Files, targetSize: number ) {
|
error?: Error
|
||||||
this.files = files
|
|
||||||
this.api = files.api
|
constructor(files: Files, owner?: string) {
|
||||||
this.targetSize = targetSize
|
super()
|
||||||
|
this.owner = owner
|
||||||
|
this.files = files
|
||||||
|
}
|
||||||
|
|
||||||
|
// implementing some stuff
|
||||||
|
|
||||||
|
_write(data: Buffer, encoding: string, callback: () => void) {
|
||||||
|
console.log("Write to stream attempted")
|
||||||
|
this.getNextStream().then(ns => {
|
||||||
|
if (ns) {ns.push(data); callback()} else this.end();
|
||||||
|
console.log(`pushed... ${ns ? "ns exists" : "ns doesn't exist"}... ${data.byteLength} byte chunk`);
|
||||||
|
return
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
_destroy(error: Error | null) {
|
||||||
|
this.error = error || undefined
|
||||||
|
|
||||||
|
if (error instanceof WebError) return // destroyed by self
|
||||||
|
if (error) this.abort() // destroyed externally...
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description Cancel & unlock the file. When destroy() is called with a non-WebError, this is automatically called
|
||||||
|
*/
|
||||||
|
async abort() {
|
||||||
|
if (!this.destroyed) this.destroy()
|
||||||
|
await this.files.api.deleteMessages(this.messages)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description Commit the file to the database
|
||||||
|
* @returns The file's ID
|
||||||
|
*/
|
||||||
|
async commit() {
|
||||||
|
if (this.errored) throw this.error
|
||||||
|
if (!this.closed) {
|
||||||
|
let err = Error("attempted to commit file without closing the stream")
|
||||||
|
this.destroy(err); throw err
|
||||||
}
|
}
|
||||||
|
|
||||||
private async startMessage(): Promise<Readable | undefined> {
|
// Perform checks
|
||||||
|
if (!this.mime) throw new WebError(400, "no mime provided")
|
||||||
|
if (!this.name) throw new WebError(400, "no filename provided")
|
||||||
|
if (!this.uploadId) this.setUploadId(generateFileId())
|
||||||
|
|
||||||
|
// commit to db here...
|
||||||
|
}
|
||||||
|
|
||||||
|
// exposed methods
|
||||||
|
|
||||||
|
setName(name: string) {
|
||||||
|
if (this.name)
|
||||||
|
return this.destroy( new WebError(400, "duplicate attempt to set filename") )
|
||||||
|
if (name.length > 512)
|
||||||
|
return this.destroy( new WebError(400, "filename can be a maximum of 512 characters") )
|
||||||
|
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
setType(type: string) {
|
||||||
|
if (this.mime)
|
||||||
|
return this.destroy( new WebError(400, "duplicate attempt to set mime type") )
|
||||||
|
if (type.length > 256)
|
||||||
|
return this.destroy( new WebError(400, "mime type can be a maximum of 256 characters") )
|
||||||
|
|
||||||
|
this.mime = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
setUploadId(id: string) {
|
||||||
|
if (this.uploadId)
|
||||||
|
return this.destroy( new WebError(400, "duplicate attempt to set upload ID") )
|
||||||
|
if (id.match(id_check_regex)?.[0] != id
|
||||||
|
|| id.length > this.files.config.maxUploadIdLength)
|
||||||
|
return this.destroy( new WebError(400, "invalid file ID") )
|
||||||
|
|
||||||
|
// There's more stuff to check here!
|
||||||
|
// Make sure to check if the upload ID is locked
|
||||||
|
// and if the user owns this file...
|
||||||
|
|
||||||
|
this.uploadId = id
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
// merged StreamBuffer helper
|
||||||
|
|
||||||
|
filled: number = 0
|
||||||
|
current?: Readable
|
||||||
|
messages: string[] = []
|
||||||
|
|
||||||
|
private newmessage_debounce : boolean = true
|
||||||
|
|
||||||
|
private async startMessage(): Promise<Readable | undefined> {
|
||||||
|
|
||||||
|
|
||||||
if (!this.newmessage_debounce) return
|
if (!this.newmessage_debounce) return
|
||||||
this.newmessage_debounce = false
|
this.newmessage_debounce = false
|
||||||
|
|
||||||
let sbuf = this
|
let stream = new Readable({
|
||||||
let stream = new Readable({
|
read() {
|
||||||
read() {
|
console.log("Read called. Emitting drain")
|
||||||
console.log("Read called. Emitting drain")
|
this.emit("drain")
|
||||||
sbuf.writable!.emit("drain")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
stream.pause()
|
|
||||||
|
|
||||||
console.log(`Starting a message`)
|
|
||||||
this.api.send(stream).then(message => {
|
|
||||||
this.messages.push(message.id)
|
|
||||||
console.log(`Sent: ${message.id}`)
|
|
||||||
this.newmessage_debounce = true
|
|
||||||
})
|
|
||||||
|
|
||||||
return stream
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
async getNextStream() {
|
|
||||||
console.log("Getting stream...")
|
|
||||||
if (this.current) return this.current
|
|
||||||
else {
|
|
||||||
// startmessage.... idk
|
|
||||||
this.current = await this.startMessage();
|
|
||||||
console.log("current:" + (this.current ? "yes" : "no"))
|
|
||||||
return this.current
|
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
|
stream.pause()
|
||||||
|
|
||||||
|
console.log(`Starting a message`)
|
||||||
|
this.files.api.send(stream).then(message => {
|
||||||
|
this.messages.push(message.id)
|
||||||
|
console.log(`Sent: ${message.id}`)
|
||||||
|
this.newmessage_debounce = true
|
||||||
|
})
|
||||||
|
|
||||||
|
return stream
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async getNextStream() {
|
||||||
|
console.log("Getting stream...")
|
||||||
|
if (this.current) return this.current
|
||||||
|
else {
|
||||||
|
// startmessage.... idk
|
||||||
|
this.current = await this.startMessage();
|
||||||
|
console.log("current:" + (this.current ? "yes" : "no"))
|
||||||
|
return this.current
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Files {
|
export default class Files {
|
||||||
|
@ -209,33 +294,8 @@ export default class Files {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
writeFileStream(metadata: FileUploadSettings & { size: number }) {
|
createWriteStream(owner?: string) {
|
||||||
|
return new UploadStream(this, owner)
|
||||||
let uploadId = (metadata.uploadId || generateFileId()).toString()
|
|
||||||
|
|
||||||
let validation = this.validateUpload(
|
|
||||||
{...metadata, uploadId}
|
|
||||||
)
|
|
||||||
if (validation) return validation
|
|
||||||
|
|
||||||
let buf = new StreamHelpers.StreamBuffer(this, metadata.size)
|
|
||||||
let fs_obj = this
|
|
||||||
|
|
||||||
let wt = new Writable({
|
|
||||||
write(data: Buffer, encoding, callback) {
|
|
||||||
console.log("Write to stream attempted")
|
|
||||||
buf.getNextStream().then(ns => {
|
|
||||||
if (ns) {ns.push(data); callback()} else this.end();
|
|
||||||
console.log(`pushed... ${ns ? "ns exists" : "ns doesn't exist"}... ${data.byteLength} byte chunk`);
|
|
||||||
return
|
|
||||||
})
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
buf.writable = wt;
|
|
||||||
|
|
||||||
return wt
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// fs
|
// fs
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as Accounts from "./accounts"
|
import * as Accounts from "./accounts.js"
|
||||||
import { Handler as RequestHandler } from "hono"
|
import { Handler as RequestHandler } from "hono"
|
||||||
import ServeError from "../lib/errors"
|
import ServeError from "../lib/errors.js"
|
||||||
import * as auth from "./auth"
|
import * as auth from "./auth.js"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Middleware which adds an account, if any, to ctx.get("account")
|
* @description Middleware which adds an account, if any, to ctx.get("account")
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { Handler } from "hono"
|
import type { Handler } from "hono"
|
||||||
import ServeError from "./errors"
|
import ServeError from "./errors.js"
|
||||||
|
|
||||||
interface RatelimitSettings {
|
interface RatelimitSettings {
|
||||||
requests: number
|
requests: number
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Hono } from "hono"
|
import { Hono } from "hono"
|
||||||
import { readFile, readdir } from "fs/promises"
|
import { readFile, readdir } from "fs/promises"
|
||||||
import Files from "../lib/files"
|
import Files from "../lib/files.js"
|
||||||
|
|
||||||
const APIDirectory = __dirname + "/api"
|
const APIDirectory = __dirname + "/api"
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
import { Hono } from "hono"
|
import { Hono } from "hono"
|
||||||
import * as Accounts from "../../../lib/accounts"
|
import * as Accounts from "../../../lib/accounts.js"
|
||||||
import * as auth from "../../../lib/auth"
|
import * as auth from "../../../lib/auth.js"
|
||||||
import { writeFile } from "fs/promises"
|
import { writeFile } from "fs/promises"
|
||||||
import { sendMail } from "../../../lib/mail"
|
import { sendMail } from "../../../lib/mail.js"
|
||||||
import {
|
import {
|
||||||
getAccount,
|
getAccount,
|
||||||
requiresAccount,
|
requiresAccount,
|
||||||
requiresAdmin,
|
requiresAdmin,
|
||||||
requiresPermissions,
|
requiresPermissions,
|
||||||
} from "../../../lib/middleware"
|
} from "../../../lib/middleware.js"
|
||||||
import Files from "../../../lib/files"
|
import Files from "../../../lib/files.js"
|
||||||
|
|
||||||
export let adminRoutes = new Hono<{
|
export let adminRoutes = new Hono<{
|
||||||
Variables: {
|
Variables: {
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
import { Hono, Handler } from "hono"
|
import { Hono, Handler } from "hono"
|
||||||
import { getCookie, setCookie } from "hono/cookie"
|
import { getCookie, setCookie } from "hono/cookie"
|
||||||
import * as Accounts from "../../../lib/accounts"
|
import * as Accounts from "../../../lib/accounts.js"
|
||||||
import * as auth from "../../../lib/auth"
|
import * as auth from "../../../lib/auth.js"
|
||||||
import { sendMail } from "../../../lib/mail"
|
import { sendMail } from "../../../lib/mail.js"
|
||||||
import {
|
import {
|
||||||
getAccount,
|
getAccount,
|
||||||
noAPIAccess,
|
noAPIAccess,
|
||||||
requiresAccount,
|
requiresAccount,
|
||||||
requiresPermissions,
|
requiresPermissions,
|
||||||
} from "../../../lib/middleware"
|
} from "../../../lib/middleware.js"
|
||||||
import { accountRatelimit } from "../../../lib/ratelimit"
|
import { accountRatelimit } from "../../../lib/ratelimit.js"
|
||||||
|
|
||||||
import ServeError from "../../../lib/errors"
|
import ServeError from "../../../lib/errors.js"
|
||||||
import Files, {
|
import Files, {
|
||||||
FileVisibility,
|
FileVisibility,
|
||||||
generateFileId,
|
generateFileId,
|
||||||
id_check_regex,
|
id_check_regex,
|
||||||
} from "../../../lib/files"
|
} from "../../../lib/files.js"
|
||||||
|
|
||||||
import { writeFile } from "fs/promises"
|
import { writeFile } from "fs/promises"
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { Hono } from "hono"
|
import { Hono } from "hono"
|
||||||
import * as Accounts from "../../../lib/accounts"
|
import * as Accounts from "../../../lib/accounts.js"
|
||||||
import { writeFile } from "fs/promises"
|
import { writeFile } from "fs/promises"
|
||||||
import Files from "../../../lib/files"
|
import Files from "../../../lib/files.js"
|
||||||
import {
|
import {
|
||||||
getAccount,
|
getAccount,
|
||||||
requiresAccount,
|
requiresAccount,
|
||||||
requiresPermissions,
|
requiresPermissions,
|
||||||
} from "../../../lib/middleware"
|
} from "../../../lib/middleware.js"
|
||||||
|
|
||||||
export let fileApiRoutes = new Hono<{
|
export let fileApiRoutes = new Hono<{
|
||||||
Variables: {
|
Variables: {
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
import bodyParser from "body-parser"
|
import bodyParser from "body-parser"
|
||||||
import { Hono } from "hono"
|
import { Hono } from "hono"
|
||||||
|
|
||||||
import * as Accounts from "../../../lib/accounts"
|
import * as Accounts from "../../../lib/accounts.js"
|
||||||
import * as auth from "../../../lib/auth"
|
import * as auth from "../../../lib/auth.js"
|
||||||
import axios, { AxiosResponse } from "axios"
|
import axios, { AxiosResponse } from "axios"
|
||||||
import { type Range } from "range-parser"
|
import { type Range } from "range-parser"
|
||||||
import multer, { memoryStorage } from "multer"
|
import multer, { memoryStorage } from "multer"
|
||||||
import { Readable } from "stream"
|
import { Readable } from "stream"
|
||||||
import ServeError from "../../../lib/errors"
|
import ServeError from "../../../lib/errors.js"
|
||||||
import Files from "../../../lib/files"
|
import Files from "../../../lib/files.js"
|
||||||
import { getAccount, requiresPermissions } from "../../../lib/middleware"
|
import { getAccount, requiresPermissions } from "../../../lib/middleware.js"
|
||||||
|
|
||||||
let parser = bodyParser.json({
|
let parser = bodyParser.json({
|
||||||
type: ["text/plain", "application/json"],
|
type: ["text/plain", "application/json"],
|
||||||
|
@ -27,7 +27,7 @@ let config = require(`${process.cwd()}/config.json`)
|
||||||
|
|
||||||
primaryApi.use(getAccount)
|
primaryApi.use(getAccount)
|
||||||
|
|
||||||
module.exports = function (files: Files) {
|
module.exports = function (files: Files) {/*
|
||||||
primaryApi.get(
|
primaryApi.get(
|
||||||
["/file/:fileId", "/cpt/:fileId/*", "/:fileId"],
|
["/file/:fileId", "/cpt/:fileId/*", "/:fileId"],
|
||||||
async (ctx) => {
|
async (ctx) => {
|
||||||
|
@ -114,7 +114,7 @@ module.exports = function (files: Files) {
|
||||||
return ServeError(ctx, 404, "file not found")
|
return ServeError(ctx, 404, "file not found")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)*/
|
||||||
|
|
||||||
// primaryApi.head(
|
// primaryApi.head(
|
||||||
// ["/file/:fileId", "/cpt/:fileId/*", "/:fileId"],
|
// ["/file/:fileId", "/cpt/:fileId/*", "/:fileId"],
|
||||||
|
|
|
@ -6,18 +6,18 @@ import { getCookie, setCookie } from "hono/cookie"
|
||||||
|
|
||||||
// Libs
|
// Libs
|
||||||
|
|
||||||
import Files, { id_check_regex } from "../../../lib/files"
|
import Files, { id_check_regex } from "../../../lib/files.js"
|
||||||
import * as Accounts from "../../../lib/accounts"
|
import * as Accounts from "../../../lib/accounts.js"
|
||||||
import * as Authentication from "../../../lib/auth"
|
import * as Authentication from "../../../lib/auth.js"
|
||||||
import {
|
import {
|
||||||
assertAPI,
|
assertAPI,
|
||||||
getAccount,
|
getAccount,
|
||||||
noAPIAccess,
|
noAPIAccess,
|
||||||
requiresAccount,
|
requiresAccount,
|
||||||
requiresPermissions,
|
requiresPermissions,
|
||||||
} from "../../../lib/middleware"
|
} from "../../../lib/middleware.js"
|
||||||
import ServeError from "../../../lib/errors"
|
import ServeError from "../../../lib/errors.js"
|
||||||
import { sendMail } from "../../../lib/mail"
|
import { sendMail } from "../../../lib/mail.js"
|
||||||
|
|
||||||
const Configuration = require(`${process.cwd()}/config.json`)
|
const Configuration = require(`${process.cwd()}/config.json`)
|
||||||
|
|
||||||
|
|
|
@ -5,17 +5,17 @@ import { Hono } from "hono"
|
||||||
|
|
||||||
// Libs
|
// Libs
|
||||||
|
|
||||||
import Files, { id_check_regex } from "../../../lib/files"
|
import Files, { id_check_regex } from "../../../lib/files.js"
|
||||||
import * as Accounts from "../../../lib/accounts"
|
import * as Accounts from "../../../lib/accounts.js"
|
||||||
import * as Authentication from "../../../lib/auth"
|
import * as Authentication from "../../../lib/auth.js"
|
||||||
import {
|
import {
|
||||||
getAccount,
|
getAccount,
|
||||||
noAPIAccess,
|
noAPIAccess,
|
||||||
requiresAccount,
|
requiresAccount,
|
||||||
requiresAdmin,
|
requiresAdmin,
|
||||||
} from "../../../lib/middleware"
|
} from "../../../lib/middleware.js"
|
||||||
import ServeError from "../../../lib/errors"
|
import ServeError from "../../../lib/errors.js"
|
||||||
import { sendMail } from "../../../lib/mail"
|
import { sendMail } from "../../../lib/mail.js"
|
||||||
|
|
||||||
const Configuration = require(`${process.cwd()}/config.json`)
|
const Configuration = require(`${process.cwd()}/config.json`)
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { Hono } from "hono"
|
import { Hono } from "hono"
|
||||||
import Files, { id_check_regex } from "../../../lib/files"
|
import Files, { id_check_regex } from "../../../lib/files.js"
|
||||||
import * as Accounts from "../../../lib/accounts"
|
import * as Accounts from "../../../lib/accounts.js"
|
||||||
import {
|
import {
|
||||||
getAccount,
|
getAccount,
|
||||||
requiresAccount,
|
requiresAccount,
|
||||||
requiresPermissions,
|
requiresPermissions,
|
||||||
} from "../../../lib/middleware"
|
} from "../../../lib/middleware.js"
|
||||||
import ServeError from "../../../lib/errors"
|
import ServeError from "../../../lib/errors.js"
|
||||||
|
|
||||||
const Configuration = require(`${process.cwd()}/config.json`)
|
const Configuration = require(`${process.cwd()}/config.json`)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Hono } from "hono";
|
import { Hono } from "hono";
|
||||||
import Files from "../../../lib/files";
|
import Files from "../../../lib/files.js";
|
||||||
|
|
||||||
const router = new Hono()
|
const router = new Hono()
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Hono } from "hono"
|
import { Hono } from "hono"
|
||||||
import Files from "../../../lib/files"
|
import Files from "../../../lib/files.js"
|
||||||
|
|
||||||
const router = new Hono()
|
const router = new Hono()
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import fs from "fs/promises"
|
import fs from "fs/promises"
|
||||||
import bytes from "bytes"
|
import bytes from "bytes"
|
||||||
import ServeError from "../lib/errors"
|
import ServeError from "../lib/errors.js"
|
||||||
import * as Accounts from "../lib/accounts"
|
import * as Accounts from "../lib/accounts.js"
|
||||||
import type { Handler } from "hono"
|
import type { Handler } from "hono"
|
||||||
import type Files from "../lib/files"
|
import type Files from "../lib/files.js"
|
||||||
const pkg = require(`${process.cwd()}/package.json`)
|
const pkg = require(`${process.cwd()}/package.json`)
|
||||||
export = (files: Files): Handler =>
|
export default (files: Files): Handler =>
|
||||||
async (ctx) => {
|
async (ctx) => {
|
||||||
let acc = ctx.get("account") as Accounts.Account
|
let acc = ctx.get("account") as Accounts.Account
|
||||||
const fileId = ctx.req.param("fileId")
|
const fileId = ctx.req.param("fileId")
|
||||||
|
|
104
src/server/tsconfig.json
Normal file
104
src/server/tsconfig.json
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
{
|
||||||
|
"include":["**/*"],
|
||||||
|
"compilerOptions": {
|
||||||
|
/* Visit https://aka.ms/tsconfig to read more about this file */
|
||||||
|
|
||||||
|
/* Projects */
|
||||||
|
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
||||||
|
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
||||||
|
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
||||||
|
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
||||||
|
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
||||||
|
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
||||||
|
|
||||||
|
/* Language and Environment */
|
||||||
|
"target": "es2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
||||||
|
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
||||||
|
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
||||||
|
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
||||||
|
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
||||||
|
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
||||||
|
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
||||||
|
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
||||||
|
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
||||||
|
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
||||||
|
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
||||||
|
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
||||||
|
|
||||||
|
/* Modules */
|
||||||
|
"module": "nodenext", /* Specify what module code is generated. */
|
||||||
|
//"rootDir": "./src/", /* Specify the root folder within your source files. */
|
||||||
|
"moduleResolution": "nodenext", /* Specify how TypeScript looks up a file from a given module specifier. */
|
||||||
|
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
||||||
|
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
||||||
|
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
||||||
|
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||||
|
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||||
|
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||||
|
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||||
|
"resolveJsonModule": true, /* Enable importing .json files. */
|
||||||
|
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||||
|
|
||||||
|
/* JavaScript Support */
|
||||||
|
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
||||||
|
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
||||||
|
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
||||||
|
|
||||||
|
/* Emit */
|
||||||
|
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
||||||
|
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
||||||
|
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
||||||
|
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||||
|
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
||||||
|
"outDir": "../../out/server", /* Specify an output folder for all emitted files. */
|
||||||
|
// "removeComments": true, /* Disable emitting comments. */
|
||||||
|
// "noEmit": true, /* Disable emitting files from a compilation. */
|
||||||
|
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
||||||
|
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
||||||
|
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
||||||
|
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
||||||
|
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||||
|
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
||||||
|
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
||||||
|
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
||||||
|
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
||||||
|
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
||||||
|
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
||||||
|
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
||||||
|
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
||||||
|
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
||||||
|
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
||||||
|
|
||||||
|
/* Interop Constraints */
|
||||||
|
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
||||||
|
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
||||||
|
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
||||||
|
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
||||||
|
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
||||||
|
|
||||||
|
/* Type Checking */
|
||||||
|
"strict": true, /* Enable all strict type-checking options. */
|
||||||
|
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
||||||
|
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
||||||
|
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||||
|
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
||||||
|
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||||
|
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
||||||
|
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
||||||
|
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||||
|
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
||||||
|
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
||||||
|
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||||
|
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||||
|
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||||
|
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
||||||
|
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
||||||
|
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
||||||
|
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
||||||
|
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
||||||
|
|
||||||
|
/* Completeness */
|
||||||
|
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
||||||
|
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
||||||
|
}
|
||||||
|
}
|
110
tsconfig.json
110
tsconfig.json
|
@ -1,104 +1,12 @@
|
||||||
{
|
{
|
||||||
"include":["src/server/**/*"],
|
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
/* Visit https://aka.ms/tsconfig to read more about this file */
|
"rootDir": ".",
|
||||||
|
"outDir": ".",
|
||||||
/* Projects */
|
"resolveJsonModule": true,
|
||||||
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
"composite": true,
|
||||||
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
"skipLibCheck": true
|
||||||
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
},
|
||||||
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
"files": [
|
||||||
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
"package.json", "config.json"
|
||||||
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
]
|
||||||
|
|
||||||
/* Language and Environment */
|
|
||||||
"target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
||||||
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
||||||
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
||||||
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
|
||||||
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
||||||
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
||||||
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
||||||
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
||||||
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
||||||
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
||||||
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
||||||
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
||||||
|
|
||||||
/* Modules */
|
|
||||||
"module": "commonjs", /* Specify what module code is generated. */
|
|
||||||
// "rootDir": "./src/", /* Specify the root folder within your source files. */
|
|
||||||
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
||||||
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
||||||
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
||||||
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
||||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
||||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
||||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
||||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
||||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
||||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
||||||
|
|
||||||
/* JavaScript Support */
|
|
||||||
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
||||||
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
||||||
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
||||||
|
|
||||||
/* Emit */
|
|
||||||
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
||||||
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
||||||
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
||||||
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
||||||
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
||||||
"outDir": "./out/server", /* Specify an output folder for all emitted files. */
|
|
||||||
// "removeComments": true, /* Disable emitting comments. */
|
|
||||||
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
||||||
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
||||||
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
|
||||||
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
||||||
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
||||||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
||||||
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
||||||
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
||||||
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
||||||
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
||||||
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
||||||
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
||||||
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
||||||
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
||||||
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
||||||
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
||||||
|
|
||||||
/* Interop Constraints */
|
|
||||||
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
||||||
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
||||||
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
||||||
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
||||||
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
||||||
|
|
||||||
/* Type Checking */
|
|
||||||
"strict": true, /* Enable all strict type-checking options. */
|
|
||||||
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
||||||
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
||||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
||||||
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
||||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
||||||
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
||||||
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
||||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
||||||
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
||||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
||||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
||||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
||||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
||||||
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
||||||
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
||||||
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
||||||
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
||||||
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
||||||
|
|
||||||
/* Completeness */
|
|
||||||
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
||||||
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue