@coffer-org/server 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth-api.js +5 -1
- package/dist/auth-store.js +1 -2
- package/package.json +2 -2
package/dist/auth-api.js
CHANGED
|
@@ -127,7 +127,11 @@ export async function registerAuthApi(app) {
|
|
|
127
127
|
return;
|
|
128
128
|
const id = Number(req.params.id);
|
|
129
129
|
const body = (req.body ?? {});
|
|
130
|
-
const wantsDisabled = body.disabled === undefined
|
|
130
|
+
const wantsDisabled = body.disabled === undefined
|
|
131
|
+
? undefined
|
|
132
|
+
: body.disabled === 'false' || body.disabled === '0'
|
|
133
|
+
? false
|
|
134
|
+
: Boolean(body.disabled);
|
|
131
135
|
const demotingOrDisabling = (body.role === 'member' || wantsDisabled === true) && (await isLastAdmin(id));
|
|
132
136
|
if (demotingOrDisabling)
|
|
133
137
|
return reply.code(409).send({ error: 'last_admin' });
|
package/dist/auth-store.js
CHANGED
|
@@ -125,8 +125,7 @@ export async function resolveApiToken(raw) {
|
|
|
125
125
|
const user = await findUserById(token.user_id);
|
|
126
126
|
if (!user || user.disabled)
|
|
127
127
|
return null;
|
|
128
|
-
em.
|
|
129
|
-
await em.flush();
|
|
128
|
+
await em.nativeUpdate('_ApiToken', { id: token.id }, { last_used_at: new Date().toISOString() });
|
|
130
129
|
return user;
|
|
131
130
|
}
|
|
132
131
|
export async function listApiTokens(userId) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coffer-org/server",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=24"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@coffer-org/core": "^1.3.0",
|
|
28
|
-
"@coffer-org/sdk": "^1.3.
|
|
28
|
+
"@coffer-org/sdk": "^1.3.1",
|
|
29
29
|
"@extractus/oembed-extractor": "^4.1.0",
|
|
30
30
|
"@fastify/cors": "^11.2.0",
|
|
31
31
|
"@fastify/multipart": "^10.0.0",
|