mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-22 17:03:49 +01:00
簡易的なパーミッションの後方互換 (#4687)
This commit is contained in:
parent
ce6377774d
commit
e1ca381549
@ -3,6 +3,7 @@ import $ from 'cafy';
|
||||
import define from '../../define';
|
||||
import { Apps } from '../../../../models';
|
||||
import { genId } from '../../../../misc/gen-id';
|
||||
import { unique } from '../../../../prelude/array';
|
||||
|
||||
export const meta = {
|
||||
tags: ['app'],
|
||||
@ -34,6 +35,9 @@ export default define(meta, async (ps, user) => {
|
||||
// Generate secret
|
||||
const secret = rndstr('a-zA-Z0-9', 32);
|
||||
|
||||
// for backward compatibility
|
||||
const permission = unique(ps.permission.map(v => v.replace(/^(.+)(\/|-)(read|write)$/, '$3:$1')));
|
||||
|
||||
// Create account
|
||||
const app = await Apps.save({
|
||||
id: genId(),
|
||||
@ -41,7 +45,7 @@ export default define(meta, async (ps, user) => {
|
||||
userId: user ? user.id : null,
|
||||
name: ps.name,
|
||||
description: ps.description,
|
||||
permission: ps.permission,
|
||||
permission,
|
||||
callbackUrl: ps.callbackUrl,
|
||||
secret: secret
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user