Skip to content

Commit fbc3c42

Browse files
committed
Major fixes to GitHub import with new build
1 parent b771db2 commit fbc3c42

21 files changed

+559
-1600
lines changed

app.go

+50
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
clip "github.com/atotto/clipboard"
88
cp "github.com/otiai10/copy"
99
watcher "github.com/radovskyb/watcher"
10+
github "github.com/google/go-github/v49/github"
1011
wailsruntime "github.com/wailsapp/wails/v2/pkg/runtime"
1112
"io"
1213
"io/ioutil"
@@ -50,6 +51,15 @@ type WatcherInfo struct {
5051
SigName string
5152
}
5253

54+
type GitHubRepos struct {
55+
Name string `json:"name"`
56+
URL string `json:"url"`
57+
Stars int `json:"stars"`
58+
Owner string `json:"owner"`
59+
ID int64 `json:"id"`
60+
Description string `json:"description"`
61+
}
62+
5363
// NewApp creates a new App application struct
5464
func NewApp() *App {
5565
return &App{}
@@ -395,3 +405,43 @@ func (b *App) GetOSName() string {
395405
}
396406
return result
397407
}
408+
409+
func (b *App) GetGitHubThemes() []GitHubRepos {
410+
var result []GitHubRepos
411+
client := github.NewClient(nil)
412+
topics, _, err := client.Search.Repositories(context.Background(), "in:topic modalfilemanager in:topic theme", nil)
413+
if err == nil {
414+
total := *topics.Total;
415+
result = make([]GitHubRepos, total, total)
416+
for i := 0; i<total; i++ {
417+
result[i].ID = *topics.Repositories[i].ID
418+
result[i].Name = *topics.Repositories[i].Name
419+
result[i].Owner = *topics.Repositories[i].Owner.Login
420+
result[i].URL = *topics.Repositories[i].CloneURL
421+
result[i].Stars = *topics.Repositories[i].StargazersCount
422+
result[i].Description = *topics.Repositories[i].Description
423+
}
424+
}
425+
return result
426+
}
427+
428+
func (b *App) GetGitHubScripts() []GitHubRepos {
429+
var result []GitHubRepos
430+
client := github.NewClient(nil)
431+
topics, _, err := client.Search.Repositories(context.Background(), "in:topic modalfilemanager in:topic V2 in:topic extension", nil)
432+
if err == nil {
433+
total := *topics.Total;
434+
result = make([]GitHubRepos, total, total)
435+
for i := 0; i<total; i++ {
436+
result[i].ID = *topics.Repositories[i].ID
437+
result[i].Name = *topics.Repositories[i].Name
438+
result[i].Owner = *topics.Repositories[i].Owner.Login
439+
result[i].URL = *topics.Repositories[i].CloneURL
440+
result[i].Stars = *topics.Repositories[i].StargazersCount
441+
result[i].Description = *topics.Repositories[i].Description
442+
}
443+
}
444+
return result
445+
}
446+
447+

frontend/dist/wailsjs/runtime/runtime.d.ts

+12-4
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,24 @@ export interface EnvironmentInfo {
3838
export function EventsEmit(eventName: string, ...data: any): void;
3939

4040
// [EventsOn](https://wails.io/docs/reference/runtime/events#eventson) sets up a listener for the given event name.
41-
export function EventsOn(eventName: string, callback: (...data: any) => void): void;
41+
export function EventsOn(eventName: string, callback: (...data: any) => void): () => void;
4242

4343
// [EventsOnMultiple](https://wails.io/docs/reference/runtime/events#eventsonmultiple)
4444
// sets up a listener for the given event name, but will only trigger a given number times.
45-
export function EventsOnMultiple(eventName: string, callback: (...data: any) => void, maxCallbacks: number): void;
45+
export function EventsOnMultiple(eventName: string, callback: (...data: any) => void, maxCallbacks: number): () => void;
4646

4747
// [EventsOnce](https://wails.io/docs/reference/runtime/events#eventsonce)
4848
// sets up a listener for the given event name, but will only trigger once.
49-
export function EventsOnce(eventName: string, callback: (...data: any) => void): void;
49+
export function EventsOnce(eventName: string, callback: (...data: any) => void): () => void;
5050

51-
// [EventsOff](https://wails.io/docs/reference/runtime/events#eventsff)
51+
// [EventsOff](https://wails.io/docs/reference/runtime/events#eventsoff)
5252
// unregisters the listener for the given event name.
5353
export function EventsOff(eventName: string, ...additionalEventNames: string[]): void;
5454

55+
// [EventsOffAll](https://wails.io/docs/reference/runtime/events#eventsoffall)
56+
// unregisters all listeners.
57+
export function EventsOffAll(): void;
58+
5559
// [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
5660
// logs the given message as a raw message
5761
export function LogPrint(message: string): void;
@@ -89,6 +93,10 @@ export function WindowReload(): void;
8993
// Reloads the application frontend.
9094
export function WindowReloadApp(): void;
9195

96+
// [WindowSetAlwaysOnTop](https://wails.io/docs/reference/runtime/window#windowsetalwaysontop)
97+
// Sets the window AlwaysOnTop or not on top.
98+
export function WindowSetAlwaysOnTop(b: boolean): void;
99+
92100
// [WindowSetSystemDefaultTheme](https://wails.io/docs/next/reference/runtime/window#windowsetsystemdefaulttheme)
93101
// *Windows only*
94102
// Sets window theme to system default (dark/light).

frontend/dist/wailsjs/runtime/runtime.js

+4
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ export function WindowReloadApp() {
6565
window.runtime.WindowReloadApp();
6666
}
6767

68+
export function WindowSetAlwaysOnTop(b) {
69+
window.runtime.WindowSetAlwaysOnTop(b);
70+
}
71+
6872
export function WindowSetSystemDefaultTheme() {
6973
window.runtime.WindowSetSystemDefaultTheme();
7074
}

0 commit comments

Comments
 (0)