Skip to content

Commit

Permalink
Major fixes to GitHub import with new build
Browse files Browse the repository at this point in the history
  • Loading branch information
raguay committed Jan 18, 2023
1 parent b771db2 commit fbc3c42
Show file tree
Hide file tree
Showing 21 changed files with 559 additions and 1,600 deletions.
50 changes: 50 additions & 0 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
clip "github.com/atotto/clipboard"
cp "github.com/otiai10/copy"
watcher "github.com/radovskyb/watcher"
github "github.com/google/go-github/v49/github"
wailsruntime "github.com/wailsapp/wails/v2/pkg/runtime"
"io"
"io/ioutil"
Expand Down Expand Up @@ -50,6 +51,15 @@ type WatcherInfo struct {
SigName string
}

type GitHubRepos struct {
Name string `json:"name"`
URL string `json:"url"`
Stars int `json:"stars"`
Owner string `json:"owner"`
ID int64 `json:"id"`
Description string `json:"description"`
}

// NewApp creates a new App application struct
func NewApp() *App {
return &App{}
Expand Down Expand Up @@ -395,3 +405,43 @@ func (b *App) GetOSName() string {
}
return result
}

func (b *App) GetGitHubThemes() []GitHubRepos {
var result []GitHubRepos
client := github.NewClient(nil)
topics, _, err := client.Search.Repositories(context.Background(), "in:topic modalfilemanager in:topic theme", nil)
if err == nil {
total := *topics.Total;
result = make([]GitHubRepos, total, total)
for i := 0; i<total; i++ {
result[i].ID = *topics.Repositories[i].ID
result[i].Name = *topics.Repositories[i].Name
result[i].Owner = *topics.Repositories[i].Owner.Login
result[i].URL = *topics.Repositories[i].CloneURL
result[i].Stars = *topics.Repositories[i].StargazersCount
result[i].Description = *topics.Repositories[i].Description
}
}
return result
}

func (b *App) GetGitHubScripts() []GitHubRepos {
var result []GitHubRepos
client := github.NewClient(nil)
topics, _, err := client.Search.Repositories(context.Background(), "in:topic modalfilemanager in:topic V2 in:topic extension", nil)
if err == nil {
total := *topics.Total;
result = make([]GitHubRepos, total, total)
for i := 0; i<total; i++ {
result[i].ID = *topics.Repositories[i].ID
result[i].Name = *topics.Repositories[i].Name
result[i].Owner = *topics.Repositories[i].Owner.Login
result[i].URL = *topics.Repositories[i].CloneURL
result[i].Stars = *topics.Repositories[i].StargazersCount
result[i].Description = *topics.Repositories[i].Description
}
}
return result
}


16 changes: 12 additions & 4 deletions frontend/dist/wailsjs/runtime/runtime.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,24 @@ export interface EnvironmentInfo {
export function EventsEmit(eventName: string, ...data: any): void;

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

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

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

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

// [EventsOffAll](https://wails.io/docs/reference/runtime/events#eventsoffall)
// unregisters all listeners.
export function EventsOffAll(): void;

// [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
// logs the given message as a raw message
export function LogPrint(message: string): void;
Expand Down Expand Up @@ -89,6 +93,10 @@ export function WindowReload(): void;
// Reloads the application frontend.
export function WindowReloadApp(): void;

// [WindowSetAlwaysOnTop](https://wails.io/docs/reference/runtime/window#windowsetalwaysontop)
// Sets the window AlwaysOnTop or not on top.
export function WindowSetAlwaysOnTop(b: boolean): void;

// [WindowSetSystemDefaultTheme](https://wails.io/docs/next/reference/runtime/window#windowsetsystemdefaulttheme)
// *Windows only*
// Sets window theme to system default (dark/light).
Expand Down
4 changes: 4 additions & 0 deletions frontend/dist/wailsjs/runtime/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export function WindowReloadApp() {
window.runtime.WindowReloadApp();
}

export function WindowSetAlwaysOnTop(b) {
window.runtime.WindowSetAlwaysOnTop(b);
}

export function WindowSetSystemDefaultTheme() {
window.runtime.WindowSetSystemDefaultTheme();
}
Expand Down
Loading

0 comments on commit fbc3c42

Please sign in to comment.