Fixed compile errors due to the rename of ErrorID to ErrorCode
parent
4557479e09
commit
9b361ea557
|
@ -2,7 +2,7 @@ import * as log from "tc-shared/log";
|
|||
import {LogCategory} from "tc-shared/log";
|
||||
import {AbstractServerConnection, CommandOptions, ServerCommand} from "tc-shared/connection/ConnectionBase";
|
||||
import {Sound} from "tc-shared/sound/Sounds";
|
||||
import {CommandResult, ErrorID} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {createErrorModal, createInfoModal, createInputModal, createModal} from "tc-shared/ui/elements/Modal";
|
||||
import {
|
||||
ClientConnectionInfo,
|
||||
|
@ -23,6 +23,7 @@ import {OutOfViewClient} from "tc-shared/ui/frames/side/PrivateConversationManag
|
|||
import {renderBBCodeAsJQuery} from "tc-shared/text/bbcode";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
import {EventClient, EventType} from "tc-shared/ui/frames/log/Definitions";
|
||||
import {ErrorCode} from "tc-shared/connection/ErrorCode";
|
||||
|
||||
export class ServerConnectionCommandBoss extends AbstractCommandHandlerBoss {
|
||||
constructor(connection: AbstractServerConnection) {
|
||||
|
@ -113,14 +114,14 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
if(ex instanceof CommandResult) {
|
||||
let res = ex;
|
||||
if(!res.success) {
|
||||
if(res.id == ErrorID.SERVER_INSUFFICIENT_PERMISSIONS) { //Permission error
|
||||
if(res.id == ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) { //Permission error
|
||||
const permission = this.connection_handler.permissions.resolveInfo(res.json["failed_permid"] as number);
|
||||
res.message = tr("Insufficient client permissions. Failed on permission ") + (permission ? permission.name : "unknown");
|
||||
this.connection_handler.log.log(EventType.ERROR_PERMISSION, {
|
||||
permission: this.connection_handler.permissions.resolveInfo(res.json["failed_permid"] as number)
|
||||
});
|
||||
this.connection_handler.sound.play(Sound.ERROR_INSUFFICIENT_PERMISSIONS);
|
||||
} else if(res.id != ErrorID.DATABASE_EMPTY_RESULT) {
|
||||
} else if(res.id != ErrorCode.DATABASE_EMPTY_RESULT) {
|
||||
this.connection_handler.log.log(EventType.ERROR_CUSTOM, {
|
||||
message: res.extra_message.length == 0 ? res.message : res.extra_message
|
||||
});
|
||||
|
|
|
@ -4,13 +4,14 @@ import {LogCategory} from "tc-shared/log";
|
|||
import {
|
||||
ClientNameInfo,
|
||||
CommandResult,
|
||||
ErrorID, Playlist, PlaylistInfo, PlaylistSong,
|
||||
Playlist, PlaylistInfo, PlaylistSong,
|
||||
QueryList,
|
||||
QueryListEntry, ServerGroupClient
|
||||
} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {ChannelEntry} from "tc-shared/ui/channel";
|
||||
import {AbstractCommandHandler} from "tc-shared/connection/AbstractCommandHandler";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
import {ErrorCode} from "tc-shared/connection/ErrorCode";
|
||||
|
||||
export class CommandHelper extends AbstractCommandHandler {
|
||||
private _who_am_i: any;
|
||||
|
@ -72,7 +73,7 @@ export class CommandHelper extends AbstractCommandHandler {
|
|||
try {
|
||||
await this.connection.send_command("clientgetnamefromuid", request);
|
||||
} catch(error) {
|
||||
if(error instanceof CommandResult && error.id == ErrorID.EMPTY_RESULT) {
|
||||
if(error instanceof CommandResult && error.id == ErrorCode.DATABASE_EMPTY_RESULT) {
|
||||
/* nothing */
|
||||
} else {
|
||||
throw error;
|
||||
|
@ -120,7 +121,7 @@ export class CommandHelper extends AbstractCommandHandler {
|
|||
try {
|
||||
await this.connection.send_command("clientgetnamefromdbid", request);
|
||||
} catch(error) {
|
||||
if(error instanceof CommandResult && error.id == ErrorID.EMPTY_RESULT) {
|
||||
if(error instanceof CommandResult && error.id == ErrorCode.DATABASE_EMPTY_RESULT) {
|
||||
/* nothing */
|
||||
} else {
|
||||
throw error;
|
||||
|
@ -186,7 +187,7 @@ export class CommandHelper extends AbstractCommandHandler {
|
|||
this.handler_boss.remove_single_handler(single_handler);
|
||||
|
||||
if(error instanceof CommandResult) {
|
||||
if(error.id == ErrorID.EMPTY_RESULT) {
|
||||
if(error.id == ErrorCode.DATABASE_EMPTY_RESULT) {
|
||||
resolve(undefined);
|
||||
return;
|
||||
}
|
||||
|
@ -236,7 +237,7 @@ export class CommandHelper extends AbstractCommandHandler {
|
|||
this.handler_boss.remove_single_handler(single_handler);
|
||||
|
||||
if(error instanceof CommandResult) {
|
||||
if(error.id == ErrorID.EMPTY_RESULT) {
|
||||
if(error.id == ErrorCode.DATABASE_EMPTY_RESULT) {
|
||||
resolve([]);
|
||||
return;
|
||||
}
|
||||
|
@ -301,7 +302,7 @@ export class CommandHelper extends AbstractCommandHandler {
|
|||
this.connection.send_command("playlistsonglist", {playlist_id: playlist_id}, { process_result: process_result }).catch(error => {
|
||||
this.handler_boss.remove_single_handler(single_handler);
|
||||
if(error instanceof CommandResult) {
|
||||
if(error.id == ErrorID.EMPTY_RESULT) {
|
||||
if(error.id == ErrorCode.DATABASE_EMPTY_RESULT) {
|
||||
resolve([]);
|
||||
return;
|
||||
}
|
||||
|
@ -336,7 +337,7 @@ export class CommandHelper extends AbstractCommandHandler {
|
|||
|
||||
this.connection.send_command("playlistclientlist", {playlist_id: playlist_id}).catch(error => {
|
||||
this.handler_boss.remove_single_handler(single_handler);
|
||||
if(error instanceof CommandResult && error.id == ErrorID.EMPTY_RESULT) {
|
||||
if(error instanceof CommandResult && error.id == ErrorCode.DATABASE_EMPTY_RESULT) {
|
||||
resolve([]);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as log from "tc-shared/log";
|
|||
import {LogCategory} from "tc-shared/log";
|
||||
import {ConnectionHandler} from "tc-shared/ConnectionHandler";
|
||||
import {ServerCommand} from "tc-shared/connection/ConnectionBase";
|
||||
import {CommandResult, ErrorCode, ErrorID} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {AbstractCommandHandler} from "tc-shared/connection/AbstractCommandHandler";
|
||||
import {IconManager} from "tc-shared/file/Icons";
|
||||
import {AvatarManager} from "tc-shared/file/LocalAvatars";
|
||||
|
@ -21,6 +21,7 @@ import {
|
|||
} from "tc-shared/file/Transfer";
|
||||
import {Registry} from "tc-shared/events";
|
||||
import {tr, tra} from "tc-shared/i18n/localize";
|
||||
import {ErrorCode} from "tc-shared/connection/ErrorCode";
|
||||
|
||||
export enum FileType {
|
||||
DIRECTORY = 0,
|
||||
|
@ -433,7 +434,7 @@ export class FileManager {
|
|||
}).then(() => {
|
||||
reject(tr("Missing server file list response"));
|
||||
}).catch(error => {
|
||||
if(error instanceof CommandResult && error.id == ErrorID.EMPTY_RESULT) {
|
||||
if(error instanceof CommandResult && error.id == ErrorCode.DATABASE_EMPTY_RESULT) {
|
||||
resolve([]);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as log from "tc-shared/log";
|
|||
import {LogCategory} from "tc-shared/log";
|
||||
import {Registry} from "tc-shared/events";
|
||||
import {format_time} from "tc-shared/ui/frames/chat";
|
||||
import {CommandResult, ErrorID} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {image_type, ImageCache, ImageType, media_image_type} from "tc-shared/file/ImageCache";
|
||||
import {FileInfo, FileManager} from "tc-shared/file/FileManager";
|
||||
import {
|
||||
|
@ -12,6 +12,7 @@ import {
|
|||
} from "tc-shared/file/Transfer";
|
||||
import {server_connections} from "tc-shared/ui/frames/connection_handlers";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
import {ErrorCode} from "tc-shared/connection/ErrorCode";
|
||||
|
||||
const icon_cache: ImageCache = new ImageCache("icons");
|
||||
export interface IconManagerEvents {
|
||||
|
@ -294,9 +295,9 @@ export class IconManager {
|
|||
}
|
||||
} catch(error) {
|
||||
if(error instanceof CommandResult) {
|
||||
if(error.id === ErrorID.FILE_NOT_FOUND)
|
||||
if(error.id === ErrorCode.FILE_NOT_FOUND)
|
||||
throw tr("Icon could not be found");
|
||||
else if(error.id === ErrorID.PERMISSION_ERROR)
|
||||
else if(error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS)
|
||||
throw tr("No permissions to download icon");
|
||||
else
|
||||
throw error.extra_message || error.message;
|
||||
|
|
|
@ -13,7 +13,7 @@ import {
|
|||
TransferProvider,
|
||||
TransferTargetType
|
||||
} from "tc-shared/file/Transfer";
|
||||
import {CommandResult, ErrorID} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {server_connections} from "tc-shared/ui/frames/connection_handlers";
|
||||
import {ClientEntry} from "tc-shared/ui/client";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
@ -29,6 +29,7 @@ import {
|
|||
} from "tc-shared/file/Avatars";
|
||||
import {IPCChannel} from "tc-shared/ipc/BrowserIPC";
|
||||
import {ConnectionHandler} from "tc-shared/ConnectionHandler";
|
||||
import {ErrorCode} from "tc-shared/connection/ErrorCode";
|
||||
|
||||
/* FIXME: Retry avatar download after some time! */
|
||||
|
||||
|
@ -127,7 +128,7 @@ export class AvatarManager extends AbstractAvatarManager {
|
|||
if(typeof error === "object" && 'error' in error && error.error === "initialize") {
|
||||
const commandResult = error.commandResult;
|
||||
if(commandResult instanceof CommandResult) {
|
||||
if(commandResult.id === ErrorID.FILE_NOT_FOUND) {
|
||||
if(commandResult.id === ErrorCode.FILE_NOT_FOUND) {
|
||||
if(avatar.getAvatarHash() !== initialAvatarHash) {
|
||||
log.debug(LogCategory.GENERAL, tr("Ignoring avatar not found since the avatar itself got updated. Out version: %s, current version: %s"), initialAvatarHash, avatar.getAvatarHash());
|
||||
return;
|
||||
|
@ -135,7 +136,7 @@ export class AvatarManager extends AbstractAvatarManager {
|
|||
|
||||
avatar.setUnset();
|
||||
return;
|
||||
} else if(commandResult.id === ErrorID.PERMISSION_ERROR) {
|
||||
} else if(commandResult.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) {
|
||||
throw tr("No permissions to download the avatar");
|
||||
} else {
|
||||
throw commandResult.message + (commandResult.extra_message ? " (" + commandResult.extra_message + ")" : "");
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {Registry} from "tc-shared/events";
|
||||
import {CommandResult, ErrorCode} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
import {ErrorCode} from "tc-shared/connection/ErrorCode";
|
||||
|
||||
/* Transfer source types */
|
||||
export enum TransferSourceType {
|
||||
|
|
|
@ -3,11 +3,12 @@ import {LogCategory, LogType} from "tc-shared/log";
|
|||
import {PermissionType} from "tc-shared/permission/PermissionType";
|
||||
import {LaterPromise} from "tc-shared/utils/LaterPromise";
|
||||
import {ServerCommand} from "tc-shared/connection/ConnectionBase";
|
||||
import {CommandResult, ErrorID} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {ConnectionHandler} from "tc-shared/ConnectionHandler";
|
||||
import {AbstractCommandHandler} from "tc-shared/connection/AbstractCommandHandler";
|
||||
import {Registry} from "tc-shared/events";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
import {ErrorCode} from "tc-shared/connection/ErrorCode";
|
||||
|
||||
export class PermissionInfo {
|
||||
name: string;
|
||||
|
@ -446,7 +447,7 @@ export class PermissionManager extends AbstractCommandHandler {
|
|||
|
||||
private execute_channel_permission_request(request: PermissionRequestKeys) {
|
||||
this.handle.serverConnection.send_command("channelpermlist", {"cid": request.channel_id}).catch(error => {
|
||||
if(error instanceof CommandResult && error.id == ErrorID.EMPTY_RESULT)
|
||||
if(error instanceof CommandResult && error.id == ErrorCode.DATABASE_EMPTY_RESULT)
|
||||
this.fullfill_permission_request("requests_channel_permissions", request, "success", []);
|
||||
else
|
||||
this.fullfill_permission_request("requests_channel_permissions", request, "error", error);
|
||||
|
@ -470,7 +471,7 @@ export class PermissionManager extends AbstractCommandHandler {
|
|||
|
||||
private execute_client_permission_request(request: PermissionRequestKeys) {
|
||||
this.handle.serverConnection.send_command("clientpermlist", {cldbid: request.client_id}).catch(error => {
|
||||
if(error instanceof CommandResult && error.id == ErrorID.EMPTY_RESULT)
|
||||
if(error instanceof CommandResult && error.id == ErrorCode.DATABASE_EMPTY_RESULT)
|
||||
this.fullfill_permission_request("requests_client_permissions", request, "success", []);
|
||||
else
|
||||
this.fullfill_permission_request("requests_client_permissions", request, "error", error);
|
||||
|
@ -498,7 +499,7 @@ export class PermissionManager extends AbstractCommandHandler {
|
|||
private execute_client_channel_permission_request(request: PermissionRequestKeys) {
|
||||
this.handle.serverConnection.send_command("channelclientpermlist", {cldbid: request.client_id, cid: request.channel_id})
|
||||
.catch(error => {
|
||||
if(error instanceof CommandResult && error.id == ErrorID.EMPTY_RESULT)
|
||||
if(error instanceof CommandResult && error.id == ErrorCode.DATABASE_EMPTY_RESULT)
|
||||
this.fullfill_permission_request("requests_client_channel_permissions", request, "success", []);
|
||||
else
|
||||
this.fullfill_permission_request("requests_client_channel_permissions", request, "error", error);
|
||||
|
@ -525,7 +526,7 @@ export class PermissionManager extends AbstractCommandHandler {
|
|||
private execute_playlist_permission_request(request: PermissionRequestKeys) {
|
||||
this.handle.serverConnection.send_command("playlistpermlist", {playlist_id: request.playlist_id})
|
||||
.catch(error => {
|
||||
if(error instanceof CommandResult && error.id == ErrorID.EMPTY_RESULT)
|
||||
if(error instanceof CommandResult && error.id == ErrorCode.DATABASE_EMPTY_RESULT)
|
||||
this.fullfill_permission_request("requests_playlist_permissions", request, "success", []);
|
||||
else
|
||||
this.fullfill_permission_request("requests_playlist_permissions", request, "error", error);
|
||||
|
@ -553,7 +554,7 @@ export class PermissionManager extends AbstractCommandHandler {
|
|||
private execute_playlist_client_permission_request(request: PermissionRequestKeys) {
|
||||
this.handle.serverConnection.send_command("playlistclientpermlist", {playlist_id: request.playlist_id, cldbid: request.client_id})
|
||||
.catch(error => {
|
||||
if(error instanceof CommandResult && error.id == ErrorID.EMPTY_RESULT)
|
||||
if(error instanceof CommandResult && error.id == ErrorCode.DATABASE_EMPTY_RESULT)
|
||||
this.fullfill_permission_request("requests_playlist_client_permissions", request, "success", []);
|
||||
else
|
||||
this.fullfill_permission_request("requests_playlist_client_permissions", request, "error", error);
|
||||
|
@ -675,7 +676,7 @@ export class PermissionManager extends AbstractCommandHandler {
|
|||
this.connection.send_command("permfind", permission_ids.map(e => { return {permid: e }})).catch(error => {
|
||||
this.handler_boss.remove_single_handler(single_handler);
|
||||
|
||||
if(error instanceof CommandResult && error.id == ErrorID.EMPTY_RESULT) {
|
||||
if(error instanceof CommandResult && error.id == ErrorCode.DATABASE_EMPTY_RESULT) {
|
||||
resolve([]);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -7,10 +7,11 @@ import {
|
|||
import {ConnectionHandler} from "tc-shared/ConnectionHandler";
|
||||
import {EventHandler, Registry} from "tc-shared/events";
|
||||
import {preprocessChatMessageForSend} from "tc-shared/text/chat";
|
||||
import {CommandResult, ErrorID} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import * as log from "tc-shared/log";
|
||||
import {LogCategory} from "tc-shared/log";
|
||||
import {tra} from "tc-shared/i18n/localize";
|
||||
import {ErrorCode} from "tc-shared/connection/ErrorCode";
|
||||
|
||||
export const kMaxChatFrameMessageSize = 50; /* max 100 messages, since the server does not support more than 100 messages queried at once */
|
||||
|
||||
|
@ -172,7 +173,7 @@ export abstract class AbstractChat<Events extends ConversationUIEvents> {
|
|||
msg: msg
|
||||
}, { process_result: false }).then(async () => true).catch(error => {
|
||||
if(error instanceof CommandResult) {
|
||||
if(error.id === ErrorID.PERMISSION_ERROR) {
|
||||
if(error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) {
|
||||
this.registerChatEvent({
|
||||
type: "message-failed",
|
||||
uniqueId: "msf-" + this.chatId + "-" + Date.now(),
|
||||
|
|
|
@ -3,7 +3,7 @@ import {ConnectionHandler, ConnectionState} from "tc-shared/ConnectionHandler";
|
|||
import {EventHandler, Registry} from "tc-shared/events";
|
||||
import * as log from "tc-shared/log";
|
||||
import {LogCategory} from "tc-shared/log";
|
||||
import {CommandResult, ErrorID} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {ServerCommand} from "tc-shared/connection/ConnectionBase";
|
||||
import {Settings} from "tc-shared/settings";
|
||||
import {traj} from "tc-shared/i18n/localize";
|
||||
|
@ -15,6 +15,7 @@ import {
|
|||
} from "tc-shared/ui/frames/side/ConversationDefinitions";
|
||||
import {ConversationPanel} from "tc-shared/ui/frames/side/ConversationUI";
|
||||
import {AbstractChat, AbstractChatManager, kMaxChatFrameMessageSize} from "./AbstractConversion";
|
||||
import {ErrorCode} from "tc-shared/connection/ErrorCode";
|
||||
|
||||
const kSuccessQueryThrottle = 5 * 1000;
|
||||
const kErrorQueryThrottle = 30 * 1000;
|
||||
|
@ -69,7 +70,7 @@ export class Conversation extends AbstractChat<ConversationUIEvents> {
|
|||
}).catch(error => {
|
||||
let errorMessage;
|
||||
if(error instanceof CommandResult) {
|
||||
if(error.id === ErrorID.CONVERSATION_MORE_DATA || error.id === ErrorID.EMPTY_RESULT) {
|
||||
if(error.id === ErrorCode.CONVERSATION_MORE_DATA || error.id === ErrorCode.DATABASE_EMPTY_RESULT) {
|
||||
resolve({ status: "success", events: this.historyQueryResponse.map(e => {
|
||||
return {
|
||||
type: "message",
|
||||
|
@ -78,22 +79,22 @@ export class Conversation extends AbstractChat<ConversationUIEvents> {
|
|||
uniqueId: "cm-" + this.conversationId + "-" + e.timestamp + "-" + Date.now(),
|
||||
isOwnMessage: false
|
||||
}
|
||||
}), moreEvents: error.id === ErrorID.CONVERSATION_MORE_DATA, nextAllowedQuery: Date.now() + kSuccessQueryThrottle });
|
||||
}), moreEvents: error.id === ErrorCode.CONVERSATION_MORE_DATA, nextAllowedQuery: Date.now() + kSuccessQueryThrottle });
|
||||
return;
|
||||
} else if(error.id === ErrorID.PERMISSION_ERROR) {
|
||||
} else if(error.id === ErrorCode.PERMISSION_ERROR) {
|
||||
resolve({
|
||||
status: "no-permission",
|
||||
failedPermission: this.handle.connection.permissions.resolveInfo(parseInt(error.json["failed_permid"]))?.name || tr("unknwon"),
|
||||
nextAllowedQuery: Date.now() + kErrorQueryThrottle
|
||||
});
|
||||
return;
|
||||
} else if(error.id === ErrorID.CONVERSATION_IS_PRIVATE) {
|
||||
} else if(error.id === ErrorCode.CONVERSATION_IS_PRIVATE) {
|
||||
resolve({
|
||||
status: "private",
|
||||
nextAllowedQuery: Date.now() + kErrorQueryThrottle
|
||||
});
|
||||
return;
|
||||
} else if(error.id === ErrorID.COMMAND_NOT_FOUND) {
|
||||
} else if(error.id === ErrorCode.COMMAND_NOT_FOUND) {
|
||||
resolve({
|
||||
status: "unsupported",
|
||||
nextAllowedQuery: Date.now() + kErrorQueryThrottle
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
import {Frame, FrameContent} from "tc-shared/ui/frames/chat_frame";
|
||||
import {ClientEvents, MusicClientEntry, SongInfo} from "tc-shared/ui/client";
|
||||
import {LogCategory} from "tc-shared/log";
|
||||
import {CommandResult, ErrorID, PlaylistSong} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {CommandResult, PlaylistSong} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {createErrorModal, createInputModal} from "tc-shared/ui/elements/Modal";
|
||||
import * as log from "tc-shared/log";
|
||||
import * as image_preview from "../image_preview";
|
||||
import {Registry} from "tc-shared/events";
|
||||
import {PlayerState} from "tc-shared/connection/VoiceConnection";
|
||||
import {ErrorCode} from "tc-shared/connection/ErrorCode";
|
||||
|
||||
export interface MusicSidebarEvents {
|
||||
"open": {}, /* triggers when frame should be shown */
|
||||
|
@ -426,7 +427,7 @@ export class MusicInfo {
|
|||
units: event.units
|
||||
};
|
||||
this.handle.handle.serverConnection.send_command("musicbotplayeraction", data).catch(error => {
|
||||
if(error instanceof CommandResult && error.id === ErrorID.PERMISSION_ERROR) return;
|
||||
if(error instanceof CommandResult && error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) return;
|
||||
|
||||
log.error(LogCategory.CLIENT, tr("Failed to perform action %s on bot: %o"), event.type, error);
|
||||
//TODO: Better error dialog
|
||||
|
@ -445,7 +446,7 @@ export class MusicInfo {
|
|||
playlist_id: this._current_bot.properties.client_playlist_id,
|
||||
song_id: event.song_id
|
||||
}).catch(error => {
|
||||
if(error instanceof CommandResult && error.id === ErrorID.PERMISSION_ERROR) return;
|
||||
if(error instanceof CommandResult && error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) return;
|
||||
|
||||
log.error(LogCategory.CLIENT, tr("Failed to set current song on bot: %o"), event.type, error);
|
||||
//TODO: Better error dialog
|
||||
|
@ -471,7 +472,7 @@ export class MusicInfo {
|
|||
playlist_id: this._current_bot.properties.client_playlist_id,
|
||||
url: result
|
||||
}).catch(error => {
|
||||
if(error instanceof CommandResult && error.id === ErrorID.PERMISSION_ERROR) return;
|
||||
if(error instanceof CommandResult && error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) return;
|
||||
|
||||
log.error(LogCategory.CLIENT, tr("Failed to add song to bot playlist: %o"), error);
|
||||
|
||||
|
@ -491,7 +492,7 @@ export class MusicInfo {
|
|||
playlist_id: this._current_bot.properties.client_playlist_id,
|
||||
song_id: event.song_id
|
||||
}).catch(error => {
|
||||
if(error instanceof CommandResult && error.id === ErrorID.PERMISSION_ERROR) return;
|
||||
if(error instanceof CommandResult && error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) return;
|
||||
|
||||
log.error(LogCategory.CLIENT, tr("Failed to delete song from bot playlist: %o"), error);
|
||||
|
||||
|
@ -688,7 +689,7 @@ export class MusicInfo {
|
|||
song_id: data.song_id,
|
||||
song_previous_song_id: data.previous_entry
|
||||
}).catch(error => {
|
||||
if(error instanceof CommandResult && error.id === ErrorID.PERMISSION_ERROR) return;
|
||||
if(error instanceof CommandResult && error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) return;
|
||||
|
||||
log.error(LogCategory.CLIENT, tr("Failed to add song to bot playlist: %o"), error);
|
||||
|
||||
|
@ -796,7 +797,7 @@ export class MusicInfo {
|
|||
for(const song of this.sort_songs(songs))
|
||||
this.events.fire("playlist_song_add", { song: song, insert_effect: false });
|
||||
}).catch(error => {
|
||||
if(error instanceof CommandResult && error.id === ErrorID.PERMISSION_ERROR) {
|
||||
if(error instanceof CommandResult && error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) {
|
||||
this._container_playlist.find(".overlay-no-permissions").removeClass("hidden");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {ConnectionHandler} from "tc-shared/ConnectionHandler";
|
||||
import {createErrorModal, createInfoModal, createModal, Modal} from "tc-shared/ui/elements/Modal";
|
||||
import {SingleCommandHandler} from "tc-shared/connection/ConnectionBase";
|
||||
import {CommandResult, ErrorID} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import PermissionType from "tc-shared/permission/PermissionType";
|
||||
import {LogCategory} from "tc-shared/log";
|
||||
import * as log from "tc-shared/log";
|
||||
|
@ -9,6 +9,7 @@ import * as tooltip from "tc-shared/ui/elements/Tooltip";
|
|||
import * as htmltags from "tc-shared/ui/htmltags";
|
||||
import {format_time, formatMessage} from "tc-shared/ui/frames/chat";
|
||||
import * as moment from "moment";
|
||||
import {ErrorCode} from "tc-shared/connection/ErrorCode";
|
||||
|
||||
export function openBanList(client: ConnectionHandler) {
|
||||
let modal: Modal;
|
||||
|
@ -90,7 +91,7 @@ export function openBanList(client: ConnectionHandler) {
|
|||
}),
|
||||
client.serverConnection.send_command("banlist").catch(async error => {
|
||||
if(error instanceof CommandResult)
|
||||
if(error.id === ErrorID.EMPTY_RESULT)
|
||||
if(error.id === ErrorCode.DATABASE_EMPTY_RESULT)
|
||||
return;
|
||||
throw error;
|
||||
})
|
||||
|
@ -121,7 +122,7 @@ export function openBanList(client: ConnectionHandler) {
|
|||
data["sid"] = ban.server_id;
|
||||
client.serverConnection.send_command("bantriggerlist", data).catch(async error => {
|
||||
if(error instanceof CommandResult)
|
||||
if(error.id === ErrorID.EMPTY_RESULT)
|
||||
if(error.id === ErrorCode.DATABASE_EMPTY_RESULT)
|
||||
return;
|
||||
throw error;
|
||||
}).then(() => {
|
||||
|
@ -397,7 +398,7 @@ function generate_dom(controller: BanListController) : JQuery {
|
|||
}).catch(error => {
|
||||
log.error(LogCategory.CLIENT, tr("Failed to delete ban: %o"), error);
|
||||
if(error instanceof CommandResult)
|
||||
error = error.id === ErrorID.PERMISSION_ERROR ? "no permissions" : error.extra_message || error.message;
|
||||
error = error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS ? "no permissions" : error.extra_message || error.message;
|
||||
createErrorModal(tr("Failed to delete ban"), formatMessage(tr("Failed to delete ban. {:br:}Error: {}"), error)).open();
|
||||
});
|
||||
});
|
||||
|
@ -454,7 +455,7 @@ function generate_dom(controller: BanListController) : JQuery {
|
|||
}).catch(error => {
|
||||
log.info(LogCategory.CLIENT, tr("Failed to update ban list: %o"), error);
|
||||
if(error instanceof CommandResult)
|
||||
error = error.id === ErrorID.PERMISSION_ERROR ? tr("no permissions") : error.extra_message || error.message;
|
||||
error = error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS ? tr("no permissions") : error.extra_message || error.message;
|
||||
container_ban_entries_error.show().find("a").text(tr("Failed to receive banlist: ") + error);
|
||||
container_ban_entries_empty.hide();
|
||||
});
|
||||
|
@ -532,7 +533,7 @@ function generate_dom(controller: BanListController) : JQuery {
|
|||
}).catch(error => {
|
||||
log.info(LogCategory.CLIENT, tr("Failed to update trigger list: %o"), error);
|
||||
if(error instanceof CommandResult)
|
||||
error = error.id === ErrorID.PERMISSION_ERROR ? tr("no permissions") : error.extra_message || error.message;
|
||||
error = error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS ? tr("no permissions") : error.extra_message || error.message;
|
||||
container_trigger_entries_error.show().find("a").text(tr("Failed to receive trigger list: ") + error);
|
||||
container_trigger_entries_empty.hide();
|
||||
});
|
||||
|
@ -788,7 +789,7 @@ function generate_dom(controller: BanListController) : JQuery {
|
|||
}).catch(error => {
|
||||
log.error(LogCategory.CLIENT, tr("Failed to edited ban: %o"), error);
|
||||
if(error instanceof CommandResult)
|
||||
error = error.id === ErrorID.PERMISSION_ERROR ? "no permissions" : error.extra_message || error.message;
|
||||
error = error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS ? "no permissions" : error.extra_message || error.message;
|
||||
createErrorModal(tr("Failed to edited ban"), formatMessage(tr("Failed to edited ban. {:br:}Error: {}"), error)).open();
|
||||
});
|
||||
});
|
||||
|
@ -856,7 +857,7 @@ function generate_dom(controller: BanListController) : JQuery {
|
|||
}).catch(error => {
|
||||
log.error(LogCategory.CLIENT, tr("Failed to add ban: %o"), error);
|
||||
if(error instanceof CommandResult)
|
||||
error = error.id === ErrorID.PERMISSION_ERROR ? "no permissions" : error.extra_message || error.message;
|
||||
error = error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS ? "no permissions" : error.extra_message || error.message;
|
||||
createErrorModal(tr("Failed to add ban"), formatMessage(tr("Failed to add ban. {:br:}Error: {}"), error)).open();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -8,10 +8,11 @@ import {GroupType} from "tc-shared/permission/GroupManager";
|
|||
import {Translatable} from "tc-shared/ui/react-elements/i18n";
|
||||
import {Button} from "tc-shared/ui/react-elements/Button";
|
||||
import PermissionType from "tc-shared/permission/PermissionType";
|
||||
import {CommandResult, ErrorID} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {createErrorModal, createInfoModal} from "tc-shared/ui/elements/Modal";
|
||||
import {tra} from "tc-shared/i18n/localize";
|
||||
import {InternalModal} from "tc-shared/ui/react-elements/internal-modal/Controller";
|
||||
import {ErrorCode} from "tc-shared/connection/ErrorCode";
|
||||
|
||||
const cssStyle = require("./ModalGroupCreate.scss");
|
||||
|
||||
|
@ -288,7 +289,7 @@ export function spawnGroupCreate(connection: ConnectionHandler, target: "server"
|
|||
|
||||
const stringifyError = error => {
|
||||
if(error instanceof CommandResult) {
|
||||
if(error.id === ErrorID.PERMISSION_ERROR)
|
||||
if(error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS)
|
||||
return tr("insufficient permissions");
|
||||
else
|
||||
return error.message + (error.extra_message ? " (" + error.extra_message + ")" : "");
|
||||
|
@ -341,7 +342,7 @@ function initializeGroupCreateController(connection: ConnectionHandler, events:
|
|||
promise.then(() => {
|
||||
createInfoModal(tr("Group has been created"), tr("The group has been successfully created.")).open();
|
||||
}).catch(error => {
|
||||
if(error instanceof CommandResult && error.id === ErrorID.PERMISSION_ERROR) {
|
||||
if(error instanceof CommandResult && error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) {
|
||||
createErrorModal(tr("Failed to create group"),
|
||||
tra("Failed to create group.\nMissing permission {}", connection.permissions.resolveInfo(parseInt(error.json["failed_permid"]))?.name || tr("unknwon"))).open();
|
||||
return;
|
||||
|
|
|
@ -8,10 +8,11 @@ import * as React from "react";
|
|||
import {Button} from "tc-shared/ui/react-elements/Button";
|
||||
import {GroupType} from "tc-shared/permission/GroupManager";
|
||||
import PermissionType from "tc-shared/permission/PermissionType";
|
||||
import {CommandResult, ErrorID} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {createErrorModal, createInfoModal} from "tc-shared/ui/elements/Modal";
|
||||
import {tra} from "tc-shared/i18n/localize";
|
||||
import {InternalModal} from "tc-shared/ui/react-elements/internal-modal/Controller";
|
||||
import {ErrorCode} from "tc-shared/connection/ErrorCode";
|
||||
|
||||
const cssStyle = require("./ModalGroupPermissionCopy.scss");
|
||||
|
||||
|
@ -174,7 +175,7 @@ export function spawnModalGroupPermissionCopy(connection: ConnectionHandler, tar
|
|||
|
||||
const stringifyError = error => {
|
||||
if(error instanceof CommandResult) {
|
||||
if(error.id === ErrorID.PERMISSION_ERROR)
|
||||
if(error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS)
|
||||
return tr("insufficient permissions");
|
||||
else
|
||||
return error.message + (error.extra_message ? " (" + error.extra_message + ")" : "");
|
||||
|
@ -215,7 +216,7 @@ function initializeGroupPermissionCopyController(connection: ConnectionHandler,
|
|||
}).then(() => {
|
||||
createInfoModal(tr("Group permissions have been copied"), tr("The group permissions have been successfully copied.")).open();
|
||||
}).catch(error => {
|
||||
if(error instanceof CommandResult && error.id === ErrorID.PERMISSION_ERROR) {
|
||||
if(error instanceof CommandResult && error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) {
|
||||
createErrorModal(tr("Failed to copy group permissions"),
|
||||
tra("Failed to copy group permissions.\nMissing permission {}", connection.permissions.resolveInfo(parseInt(error.json["failed_permid"]))?.name || tr("unknwon"))).open();
|
||||
return;
|
||||
|
|
|
@ -3,13 +3,13 @@ import PermissionType from "tc-shared/permission/PermissionType";
|
|||
import {createErrorModal, createModal} from "tc-shared/ui/elements/Modal";
|
||||
import * as log from "tc-shared/log";
|
||||
import {LogCategory} from "tc-shared/log";
|
||||
import {CommandResult, ErrorID} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {tra, traj} from "tc-shared/i18n/localize";
|
||||
import {arrayBufferBase64} from "tc-shared/utils/buffers";
|
||||
import {Settings, settings} from "tc-shared/settings";
|
||||
import * as crc32 from "tc-shared/crypto/crc32";
|
||||
import {FileInfo} from "tc-shared/file/FileManager";
|
||||
import {FileTransferState, TransferProvider} from "tc-shared/file/Transfer";
|
||||
import {ErrorCode} from "tc-shared/connection/ErrorCode";
|
||||
|
||||
export function spawnIconSelect(client: ConnectionHandler, callback_icon?: (id: number) => any, selected_icon?: number) {
|
||||
selected_icon = selected_icon || 0;
|
||||
|
@ -138,7 +138,7 @@ export function spawnIconSelect(client: ConnectionHandler, callback_icon?: (id:
|
|||
container_loading.hide();
|
||||
container_no_permissions.hide();
|
||||
}).catch(error => {
|
||||
if(error instanceof CommandResult && error.id == ErrorID.PERMISSION_ERROR) {
|
||||
if(error instanceof CommandResult && error.id == ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) {
|
||||
container_no_permissions.show();
|
||||
} else {
|
||||
log.error(LogCategory.GENERAL, tr("Failed to fetch icon list. Error: %o"), error);
|
||||
|
@ -161,7 +161,7 @@ export function spawnIconSelect(client: ConnectionHandler, callback_icon?: (id:
|
|||
client.fileManager.icons.delete_icon(selected_icon).then(() => {
|
||||
selected.detach();
|
||||
}).catch(error => {
|
||||
if(error instanceof CommandResult && error.id == ErrorID.PERMISSION_ERROR)
|
||||
if(error instanceof CommandResult && error.id == ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS)
|
||||
return;
|
||||
console.warn(tr("Failed to delete icon %d: %o"), selected_icon, error);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import {createErrorModal, createModal} from "tc-shared/ui/elements/Modal";
|
|||
import {ConnectionHandler} from "tc-shared/ConnectionHandler";
|
||||
import {MusicClientEntry} from "tc-shared/ui/client";
|
||||
import {Registry} from "tc-shared/events";
|
||||
import {CommandResult, ErrorID} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {LogCategory} from "tc-shared/log";
|
||||
import * as log from "tc-shared/log";
|
||||
import {tra} from "tc-shared/i18n/localize";
|
||||
|
@ -12,6 +12,7 @@ import * as i18nc from "tc-shared/i18n/country";
|
|||
import {find} from "tc-shared/permission/PermissionManager";
|
||||
import ServerGroup = find.ServerGroup;
|
||||
import * as htmltags from "tc-shared/ui/htmltags";
|
||||
import {ErrorCode} from "tc-shared/connection/ErrorCode";
|
||||
|
||||
export function openMusicManage(client: ConnectionHandler, bot: MusicClientEntry) {
|
||||
const ev_registry = new Registry<modal.music_manage>();
|
||||
|
@ -40,7 +41,7 @@ export function openMusicManage(client: ConnectionHandler, bot: MusicClientEntry
|
|||
function permission_controller(event_registry: Registry<modal.music_manage>, bot: MusicClientEntry, client: ConnectionHandler) {
|
||||
const error_msg = error => {
|
||||
if(error instanceof CommandResult) {
|
||||
if(error.id === ErrorID.PERMISSION_ERROR) {
|
||||
if(error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) {
|
||||
const permission = client.permissions.resolveInfo(error.json["failed_permid"]);
|
||||
return tr("failed on permission ") + (permission ? permission.name : tr("unknown"));
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ export function spawnQueryManage(client: ConnectionHandler) {
|
|||
|
||||
//tmpl_query_manager
|
||||
import {createErrorModal, createInfoModal, createInputModal, createModal, Modal} from "tc-shared/ui/elements/Modal";
|
||||
import {CommandResult, ErrorID, QueryListEntry} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {CommandResult, QueryListEntry} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {SingleCommandHandler} from "tc-shared/connection/ConnectionBase";
|
||||
import {copy_to_clipboard} from "tc-shared/utils/helpers";
|
||||
import {spawnYesNo} from "tc-shared/ui/modal/ModalYesNo";
|
||||
|
@ -168,6 +168,7 @@ import {ConnectionHandler} from "tc-shared/ConnectionHandler";
|
|||
import * as log from "tc-shared/log";
|
||||
import {spawnQueryCreate, spawnQueryCreated} from "tc-shared/ui/modal/ModalQuery";
|
||||
import {formatMessage} from "tc-shared/ui/frames/chat";
|
||||
import {ErrorCode} from "tc-shared/connection/ErrorCode";
|
||||
|
||||
export function spawnQueryManage(client: ConnectionHandler) {
|
||||
let modal: Modal;
|
||||
|
@ -259,7 +260,7 @@ export function spawnQueryManage(client: ConnectionHandler) {
|
|||
button_update.prop('disabled', false);
|
||||
}).catch(error => {
|
||||
button_update.prop('disabled', false);
|
||||
if(error instanceof CommandResult && error.id === ErrorID.PERMISSION_ERROR) {
|
||||
if(error instanceof CommandResult && error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) {
|
||||
set_error(tr("No permissions"));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import {
|
|||
ServerBandwidthInfoUpdateCallback
|
||||
} from "tc-shared/ui/modal/ModalServerInfoBandwidth";
|
||||
import {ServerEntry} from "tc-shared/ui/server";
|
||||
import {CommandResult, ErrorID} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {createErrorModal, createModal, Modal} from "tc-shared/ui/elements/Modal";
|
||||
import {LogCategory} from "tc-shared/log";
|
||||
import * as log from "tc-shared/log";
|
||||
|
@ -13,6 +13,7 @@ import * as i18nc from "tc-shared/i18n/country";
|
|||
import {format_time, formatMessage} from "tc-shared/ui/frames/chat";
|
||||
import {Hostbanner} from "tc-shared/ui/frames/hostbanner";
|
||||
import * as moment from "moment";
|
||||
import {ErrorCode} from "tc-shared/connection/ErrorCode";
|
||||
|
||||
export function openServerInfo(server: ServerEntry) {
|
||||
let modal: Modal;
|
||||
|
@ -58,7 +59,7 @@ export function openServerInfo(server: ServerEntry) {
|
|||
|
||||
const updater = setInterval(() => {
|
||||
server.request_connection_info().then(info => update_callbacks.forEach(e => e(RequestInfoStatus.SUCCESS, info))).catch(error => {
|
||||
if(error instanceof CommandResult && error.id == ErrorID.PERMISSION_ERROR) {
|
||||
if(error instanceof CommandResult && error.id == ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) {
|
||||
update_callbacks.forEach(e => e(RequestInfoStatus.NO_PERMISSION));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import {ServerConnectionInfo, ServerEntry} from "tc-shared/ui/server";
|
||||
import {createModal, Modal} from "tc-shared/ui/elements/Modal";
|
||||
import {CommandResult, ErrorID} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {Graph} from "tc-shared/ui/elements/NetGraph";
|
||||
import * as tooltip from "tc-shared/ui/elements/Tooltip";
|
||||
import {network} from "tc-shared/ui/frames/chat";
|
||||
import {ErrorCode} from "tc-shared/connection/ErrorCode";
|
||||
|
||||
export enum RequestInfoStatus {
|
||||
SUCCESS,
|
||||
|
@ -36,7 +37,7 @@ export function openServerInfoBandwidth(server: ServerEntry, update_callbacks?:
|
|||
if(own_callbacks) {
|
||||
const updater = setInterval(() => {
|
||||
server.request_connection_info().then(info => update_callbacks.forEach(e => e(RequestInfoStatus.SUCCESS, info))).catch(error => {
|
||||
if(error instanceof CommandResult && error.id == ErrorID.PERMISSION_ERROR) {
|
||||
if(error instanceof CommandResult && error.id == ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) {
|
||||
update_callbacks.forEach(e => e(RequestInfoStatus.NO_PERMISSION));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import {
|
|||
import {SideBar} from "tc-shared/ui/modal/permission/TabHandler";
|
||||
import {Group, GroupTarget, GroupType} from "tc-shared/permission/GroupManager";
|
||||
import {createErrorModal, createInfoModal} from "tc-shared/ui/elements/Modal";
|
||||
import {ClientNameInfo, CommandResult, ErrorID} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {ClientNameInfo, CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {formatMessage} from "tc-shared/ui/frames/chat";
|
||||
import {spawnYesNo} from "tc-shared/ui/modal/ModalYesNo";
|
||||
import {tra} from "tc-shared/i18n/localize";
|
||||
|
@ -32,6 +32,7 @@ import {
|
|||
import {spawnGroupCreate} from "tc-shared/ui/modal/ModalGroupCreate";
|
||||
import {spawnModalGroupPermissionCopy} from "tc-shared/ui/modal/ModalGroupPermissionCopy";
|
||||
import {InternalModal} from "tc-shared/ui/react-elements/internal-modal/Controller";
|
||||
import {ErrorCode} from "tc-shared/connection/ErrorCode";
|
||||
|
||||
const cssStyle = require("./ModalPermissionEditor.scss");
|
||||
|
||||
|
@ -387,7 +388,7 @@ function initializePermissionModalResultHandlers(events: Registry<PermissionModa
|
|||
|
||||
const stringifyError = error => {
|
||||
if(error instanceof CommandResult) {
|
||||
if(error.id === ErrorID.PERMISSION_ERROR)
|
||||
if(error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS)
|
||||
return tr("insufficient permissions");
|
||||
else
|
||||
return error.message + (error.extra_message ? " (" + error.extra_message + ")" : "");
|
||||
|
@ -598,7 +599,7 @@ function initializePermissionModalController(connection: ConnectionHandler, even
|
|||
};
|
||||
})});
|
||||
}).catch(error => {
|
||||
if(error instanceof CommandResult && error.id === ErrorID.PERMISSION_ERROR) {
|
||||
if(error instanceof CommandResult && error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) {
|
||||
events.fire("query_group_clients_result", { id: event.id, status: "no-permissions" });
|
||||
return;
|
||||
}
|
||||
|
@ -620,7 +621,7 @@ function initializePermissionModalController(connection: ConnectionHandler, even
|
|||
})).then(() => {
|
||||
events.fire("action_server_group_add_client_result", { id: event.id, client: event.client, status: "success" });
|
||||
}).catch(error => {
|
||||
if(error instanceof CommandResult && error.id === ErrorID.PERMISSION_ERROR) {
|
||||
if(error instanceof CommandResult && error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) {
|
||||
events.fire("action_server_group_add_client_result", { id: event.id, client: event.client, status: "no-permissions" });
|
||||
return;
|
||||
}
|
||||
|
@ -898,7 +899,7 @@ function initializePermissionEditor(connection: ConnectionHandler, modalEvents:
|
|||
}})
|
||||
});
|
||||
}).catch(error => {
|
||||
if(error instanceof CommandResult && error.id === ErrorID.PERMISSION_ERROR) {
|
||||
if(error instanceof CommandResult && error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) {
|
||||
events.fire("action_set_mode", { mode: "no-permissions", failedPermission: connection.permissions.resolveInfo(parseInt(error.json["failed_permid"]))?.name || tr("unknwon") });
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {ConnectionHandler} from "tc-shared/ConnectionHandler";
|
||||
import {Registry} from "tc-shared/events";
|
||||
import {FileType} from "tc-shared/file/FileManager";
|
||||
import {CommandResult, ErrorCode, ErrorID} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import PermissionType from "tc-shared/permission/PermissionType";
|
||||
import * as log from "tc-shared/log";
|
||||
import {LogCategory} from "tc-shared/log";
|
||||
|
@ -26,7 +26,7 @@ import {
|
|||
ListedFileInfo,
|
||||
PathInfo
|
||||
} from "tc-shared/ui/modal/transfer/ModalFileTransfer";
|
||||
import {Settings, settings} from "tc-shared/settings";
|
||||
import {ErrorCode} from "tc-shared/connection/ErrorCode";
|
||||
|
||||
function parsePath(path: string, connection: ConnectionHandler) : PathInfo {
|
||||
if(path === "/" || !path) {
|
||||
|
@ -230,7 +230,7 @@ export function initializeRemoteFileBrowserController(connection: ConnectionHand
|
|||
}).catch(error => {
|
||||
let message;
|
||||
if(error instanceof CommandResult) {
|
||||
if(error.id === ErrorID.PERMISSION_ERROR) {
|
||||
if(error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) {
|
||||
const permission = connection.permissions.resolveInfo(error.json["failed_permid"] as number);
|
||||
events.fire_async("query_files_result", {
|
||||
path: event.path,
|
||||
|
@ -330,7 +330,7 @@ export function initializeRemoteFileBrowserController(connection: ConnectionHand
|
|||
}).catch(error => {
|
||||
let message;
|
||||
if(error instanceof CommandResult) {
|
||||
if(error.id === ErrorID.PERMISSION_ERROR) {
|
||||
if(error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) {
|
||||
const permission = connection.permissions.resolveInfo(error.json["failed_permid"] as number);
|
||||
events.fire_async("action_rename_file_result", {
|
||||
oldPath: event.oldPath,
|
||||
|
@ -523,7 +523,7 @@ export function initializeRemoteFileBrowserController(connection: ConnectionHand
|
|||
|
||||
let results = [];
|
||||
result.getBulks().forEach((e, index) => {
|
||||
if(e.id === ErrorID.PERMISSION_ERROR) {
|
||||
if(e.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) {
|
||||
const permission = connection.permissions.resolveInfo(e.json["failed_permid"] as number);
|
||||
results.push({
|
||||
path: fileInfos[index].path,
|
||||
|
@ -620,7 +620,7 @@ export function initializeRemoteFileBrowserController(connection: ConnectionHand
|
|||
}).catch(error => {
|
||||
let message;
|
||||
if(error instanceof CommandResult) {
|
||||
if(error.id === ErrorID.PERMISSION_ERROR) {
|
||||
if(error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) {
|
||||
const permission = connection.permissions.resolveInfo(error.json["failed_permid"] as number);
|
||||
events.fire_async("action_create_directory_result", {
|
||||
name: event.name,
|
||||
|
|
Loading…
Reference in New Issue