Skip to content

Commit d1339e9

Browse files
authored
Merge pull request #31 from conkayyan/develop
Support Ubuntu 24.04 webkit2gtk-4.1
2 parents 9d204fe + ecd9ce9 commit d1339e9

File tree

9 files changed

+204
-143
lines changed

9 files changed

+204
-143
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ jobs:
3636

3737
- name: Build wails
3838
# uses: dAppServer/[email protected]
39-
uses: conkayyan/wails-build-action@dev
39+
uses: conkayyan/wails-build-action@v2.9.1
4040
id: build
4141
with:
4242
build-name: ${{ matrix.build.name }}
4343
build-platform: ${{ matrix.build.platform }}
4444
package: true
45-
go-version: '1.21.2'
46-
wails-version: 'v2.8.2'
47-
node-version: '20.13.1'
45+
go-version: '1.21.12'
46+
wails-version: 'v2.9.1'
47+
node-version: '22.5.1'
4848
deb-app: hosts-switch
4949
deb-app-name: "Hosts Switch"

frontend/package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "frontend",
33
"private": true,
44
"version": "0.1.0",
5+
"type": "module",
56
"scripts": {
67
"dev": "vite",
78
"build": "vite build",
@@ -13,14 +14,14 @@
1314
"@codemirror/lang-json": "^6.0.1",
1415
"@codemirror/theme-one-dark": "^6.1.2",
1516
"codemirror": "^6.0.1",
16-
"element-plus": "^2.7.3",
17-
"vue": "^3.4.27",
17+
"element-plus": "^2.7.8",
18+
"vue": "^3.4.34",
1819
"vue-codemirror": "^6.1.1"
1920
},
2021
"devDependencies": {
21-
"@vitejs/plugin-vue": "^5.0.4",
22-
"unplugin-auto-import": "^0.17.6",
23-
"unplugin-vue-components": "^0.27.0",
24-
"vite": "^5.2.11"
22+
"@vitejs/plugin-vue": "^5.1.1",
23+
"unplugin-auto-import": "^0.18.2",
24+
"unplugin-vue-components": "^0.27.3",
25+
"vite": "^5.3.5"
2526
}
2627
}

frontend/package.json.md5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
607600df3f54ae4acaabe4a5b5b11942
1+
3973c1104797cc5ea1069b10ff16b792

frontend/wailsjs/go/main/App.d.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,29 @@ export function AddHost(arg1:string,arg2:string,arg3:string):Promise<string>;
66

77
export function DeleteHost(arg1:string,arg2:number):Promise<string>;
88

9-
export function DeleteHosts(arg1: Array<hosts.Host>): Promise<string>;
9+
export function DeleteHosts(arg1:Array<hosts.Host>):Promise<string>;
1010

1111
export function GetAllGroupNames():Promise<Array<string>>;
1212

1313
export function GetHostsText():Promise<string>;
1414

15-
export function GetInUseHostsText(): Promise<string>;
15+
export function GetInUseHostsText():Promise<string>;
1616

17-
export function GetMyHosts(): Promise<hosts.MyHosts>;
17+
export function GetMyHosts():Promise<hosts.MyHosts>;
1818

19-
export function SaveAddHostsText(arg1: string): Promise<string>;
19+
export function SaveAddHostsText(arg1:string):Promise<string>;
2020

21-
export function SaveAllGroupHosts(arg1: string, arg2: string): Promise<string>;
21+
export function SaveAllGroupHosts(arg1:string,arg2:string):Promise<string>;
2222

2323
export function SaveAllHosts(arg1:string):Promise<string>;
2424

25-
export function SaveAllInUseHosts(arg1: string): Promise<string>;
25+
export function SaveAllInUseHosts(arg1:string):Promise<string>;
2626

27-
export function SetGroupName(arg1: string, arg2: string): Promise<string>;
27+
export function SetGroupName(arg1:string,arg2:string):Promise<string>;
2828

29-
export function SetGroupNameByHostnameId(arg1: number, arg2: string): Promise<string>;
29+
export function SetGroupNameByHostnameId(arg1:number,arg2:string):Promise<string>;
3030

31-
export function SetGroupNameByHosts(arg1: Array<hosts.Host>, arg2: string): Promise<string>;
31+
export function SetGroupNameByHosts(arg1:Array<hosts.Host>,arg2:string):Promise<string>;
3232

3333
export function SwitchByGroupName(arg1:string,arg2:boolean):Promise<string>;
3434

frontend/wailsjs/go/models.ts

