mirror of
https://github.com/mollersuite/monofile.git
synced 2024-11-21 21:36:26 -08:00
before i forget,
This commit is contained in:
parent
b04414aeb9
commit
e624e19802
|
@ -434,8 +434,9 @@ export class UploadStream extends Writable {
|
|||
chunkSize: this.files.config.maxDiscordFileSize
|
||||
}
|
||||
|
||||
await this.files.write()
|
||||
delete this.files.locks[this.uploadId!]
|
||||
await this.files.api.deleteMessages(ogf.messageids)
|
||||
await this.files.write()
|
||||
if (this.owner) Accounts.files.index(this.owner, this.uploadId!)
|
||||
return this.uploadId
|
||||
}
|
||||
|
@ -627,16 +628,16 @@ export default class Files {
|
|||
async unlink(uploadId: string, noWrite: boolean = false): Promise<void> {
|
||||
let target = this.files[uploadId]
|
||||
if (!target) return
|
||||
|
||||
await this.api.deleteMessages(target.messageids)
|
||||
|
||||
if (target.owner) {
|
||||
let id = files.deindex(target.owner, uploadId, noWrite)
|
||||
if (id) await id
|
||||
}
|
||||
|
||||
await this.api.deleteMessages(target.messageids)
|
||||
|
||||
delete this.files[uploadId]
|
||||
if (noWrite) return
|
||||
return this.write().catch((err) => {
|
||||
|
||||
if (!noWrite) this.write().catch((err) => {
|
||||
throw err
|
||||
})
|
||||
}
|
||||
|
|
|
@ -212,8 +212,8 @@ export default function (files: Files) {
|
|||
requiresPermissions("manage"),
|
||||
async (ctx) => {
|
||||
const body = await ctx.req.json() as UserUpdateParameters
|
||||
const actor = ctx.get("account")! as Accounts.Account
|
||||
const target = ctx.get("target")! as Accounts.Account
|
||||
const actor = ctx.get("account")!
|
||||
const target = ctx.get("target")!
|
||||
if (Array.isArray(body))
|
||||
return ServeError(ctx, 400, "invalid body")
|
||||
|
||||
|
@ -240,9 +240,7 @@ export default function (files: Files) {
|
|||
)
|
||||
|
||||
router.delete("/:user", requiresAccount, noAPIAccess, async (ctx) => {
|
||||
let acc = ctx.req.param("user") == "me" ? ctx.get("account") : Accounts.getFromId(ctx.req.param("user"))
|
||||
if (acc != ctx.get("account") && !ctx.get("account")?.admin) return ServeError(ctx, 403, "you are not an administrator")
|
||||
if (!acc) return ServeError(ctx, 404, "account does not exist")
|
||||
let acc = ctx.get("target")
|
||||
|
||||
auth.AuthTokens.filter((e) => e.account == acc?.id).forEach(
|
||||
(token) => {
|
||||
|
@ -266,5 +264,7 @@ export default function (files: Files) {
|
|||
return ctx.text("account deleted")
|
||||
})
|
||||
|
||||
router.get("/:user")
|
||||
|
||||
return router
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue