Merge pull request MisskeyIO#597 from hotfix-skeb-api
This commit is contained in:
commit
1a87a4bbb8
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "misskey",
|
"name": "misskey",
|
||||||
"version": "2024.3.1-io.5",
|
"version": "2024.3.1-io.5a",
|
||||||
"codename": "nasubi",
|
"codename": "nasubi",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -134,17 +134,25 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||||||
|
|
||||||
if (res.status > 299 || (json.error ?? json.ban_reason)) {
|
if (res.status > 299 || (json.error ?? json.ban_reason)) {
|
||||||
logger.error('Skeb status response error', { url: url.href, userId: ps.userId, status: res.status, statusText: res.statusText, error: json.error ?? json.ban_reason });
|
logger.error('Skeb status response error', { url: url.href, userId: ps.userId, status: res.status, statusText: res.statusText, error: json.error ?? json.ban_reason });
|
||||||
|
try {
|
||||||
if (res.status === 404 && hasSkebRole) await this.roleService.unassign(ps.userId, this.config.skebStatus.roleId);
|
if (res.status === 404 && hasSkebRole) await this.roleService.unassign(ps.userId, this.config.skebStatus.roleId);
|
||||||
|
} catch (err) {
|
||||||
|
logger.error('Failed to unassign role', { userId: ps.userId, roleId: this.config.skebStatus.roleId, error: err });
|
||||||
|
}
|
||||||
throw new ApiError(meta.errors.noSuchUser);
|
throw new ApiError(meta.errors.noSuchUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info('Skeb status response', { url: url.href, userId: ps.userId, status: res.status, statusText: res.statusText, skebStatus: json });
|
logger.info('Skeb status response', { url: url.href, userId: ps.userId, status: res.status, statusText: res.statusText, skebStatus: json });
|
||||||
|
|
||||||
|
try {
|
||||||
if (json.is_acceptable) {
|
if (json.is_acceptable) {
|
||||||
if (!hasSkebRole) await this.roleService.assign(ps.userId, this.config.skebStatus.roleId);
|
if (!hasSkebRole) await this.roleService.assign(ps.userId, this.config.skebStatus.roleId);
|
||||||
} else if (hasSkebRole) {
|
} else if (hasSkebRole) {
|
||||||
await this.roleService.unassign(ps.userId, this.config.skebStatus.roleId);
|
await this.roleService.unassign(ps.userId, this.config.skebStatus.roleId);
|
||||||
}
|
}
|
||||||
|
} catch (err) {
|
||||||
|
logger.error('Failed to assign/unassign role', { userId: ps.userId, roleId: this.config.skebStatus.roleId, error: err });
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
screenName: json.screen_name,
|
screenName: json.screen_name,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"name": "misskey-js",
|
"name": "misskey-js",
|
||||||
"version": "2024.3.1-io.5",
|
"version": "2024.3.1-io.5a",
|
||||||
"description": "Misskey SDK for JavaScript",
|
"description": "Misskey SDK for JavaScript",
|
||||||
"types": "./built/dts/index.d.ts",
|
"types": "./built/dts/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
|
Loading…
Reference in New Issue
Block a user