Skip to content

Add CI #401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions apps/finicky/src/browser/launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var browsersJsonData []byte

type BrowserResult struct {
Browser BrowserConfig `json:"browser"`
Error string `json:"error"`
Error string `json:"error"`
}

type BrowserConfig struct {
Expand All @@ -33,9 +33,9 @@ type BrowserConfig struct {

type browserInfo struct {
ConfigDirRelative string `json:"config_dir_relative"`
ID string `json:"id"`
AppName string `json:"app_name"`
Type string `json:"type"`
ID string `json:"id"`
AppName string `json:"app_name"`
Type string `json:"type"`
}

func LaunchBrowser(config BrowserConfig, dryRun bool) error {
Expand Down Expand Up @@ -146,7 +146,7 @@ func resolveBrowserProfileArgument(identifier string, profile string) (string, b

slog.Debug("Browser found in browsers.json", "identifier", identifier, "type", matchedBrowser.Type)

if profile != "" {
if profile != "" {
switch matchedBrowser.Type {
case "Chromium":
homeDir, err := os.UserHomeDir()
Expand Down
57 changes: 27 additions & 30 deletions apps/finicky/src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type ProcessInfo struct {
}

type UpdateInfo struct {
ReleaseInfo *version.ReleaseInfo
ReleaseInfo *version.ReleaseInfo
UpdateCheckEnabled bool
}

Expand All @@ -48,16 +48,17 @@ type URLInfo struct {
}

type ConfigInfo struct {
Handlers int16
Rewrites int16
Handlers int16
Rewrites int16
DefaultBrowser string
ConfigPath string
ConfigPath string
}

// FIXME: Clean up app global stae
var urlListener chan URLInfo = make(chan URLInfo)
var windowClosed chan struct{} = make(chan struct{})
var vm *config.VM

// FIXME: find a better data type for this
var forceWindowOpen int32 = 0
var queueWindowOpen chan bool = make(chan bool)
Expand Down Expand Up @@ -90,7 +91,7 @@ func main() {

dryRun = *dryRunPtr

currentVersion := version.GetCurrentVersion();
currentVersion := version.GetCurrentVersion()
commitHash, buildDate := version.GetBuildInfo()
slog.Info("Starting Finicky", "version", currentVersion)
slog.Debug("Build info", "buildDate", buildDate, "commitHash", commitHash)
Expand Down Expand Up @@ -148,12 +149,12 @@ func main() {

if browserConfig == nil {
browserConfig = &browser.BrowserConfig{
Name: "com.apple.Safari",
AppType: "bundleId",
Name: "com.apple.Safari",
AppType: "bundleId",
OpenInBackground: false,
Profile: "",
Args: []string{},
URL: urlInfo.URL,
Profile: "",
Args: []string{},
URL: urlInfo.URL,
}
}

Expand Down Expand Up @@ -233,7 +234,6 @@ func evaluateURL(vm *goja.Runtime, url string, opener *ProcessInfo) (*browser.Br
url = resolvedURL
}


vm.Set("url", resolvedURL)

if opener != nil {
Expand Down Expand Up @@ -320,7 +320,7 @@ func checkForUpdates() {
}

updateInfo = UpdateInfo{
ReleaseInfo: releaseInfo,
ReleaseInfo: releaseInfo,
UpdateCheckEnabled: updateCheckEnabled,
}

Expand All @@ -330,19 +330,19 @@ func checkForUpdates() {

if updateInfo.ReleaseInfo != nil {
window.SendMessageToWebView("updateInfo", map[string]interface{}{
"version": updateInfo.ReleaseInfo.LatestVersion,
"hasUpdate": updateInfo.ReleaseInfo.HasUpdate,
"version": updateInfo.ReleaseInfo.LatestVersion,
"hasUpdate": updateInfo.ReleaseInfo.HasUpdate,
"updateCheckEnabled": updateInfo.UpdateCheckEnabled,
"downloadUrl": updateInfo.ReleaseInfo.DownloadUrl,
"releaseUrl": updateInfo.ReleaseInfo.ReleaseUrl,
"downloadUrl": updateInfo.ReleaseInfo.DownloadUrl,
"releaseUrl": updateInfo.ReleaseInfo.ReleaseUrl,
})
} else {
window.SendMessageToWebView("updateInfo", map[string]interface{}{
"version": "",
"hasUpdate": false,
"version": "",
"hasUpdate": false,
"updateCheckEnabled": updateInfo.UpdateCheckEnabled,
"downloadUrl": "",
"releaseUrl": "",
"downloadUrl": "",
"releaseUrl": "",
})
}
}
Expand Down Expand Up @@ -384,23 +384,23 @@ func setupVM(cfw *config.ConfigFileWatcher, embeddedFS embed.FS, namespace strin
if currentConfigState != nil {
configInfo = &ConfigInfo{
Handlers: currentConfigState.Handlers,
Rewrites: currentConfigState.Rewrites,
Rewrites: currentConfigState.Rewrites,
DefaultBrowser: currentConfigState.DefaultBrowser,
ConfigPath: strings.Replace(configPath, os.Getenv("HOME"), "~", 1),
}

window.SendMessageToWebView("config", map[string]interface{}{
"handlers": configInfo.Handlers,
"rewrites": configInfo.Rewrites,
"handlers": configInfo.Handlers,
"rewrites": configInfo.Rewrites,
"defaultBrowser": configInfo.DefaultBrowser,
"configPath": configInfo.ConfigPath,
"configPath": configInfo.ConfigPath,
})
} else {
window.SendMessageToWebView("config", map[string]interface{}{
"handlers": 0,
"rewrites": 0,
"handlers": 0,
"rewrites": 0,
"defaultBrowser": "",
"configPath": configInfo.ConfigPath,
"configPath": configInfo.ConfigPath,
})
}

Expand All @@ -409,6 +409,3 @@ func setupVM(cfw *config.ConfigFileWatcher, embeddedFS embed.FS, namespace strin

return nil, nil
}



6 changes: 3 additions & 3 deletions packages/finicky-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.