Skip to content

Commit

Permalink
Merge pull request #31 from conkayyan/develop
Browse files Browse the repository at this point in the history
Support Ubuntu 24.04 webkit2gtk-4.1
  • Loading branch information
conkayyan authored Jul 27, 2024
2 parents 9d204fe + ecd9ce9 commit d1339e9
Show file tree
Hide file tree
Showing 9 changed files with 204 additions and 143 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ jobs:

- name: Build wails
# uses: dAppServer/[email protected]
uses: conkayyan/wails-build-action@dev
uses: conkayyan/wails-build-action@v2.9.1
id: build
with:
build-name: ${{ matrix.build.name }}
build-platform: ${{ matrix.build.platform }}
package: true
go-version: '1.21.2'
wails-version: 'v2.8.2'
node-version: '20.13.1'
go-version: '1.21.12'
wails-version: 'v2.9.1'
node-version: '22.5.1'
deb-app: hosts-switch
deb-app-name: "Hosts Switch"
13 changes: 7 additions & 6 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "frontend",
"private": true,
"version": "0.1.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
Expand All @@ -13,14 +14,14 @@
"@codemirror/lang-json": "^6.0.1",
"@codemirror/theme-one-dark": "^6.1.2",
"codemirror": "^6.0.1",
"element-plus": "^2.7.3",
"vue": "^3.4.27",
"element-plus": "^2.7.8",
"vue": "^3.4.34",
"vue-codemirror": "^6.1.1"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.4",
"unplugin-auto-import": "^0.17.6",
"unplugin-vue-components": "^0.27.0",
"vite": "^5.2.11"
"@vitejs/plugin-vue": "^5.1.1",
"unplugin-auto-import": "^0.18.2",
"unplugin-vue-components": "^0.27.3",
"vite": "^5.3.5"
}
}
2 changes: 1 addition & 1 deletion frontend/package.json.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
607600df3f54ae4acaabe4a5b5b11942
3973c1104797cc5ea1069b10ff16b792
18 changes: 9 additions & 9 deletions frontend/wailsjs/go/main/App.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@ export function AddHost(arg1:string,arg2:string,arg3:string):Promise<string>;

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

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

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

export function GetHostsText():Promise<string>;

export function GetInUseHostsText(): Promise<string>;
export function GetInUseHostsText():Promise<string>;

export function GetMyHosts(): Promise<hosts.MyHosts>;
export function GetMyHosts():Promise<hosts.MyHosts>;

export function SaveAddHostsText(arg1: string): Promise<string>;
export function SaveAddHostsText(arg1:string):Promise<string>;

export function SaveAllGroupHosts(arg1: string, arg2: string): Promise<string>;
export function SaveAllGroupHosts(arg1:string,arg2:string):Promise<string>;

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

export function SaveAllInUseHosts(arg1: string): Promise<string>;
export function SaveAllInUseHosts(arg1:string):Promise<string>;

export function SetGroupName(arg1: string, arg2: string): Promise<string>;
export function SetGroupName(arg1:string,arg2:string):Promise<string>;

export function SetGroupNameByHostnameId(arg1: number, arg2: string): Promise<string>;
export function SetGroupNameByHostnameId(arg1:number,arg2:string):Promise<string>;

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

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

