mirror of
https://github.com/pockethost/pockethost.git
synced 2025-11-23 22:15:49 +00:00
enh: add user suspension check
This commit is contained in:
parent
086145184a
commit
375f9638a3
@ -0,0 +1,31 @@
|
|||||||
|
/// <reference path="../pb_data/types.d.ts" />
|
||||||
|
migrate((db) => {
|
||||||
|
const dao = new Dao(db)
|
||||||
|
const collection = dao.findCollectionByNameOrId("systemprofiles0")
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "we768a9l",
|
||||||
|
"name": "suspension",
|
||||||
|
"type": "text",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"min": null,
|
||||||
|
"max": null,
|
||||||
|
"pattern": ""
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
return dao.saveCollection(collection)
|
||||||
|
}, (db) => {
|
||||||
|
const dao = new Dao(db)
|
||||||
|
const collection = dao.findCollectionByNameOrId("systemprofiles0")
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("we768a9l")
|
||||||
|
|
||||||
|
return dao.saveCollection(collection)
|
||||||
|
})
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
/// <reference path="../pb_data/types.d.ts" />
|
||||||
|
migrate((db) => {
|
||||||
|
const dao = new Dao(db)
|
||||||
|
const collection = dao.findCollectionByNameOrId("systemprofiles0")
|
||||||
|
|
||||||
|
collection.indexes = [
|
||||||
|
"CREATE INDEX `idx_dVbmhXb` ON `users` (`subscription`)",
|
||||||
|
"CREATE INDEX `idx_3BXGFzv` ON `users` (`double_verified`)",
|
||||||
|
"CREATE INDEX `idx_vBLE6dl` ON `users` (`suspension`)"
|
||||||
|
]
|
||||||
|
|
||||||
|
// add
|
||||||
|
collection.schema.addField(new SchemaField({
|
||||||
|
"system": false,
|
||||||
|
"id": "konhuwum",
|
||||||
|
"name": "double_verified",
|
||||||
|
"type": "bool",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {}
|
||||||
|
}))
|
||||||
|
|
||||||
|
return dao.saveCollection(collection)
|
||||||
|
}, (db) => {
|
||||||
|
const dao = new Dao(db)
|
||||||
|
const collection = dao.findCollectionByNameOrId("systemprofiles0")
|
||||||
|
|
||||||
|
collection.indexes = [
|
||||||
|
"CREATE INDEX `idx_dVbmhXb` ON `users` (`subscription`)"
|
||||||
|
]
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.schema.removeField("konhuwum")
|
||||||
|
|
||||||
|
return dao.saveCollection(collection)
|
||||||
|
})
|
||||||
@ -338,6 +338,9 @@ export const instanceService = mkSingleton(
|
|||||||
Suspension check
|
Suspension check
|
||||||
*/
|
*/
|
||||||
dbg(`Checking for suspension`)
|
dbg(`Checking for suspension`)
|
||||||
|
if (owner.suspension) {
|
||||||
|
throw new Error(owner.suspension)
|
||||||
|
}
|
||||||
if (instance.suspension) {
|
if (instance.suspension) {
|
||||||
throw new Error(instance.suspension)
|
throw new Error(instance.suspension)
|
||||||
}
|
}
|
||||||
@ -371,7 +374,9 @@ export const instanceService = mkSingleton(
|
|||||||
})
|
})
|
||||||
const end = now()
|
const end = now()
|
||||||
const duration = end - start
|
const duration = end - start
|
||||||
|
if (duration > 200) {
|
||||||
console.log(`Container ${instance.id} launch took ${duration}ms`)
|
console.log(`Container ${instance.id} launch took ${duration}ms`)
|
||||||
|
}
|
||||||
|
|
||||||
const endRequest = api.startRequest()
|
const endRequest = api.startRequest()
|
||||||
res.on('close', endRequest)
|
res.on('close', endRequest)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user