mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-07 02:09:06 +00:00
feat: Enable core to use local config files while being managed via the web (#1540)
This commit is contained in:
@@ -26,8 +26,27 @@ export interface CollectNetworkInfoResponse {
|
||||
}
|
||||
}
|
||||
|
||||
export namespace ConfigFilePermission {
|
||||
export type Flags = number;
|
||||
export const READ_ONLY: Flags = 1 << 0;
|
||||
export const NO_DELETE: Flags = 1 << 1;
|
||||
export function hasPermission(perm: Flags, flag: Flags): boolean {
|
||||
return (perm & flag) === flag;
|
||||
}
|
||||
export function isRemoveSaveable(perm: Flags): boolean {
|
||||
return !hasPermission(perm, NO_DELETE);
|
||||
}
|
||||
export function isEditable(perm: Flags): boolean {
|
||||
return !hasPermission(perm, READ_ONLY);
|
||||
}
|
||||
export function isDeletable(perm: Flags): boolean {
|
||||
return !hasPermission(perm, NO_DELETE);
|
||||
}
|
||||
}
|
||||
|
||||
export interface NetworkMeta {
|
||||
instance_name: string;
|
||||
network_name: string;
|
||||
config_permission: ConfigFilePermission.Flags;
|
||||
}
|
||||
|
||||
export interface GetNetworkMetasResponse {
|
||||
@@ -36,7 +55,7 @@ export interface GetNetworkMetasResponse {
|
||||
|
||||
export interface RemoteClient {
|
||||
validate_config(config: NetworkConfig): Promise<ValidateConfigResponse>;
|
||||
run_network(config: NetworkConfig): Promise<undefined>;
|
||||
run_network(config: NetworkConfig, save: boolean): Promise<undefined>;
|
||||
get_network_info(inst_id: string): Promise<NetworkInstanceRunningInfo | undefined>;
|
||||
list_network_instance_ids(): Promise<ListNetworkInstanceIdResponse>;
|
||||
delete_network(inst_id: string): Promise<undefined>;
|
||||
|
||||
Reference in New Issue
Block a user