Lines changed: 78 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,88 @@
11
export namespace hosts {
2-
2+
33
export class Host {
4-
id: number;
5-
show: boolean;
6-
ip: string;
7-
hostName: string;
8-
groupName: string;
9-
10-
static createFrom(source: any = {}) {
11-
return new Host(source);
12-
}
13-
14-
constructor(source: any = {}) {
15-
if ('string' === typeof source) source = JSON.parse(source);
16-
this.id = source["id"];
17-
this.show = source["show"];
18-
this.ip = source["ip"];
19-
this.hostName = source["hostName"];
20-
this.groupName = source["groupName"];
21-
}
4+
id: number;
5+
show: boolean;
6+
ip: string;
7+
hostName: string;
8+
groupName: string;
9+
10+
static createFrom(source: any = {}) {
11+
return new Host(source);
12+
}
13+
14+
constructor(source: any = {}) {
15+
if ('string' === typeof source) source = JSON.parse(source);
16+
this.id = source["id"];
17+
this.show = source["show"];
18+
this.ip = source["ip"];
19+
this.hostName = source["hostName"];
20+
this.groupName = source["groupName"];
21+
}
2222
}
23-
2423
export class Group {
25-
hostsText: string;
26-
groupName: string;
27-
showNum: number;
28-
hideNum: number;
29-
show: boolean;
30-
list: { [key: number]: Host };
31-
32-
static createFrom(source: any = {}) {
33-
return new Group(source);
34-
}
35-
36-
constructor(source: any = {}) {
37-
if ('string' === typeof source) source = JSON.parse(source);
38-
this.hostsText = source["hostsText"];
39-
this.groupName = source["groupName"];
40-
this.showNum = source["showNum"];
41-
this.hideNum = source["hideNum"];
42-
this.show = source["show"];
43-
this.list = source["list"];
44-
}
24+
hostsText: string;
25+
groupName: string;
26+
showNum: number;
27+
hideNum: number;
28+
show: boolean;
29+
list: {[key: number]: Host};
30+
31+
static createFrom(source: any = {}) {
32+
return new Group(source);
33+
}
34+
35+
constructor(source: any = {}) {
36+
if ('string' === typeof source) source = JSON.parse(source);
37+
this.hostsText = source["hostsText"];
38+
this.groupName = source["groupName"];
39+
this.showNum = source["showNum"];
40+
this.hideNum = source["hideNum"];
41+
this.show = source["show"];
42+
this.list = source["list"];
43+
}
4544
}
46-
45+
4746
export class MyHosts {
48-
path: string;
49-
hostsText: string;
50-
inUseHostsText: string;
51-
noInUseHostsText: string;
52-
totalNum: number;
53-
list: { [key: number]: Host };
54-
listByGroup: { [key: string]: Group };
55-
56-
static createFrom(source: any = {}) {
57-
return new MyHosts(source);
58-
}
59-
60-
constructor(source: any = {}) {
61-
if ('string' === typeof source) source = JSON.parse(source);
62-
this.path = source["path"];
63-
this.hostsText = source["hostsText"];
64-
this.inUseHostsText = source["inUseHostsText"];
65-
this.noInUseHostsText = source["noInUseHostsText"];
66-
this.totalNum = source["totalNum"];
67-
this.list = source["list"];
68-
this.listByGroup = this.convertValues(source["listByGroup"], Group, true);
69-
}
70-
47+
path: string;
48+
hostsText: string;
49+
inUseHostsText: string;
50+
noInUseHostsText: string;
51+
totalNum: number;
52+
list: {[key: number]: Host};
53+
listByGroup: {[key: string]: Group};
54+
55+
static createFrom(source: any = {}) {
56+
return new MyHosts(source);
57+
}
58+
59+
constructor(source: any = {}) {
60+
if ('string' === typeof source) source = JSON.parse(source);
61+
this.path = source["path"];
62+
this.hostsText = source["hostsText"];
63+
this.inUseHostsText = source["inUseHostsText"];
64+
this.noInUseHostsText = source["noInUseHostsText"];
65+
this.totalNum = source["totalNum"];
66+
this.list = source["list"];
67+
this.listByGroup = this.convertValues(source["listByGroup"], Group, true);
68+
}
69+
7170
convertValues(a: any, classs: any, asMap: boolean = false): any {
72-
if (!a) {
73-
return a;
74-
}
75-
if (a.slice && a.map) {
76-
return (a as any[]).map(elem => this.convertValues(elem, classs));
77-
} else if ("object" === typeof a) {
78-
if (asMap) {
79-
for (const key of Object.keys(a)) {
80-
a[key] = new classs(a[key]);
81-
}
82-
return a;
83-
}
84-
return new classs(a);
85-
}
86-
return a;
71+
if (!a) {
72+
return a;
73+
}
74+
if (a.slice && a.map) {
75+
return (a as any[]).map(elem => this.convertValues(elem, classs));
76+
} else if ("object" === typeof a) {
77+
if (asMap) {
78+
for (const key of Object.keys(a)) {
79+
a[key] = new classs(a[key]);
80+
}
81+
return a;
82+
}
83+
return new classs(a);
84+
}
85+
return a;
8786
}
8887
}
8988

frontend/wailsjs/runtime/runtime.d.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,3 +233,17 @@ export function ClipboardGetText(): Promise<string>;
233233
// [ClipboardSetText](https://wails.io/docs/reference/runtime/clipboard#clipboardsettext)
234234
// Sets a text on the clipboard
235235
export function ClipboardSetText(text: string): Promise<boolean>;
236+
237+
// [OnFileDrop](https://wails.io/docs/reference/runtime/draganddrop#onfiledrop)
238+
// OnFileDrop listens to drag and drop events and calls the callback with the coordinates of the drop and an array of path strings.
239+
export function OnFileDrop(callback: (x: number, y: number ,paths: string[]) => void, useDropTarget: boolean) :void
240+
241+
// [OnFileDropOff](https://wails.io/docs/reference/runtime/draganddrop#dragandddropoff)
242+
// OnFileDropOff removes the drag and drop listeners and handlers.
243+
export function OnFileDropOff() :void
244+
245+
// Check if the file path resolver is available
246+
export function CanResolveFilePaths(): boolean;
247+
248+
// Resolves file paths for an array of files
249+
export function ResolveFilePaths(files: File[]): void

frontend/wailsjs/runtime/runtime.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,4 +199,40 @@ export function ClipboardGetText() {
199199

200200
export function ClipboardSetText(text) {
201201
return window.runtime.ClipboardSetText(text);
202+
}
203+
204+
/**
205+
* Callback for OnFileDrop returns a slice of file path strings when a drop is finished.
206+
*
207+
* @export
208+
* @callback OnFileDropCallback
209+
* @param {number} x - x coordinate of the drop
210+
* @param {number} y - y coordinate of the drop
211+
* @param {string[]} paths - A list of file paths.
212+
*/
213+
214+
/**
215+
* OnFileDrop listens to drag and drop events and calls the callback with the coordinates of the drop and an array of path strings.
216+
*
217+
* @export
218+
* @param {OnFileDropCallback} callback - Callback for OnFileDrop returns a slice of file path strings when a drop is finished.
219+
* @param {boolean} [useDropTarget=true] - Only call the callback when the drop finished on an element that has the drop target style. (--wails-drop-target)
220+
*/
221+
export function OnFileDrop(callback, useDropTarget) {
222+
return window.runtime.OnFileDrop(callback, useDropTarget);
223+
}
224+
225+
/**
226+
* OnFileDropOff removes the drag and drop listeners and handlers.
227+
*/
228+
export function OnFileDropOff() {
229+
return window.runtime.OnFileDropOff();
230+
}
231+
232+
export function CanResolveFilePaths() {
233+
return window.runtime.CanResolveFilePaths();
234+
}
235+
236+
export function ResolveFilePaths(files) {
237+
return window.runtime.ResolveFilePaths(files);
202238
}

go.mod

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,33 @@ module hosts-switch
22

33
go 1.21
44

5-
toolchain go1.21.2
6-
7-
require github.com/wailsapp/wails/v2 v2.8.2
5+
require github.com/wailsapp/wails/v2 v2.9.1
86

97
require (
108
github.com/bep/debounce v1.2.1 // indirect
11-
github.com/go-ole/go-ole v1.3.0 // indirect
9+
github.com/go-ole/go-ole v1.2.6 // indirect
1210
github.com/godbus/dbus/v5 v5.1.0 // indirect
13-
github.com/google/uuid v1.6.0 // indirect
11+
github.com/google/uuid v1.3.0 // indirect
1412
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
15-
github.com/labstack/echo/v4 v4.12.0 // indirect
16-
github.com/labstack/gommon v0.4.2 // indirect
17-
github.com/leaanthony/go-ansi-parser v1.6.1 // indirect
18-
github.com/leaanthony/gosod v1.0.4 // indirect
13+
github.com/labstack/echo/v4 v4.10.2 // indirect
14+
github.com/labstack/gommon v0.4.0 // indirect
15+
github.com/leaanthony/go-ansi-parser v1.6.0 // indirect
16+
github.com/leaanthony/gosod v1.0.3 // indirect
1917
github.com/leaanthony/slicer v1.6.0 // indirect
20-
github.com/leaanthony/u v1.1.1 // indirect
18+
github.com/leaanthony/u v1.1.0 // indirect
2119
github.com/mattn/go-colorable v0.1.13 // indirect
22-
github.com/mattn/go-isatty v0.0.20 // indirect
23-
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
20+
github.com/mattn/go-isatty v0.0.19 // indirect
21+
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
2422
github.com/pkg/errors v0.9.1 // indirect
25-
github.com/rivo/uniseg v0.4.7 // indirect
26-
github.com/samber/lo v1.39.0 // indirect
23+
github.com/rivo/uniseg v0.4.4 // indirect
24+
github.com/samber/lo v1.38.1 // indirect
2725
github.com/tkrajina/go-reflector v0.5.6 // indirect
2826
github.com/valyala/bytebufferpool v1.0.0 // indirect
2927
github.com/valyala/fasttemplate v1.2.2 // indirect
3028
github.com/wailsapp/go-webview2 v1.0.10 // indirect
3129
github.com/wailsapp/mimetype v1.4.1 // indirect
3230
golang.org/x/crypto v0.23.0 // indirect
33-
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
31+
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
3432
golang.org/x/net v0.25.0 // indirect
3533
golang.org/x/sys v0.20.0 // indirect
3634
golang.org/x/text v0.15.0 // indirect

0 commit comments

Comments
 (0)