Expand Down
157 changes: 78 additions & 79 deletions frontend/wailsjs/go/models.ts
Original file line number Diff line number Diff line change
@@ -1,89 +1,88 @@
export namespace hosts {

export class Host {
id: number;
show: boolean;
ip: string;
hostName: string;
groupName: string;

static createFrom(source: any = {}) {
return new Host(source);
}

constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.id = source["id"];
this.show = source["show"];
this.ip = source["ip"];
this.hostName = source["hostName"];
this.groupName = source["groupName"];
}
id: number;
show: boolean;
ip: string;
hostName: string;
groupName: string;
static createFrom(source: any = {}) {
return new Host(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.id = source["id"];
this.show = source["show"];
this.ip = source["ip"];
this.hostName = source["hostName"];
this.groupName = source["groupName"];
}
}

export class Group {
hostsText: string;
groupName: string;
showNum: number;
hideNum: number;
show: boolean;
list: { [key: number]: Host };

static createFrom(source: any = {}) {
return new Group(source);
}

constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.hostsText = source["hostsText"];
this.groupName = source["groupName"];
this.showNum = source["showNum"];
this.hideNum = source["hideNum"];
this.show = source["show"];
this.list = source["list"];
}
hostsText: string;
groupName: string;
showNum: number;
hideNum: number;
show: boolean;
list: {[key: number]: Host};
static createFrom(source: any = {}) {
return new Group(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.hostsText = source["hostsText"];
this.groupName = source["groupName"];
this.showNum = source["showNum"];
this.hideNum = source["hideNum"];
this.show = source["show"];
this.list = source["list"];
}
}

export class MyHosts {
path: string;
hostsText: string;
inUseHostsText: string;
noInUseHostsText: string;
totalNum: number;
list: { [key: number]: Host };
listByGroup: { [key: string]: Group };

static createFrom(source: any = {}) {
return new MyHosts(source);
}

constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.path = source["path"];
this.hostsText = source["hostsText"];
this.inUseHostsText = source["inUseHostsText"];
this.noInUseHostsText = source["noInUseHostsText"];
this.totalNum = source["totalNum"];
this.list = source["list"];
this.listByGroup = this.convertValues(source["listByGroup"], Group, true);
}

path: string;
hostsText: string;
inUseHostsText: string;
noInUseHostsText: string;
totalNum: number;
list: {[key: number]: Host};
listByGroup: {[key: string]: Group};
static createFrom(source: any = {}) {
return new MyHosts(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.path = source["path"];
this.hostsText = source["hostsText"];
this.inUseHostsText = source["inUseHostsText"];
this.noInUseHostsText = source["noInUseHostsText"];
this.totalNum = source["totalNum"];
this.list = source["list"];
this.listByGroup = this.convertValues(source["listByGroup"], Group, true);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}

Expand Down
14 changes: 14 additions & 0 deletions frontend/wailsjs/runtime/runtime.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,17 @@ export function ClipboardGetText(): Promise<string>;
// [ClipboardSetText](https://wails.io/docs/reference/runtime/clipboard#clipboardsettext)
// Sets a text on the clipboard
export function ClipboardSetText(text: string): Promise<boolean>;

// [OnFileDrop](https://wails.io/docs/reference/runtime/draganddrop#onfiledrop)
// OnFileDrop listens to drag and drop events and calls the callback with the coordinates of the drop and an array of path strings.
export function OnFileDrop(callback: (x: number, y: number ,paths: string[]) => void, useDropTarget: boolean) :void

// [OnFileDropOff](https://wails.io/docs/reference/runtime/draganddrop#dragandddropoff)
// OnFileDropOff removes the drag and drop listeners and handlers.
export function OnFileDropOff() :void

// Check if the file path resolver is available
export function CanResolveFilePaths(): boolean;

// Resolves file paths for an array of files
export function ResolveFilePaths(files: File[]): void
36 changes: 36 additions & 0 deletions frontend/wailsjs/runtime/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,40 @@ export function ClipboardGetText() {

export function ClipboardSetText(text) {
return window.runtime.ClipboardSetText(text);
}

/**
* Callback for OnFileDrop returns a slice of file path strings when a drop is finished.
*
* @export
* @callback OnFileDropCallback
* @param {number} x - x coordinate of the drop
* @param {number} y - y coordinate of the drop
* @param {string[]} paths - A list of file paths.
*/

/**
* OnFileDrop listens to drag and drop events and calls the callback with the coordinates of the drop and an array of path strings.
*
* @export
* @param {OnFileDropCallback} callback - Callback for OnFileDrop returns a slice of file path strings when a drop is finished.
* @param {boolean} [useDropTarget=true] - Only call the callback when the drop finished on an element that has the drop target style. (--wails-drop-target)
*/
export function OnFileDrop(callback, useDropTarget) {
return window.runtime.OnFileDrop(callback, useDropTarget);
}

/**
* OnFileDropOff removes the drag and drop listeners and handlers.
*/
export function OnFileDropOff() {
return window.runtime.OnFileDropOff();
}

export function CanResolveFilePaths() {
return window.runtime.CanResolveFilePaths();
}

export function ResolveFilePaths(files) {
return window.runtime.ResolveFilePaths(files);
}
28 changes: 13 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,33 @@ module hosts-switch

go 1.21

toolchain go1.21.2

require github.com/wailsapp/wails/v2 v2.8.2
require github.com/wailsapp/wails/v2 v2.9.1

require (
github.com/bep/debounce v1.2.1 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
github.com/labstack/echo/v4 v4.12.0 // indirect
github.com/labstack/gommon v0.4.2 // indirect
github.com/leaanthony/go-ansi-parser v1.6.1 // indirect
github.com/leaanthony/gosod v1.0.4 // indirect
github.com/labstack/echo/v4 v4.10.2 // indirect
github.com/labstack/gommon v0.4.0 // indirect
github.com/leaanthony/go-ansi-parser v1.6.0 // indirect
github.com/leaanthony/gosod v1.0.3 // indirect
github.com/leaanthony/slicer v1.6.0 // indirect
github.com/leaanthony/u v1.1.1 // indirect
github.com/leaanthony/u v1.1.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/samber/lo v1.39.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/samber/lo v1.38.1 // indirect
github.com/tkrajina/go-reflector v0.5.6 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/wailsapp/go-webview2 v1.0.10 // indirect
github.com/wailsapp/mimetype v1.4.1 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
Expand Down
Loading

0 comments on commit d1339e9

Please sign in to comment.