init
This commit is contained in:
13
frontend/bindings/mesh-drop/internal/discovery/index.ts
Normal file
13
frontend/bindings/mesh-drop/internal/discovery/index.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import * as Service from "./service.js";
|
||||
export {
|
||||
Service
|
||||
};
|
||||
|
||||
export {
|
||||
OS,
|
||||
Peer,
|
||||
RouteState
|
||||
} from "./models.js";
|
||||
128
frontend/bindings/mesh-drop/internal/discovery/models.ts
Normal file
128
frontend/bindings/mesh-drop/internal/discovery/models.ts
Normal file
@@ -0,0 +1,128 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import { Create as $Create } from "@wailsio/runtime";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as time$0 from "../../../time/models.js";
|
||||
|
||||
export enum OS {
|
||||
/**
|
||||
* The Go zero value for the underlying type of the enum.
|
||||
*/
|
||||
$zero = "",
|
||||
|
||||
OSLinux = "linux",
|
||||
OSWindows = "windows",
|
||||
OSMac = "darwin",
|
||||
};
|
||||
|
||||
/**
|
||||
* Peer 代表一个可达的网络端点 (Network Endpoint)。
|
||||
* 注意:一个物理设备 (Device) 可能通过多个网络接口广播,因此会对应多个 Peer 结构体。
|
||||
*/
|
||||
export class Peer {
|
||||
/**
|
||||
* ID 是物理设备的全局唯一标识 (UUID/MachineID)。
|
||||
* 具有相同 ID 的 Peer 属于同一台物理设备。
|
||||
*/
|
||||
"id": string;
|
||||
|
||||
/**
|
||||
* Name 是设备的主机名或用户设置的显示名称 (如 "Nite's Arch")。
|
||||
*/
|
||||
"name": string;
|
||||
|
||||
/**
|
||||
* Routes 记录了设备的 IP 地址和状态。
|
||||
* Key: ip, Value: *RouteState
|
||||
*/
|
||||
"routes": { [_: string]: RouteState | null };
|
||||
|
||||
/**
|
||||
* Port 是文件传输服务的监听端口。
|
||||
*/
|
||||
"port": number;
|
||||
|
||||
/**
|
||||
* IsOnline 标记该端点当前是否活跃 (UI 渲染用)。
|
||||
*/
|
||||
"is_online": boolean;
|
||||
"os": OS;
|
||||
|
||||
/** Creates a new Peer instance. */
|
||||
constructor($$source: Partial<Peer> = {}) {
|
||||
if (!("id" in $$source)) {
|
||||
this["id"] = "";
|
||||
}
|
||||
if (!("name" in $$source)) {
|
||||
this["name"] = "";
|
||||
}
|
||||
if (!("routes" in $$source)) {
|
||||
this["routes"] = {};
|
||||
}
|
||||
if (!("port" in $$source)) {
|
||||
this["port"] = 0;
|
||||
}
|
||||
if (!("is_online" in $$source)) {
|
||||
this["is_online"] = false;
|
||||
}
|
||||
if (!("os" in $$source)) {
|
||||
this["os"] = OS.$zero;
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Peer instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): Peer {
|
||||
const $$createField2_0 = $$createType2;
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
if ("routes" in $$parsedSource) {
|
||||
$$parsedSource["routes"] = $$createField2_0($$parsedSource["routes"]);
|
||||
}
|
||||
return new Peer($$parsedSource as Partial<Peer>);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* RouteState 记录单条路径的状态
|
||||
*/
|
||||
export class RouteState {
|
||||
"ip": string;
|
||||
|
||||
/**
|
||||
* 该特定 IP 最后一次响应的时间
|
||||
*/
|
||||
"last_seen": time$0.Time;
|
||||
|
||||
/** Creates a new RouteState instance. */
|
||||
constructor($$source: Partial<RouteState> = {}) {
|
||||
if (!("ip" in $$source)) {
|
||||
this["ip"] = "";
|
||||
}
|
||||
if (!("last_seen" in $$source)) {
|
||||
this["last_seen"] = null;
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new RouteState instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): RouteState {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new RouteState($$parsedSource as Partial<RouteState>);
|
||||
}
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = RouteState.createFrom;
|
||||
const $$createType1 = $Create.Nullable($$createType0);
|
||||
const $$createType2 = $Create.Map($Create.Any, $$createType1);
|
||||
39
frontend/bindings/mesh-drop/internal/discovery/service.ts
Normal file
39
frontend/bindings/mesh-drop/internal/discovery/service.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "@wailsio/runtime";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
|
||||
export function GetID(): $CancellablePromise<string> {
|
||||
return $Call.ByID(1539451205);
|
||||
}
|
||||
|
||||
export function GetName(): $CancellablePromise<string> {
|
||||
return $Call.ByID(1578367131);
|
||||
}
|
||||
|
||||
export function GetPeerByIP(ip: string): $CancellablePromise<$models.Peer | null> {
|
||||
return $Call.ByID(1626825408, ip).then(($result: any) => {
|
||||
return $$createType1($result);
|
||||
});
|
||||
}
|
||||
|
||||
export function GetPeers(): $CancellablePromise<$models.Peer[]> {
|
||||
return $Call.ByID(3041084029).then(($result: any) => {
|
||||
return $$createType2($result);
|
||||
});
|
||||
}
|
||||
|
||||
export function Start(): $CancellablePromise<void> {
|
||||
return $Call.ByID(1014177536);
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = $models.Peer.createFrom;
|
||||
const $$createType1 = $Create.Nullable($$createType0);
|
||||
const $$createType2 = $Create.Array($$createType0);
|
||||
16
frontend/bindings/mesh-drop/internal/transfer/index.ts
Normal file
16
frontend/bindings/mesh-drop/internal/transfer/index.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import * as Service from "./service.js";
|
||||
export {
|
||||
Service
|
||||
};
|
||||
|
||||
export {
|
||||
ContentType,
|
||||
Progress,
|
||||
Sender,
|
||||
Transfer,
|
||||
TransferStatus,
|
||||
TransferType
|
||||
} from "./models.js";
|
||||
244
frontend/bindings/mesh-drop/internal/transfer/models.ts
Normal file
244
frontend/bindings/mesh-drop/internal/transfer/models.ts
Normal file
@@ -0,0 +1,244 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import { Create as $Create } from "@wailsio/runtime";
|
||||
|
||||
export enum ContentType {
|
||||
/**
|
||||
* The Go zero value for the underlying type of the enum.
|
||||
*/
|
||||
$zero = "",
|
||||
|
||||
ContentTypeFile = "file",
|
||||
ContentTypeText = "text",
|
||||
ContentTypeFolder = "folder",
|
||||
};
|
||||
|
||||
/**
|
||||
* Progress 用户前端传输进度
|
||||
*/
|
||||
export class Progress {
|
||||
/**
|
||||
* 当前进度
|
||||
*/
|
||||
"current": number;
|
||||
|
||||
/**
|
||||
* 总进度
|
||||
*/
|
||||
"total": number;
|
||||
|
||||
/**
|
||||
* 速度
|
||||
*/
|
||||
"speed": number;
|
||||
|
||||
/** Creates a new Progress instance. */
|
||||
constructor($$source: Partial<Progress> = {}) {
|
||||
if (!("current" in $$source)) {
|
||||
this["current"] = 0;
|
||||
}
|
||||
if (!("total" in $$source)) {
|
||||
this["total"] = 0;
|
||||
}
|
||||
if (!("speed" in $$source)) {
|
||||
this["speed"] = 0;
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Progress instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): Progress {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new Progress($$parsedSource as Partial<Progress>);
|
||||
}
|
||||
}
|
||||
|
||||
export class Sender {
|
||||
/**
|
||||
* 发送者 ID
|
||||
*/
|
||||
"id": string;
|
||||
|
||||
/**
|
||||
* 发送者名称
|
||||
*/
|
||||
"name": string;
|
||||
|
||||
/** Creates a new Sender instance. */
|
||||
constructor($$source: Partial<Sender> = {}) {
|
||||
if (!("id" in $$source)) {
|
||||
this["id"] = "";
|
||||
}
|
||||
if (!("name" in $$source)) {
|
||||
this["name"] = "";
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Sender instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): Sender {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new Sender($$parsedSource as Partial<Sender>);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Transfer
|
||||
*/
|
||||
export class Transfer {
|
||||
/**
|
||||
* 传输会话 ID
|
||||
*/
|
||||
"id": string;
|
||||
|
||||
/**
|
||||
* 发送者
|
||||
*/
|
||||
"sender": Sender;
|
||||
|
||||
/**
|
||||
* 文件名
|
||||
*/
|
||||
"file_name": string;
|
||||
|
||||
/**
|
||||
* 文件大小 (字节)
|
||||
*/
|
||||
"file_size": number;
|
||||
|
||||
/**
|
||||
* 保存路径
|
||||
*/
|
||||
"savePath": string;
|
||||
|
||||
/**
|
||||
* 传输状态
|
||||
*/
|
||||
"status": TransferStatus;
|
||||
|
||||
/**
|
||||
* 传输进度
|
||||
*/
|
||||
"progress": Progress;
|
||||
|
||||
/**
|
||||
* 进度类型
|
||||
*/
|
||||
"type": TransferType;
|
||||
|
||||
/**
|
||||
* 内容类型
|
||||
*/
|
||||
"content_type": ContentType;
|
||||
|
||||
/**
|
||||
* 文本内容
|
||||
*/
|
||||
"text": string;
|
||||
|
||||
/**
|
||||
* 错误信息
|
||||
*/
|
||||
"error_msg": string;
|
||||
|
||||
/**
|
||||
* 用于上传的凭证
|
||||
*/
|
||||
"token": string;
|
||||
|
||||
/** Creates a new Transfer instance. */
|
||||
constructor($$source: Partial<Transfer> = {}) {
|
||||
if (!("id" in $$source)) {
|
||||
this["id"] = "";
|
||||
}
|
||||
if (!("sender" in $$source)) {
|
||||
this["sender"] = (new Sender());
|
||||
}
|
||||
if (!("file_name" in $$source)) {
|
||||
this["file_name"] = "";
|
||||
}
|
||||
if (!("file_size" in $$source)) {
|
||||
this["file_size"] = 0;
|
||||
}
|
||||
if (!("savePath" in $$source)) {
|
||||
this["savePath"] = "";
|
||||
}
|
||||
if (!("status" in $$source)) {
|
||||
this["status"] = TransferStatus.$zero;
|
||||
}
|
||||
if (!("progress" in $$source)) {
|
||||
this["progress"] = (new Progress());
|
||||
}
|
||||
if (!("type" in $$source)) {
|
||||
this["type"] = TransferType.$zero;
|
||||
}
|
||||
if (!("content_type" in $$source)) {
|
||||
this["content_type"] = ContentType.$zero;
|
||||
}
|
||||
if (!("text" in $$source)) {
|
||||
this["text"] = "";
|
||||
}
|
||||
if (!("error_msg" in $$source)) {
|
||||
this["error_msg"] = "";
|
||||
}
|
||||
if (!("token" in $$source)) {
|
||||
this["token"] = "";
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Transfer instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): Transfer {
|
||||
const $$createField1_0 = $$createType0;
|
||||
const $$createField6_0 = $$createType1;
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
if ("sender" in $$parsedSource) {
|
||||
$$parsedSource["sender"] = $$createField1_0($$parsedSource["sender"]);
|
||||
}
|
||||
if ("progress" in $$parsedSource) {
|
||||
$$parsedSource["progress"] = $$createField6_0($$parsedSource["progress"]);
|
||||
}
|
||||
return new Transfer($$parsedSource as Partial<Transfer>);
|
||||
}
|
||||
}
|
||||
|
||||
export enum TransferStatus {
|
||||
/**
|
||||
* The Go zero value for the underlying type of the enum.
|
||||
*/
|
||||
$zero = "",
|
||||
|
||||
TransferStatusPending = "pending",
|
||||
TransferStatusAccepted = "accepted",
|
||||
TransferStatusRejected = "rejected",
|
||||
TransferStatusCompleted = "completed",
|
||||
TransferStatusError = "error",
|
||||
TransferStatusCanceled = "canceled",
|
||||
TransferStatusActive = "active",
|
||||
};
|
||||
|
||||
export enum TransferType {
|
||||
/**
|
||||
* The Go zero value for the underlying type of the enum.
|
||||
*/
|
||||
$zero = "",
|
||||
|
||||
TransferTypeSend = "send",
|
||||
TransferTypeReceive = "receive",
|
||||
};
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = Sender.createFrom;
|
||||
const $$createType1 = Progress.createFrom;
|
||||
48
frontend/bindings/mesh-drop/internal/transfer/service.ts
Normal file
48
frontend/bindings/mesh-drop/internal/transfer/service.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "@wailsio/runtime";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as discovery$0 from "../discovery/models.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
|
||||
export function GetPort(): $CancellablePromise<number> {
|
||||
return $Call.ByID(4195335736);
|
||||
}
|
||||
|
||||
export function GetTransferList(): $CancellablePromise<$models.Transfer[]> {
|
||||
return $Call.ByID(584162076).then(($result: any) => {
|
||||
return $$createType1($result);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ResolvePendingRequest 外部调用,解决待处理的传输请求
|
||||
* 返回 true 表示成功处理,false 表示未找到该 ID 的请求
|
||||
*/
|
||||
export function ResolvePendingRequest(id: string, accept: boolean, savePath: string): $CancellablePromise<boolean> {
|
||||
return $Call.ByID(207902967, id, accept, savePath);
|
||||
}
|
||||
|
||||
export function SendFile(target: discovery$0.Peer | null, targetIP: string, filePath: string): $CancellablePromise<void> {
|
||||
return $Call.ByID(2954589433, target, targetIP, filePath);
|
||||
}
|
||||
|
||||
export function SendText(target: discovery$0.Peer | null, targetIP: string, text: string): $CancellablePromise<void> {
|
||||
return $Call.ByID(1497421440, target, targetIP, text);
|
||||
}
|
||||
|
||||
export function Start(): $CancellablePromise<void> {
|
||||
return $Call.ByID(3611800535);
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = $models.Transfer.createFrom;
|
||||
const $$createType1 = $Create.Array($$createType0);
|
||||
Reference in New Issue
Block a user