diff --git a/src/console.go b/src/console.go index a5abe70..e7db585 100644 --- a/src/console.go +++ b/src/console.go @@ -54,7 +54,7 @@ func (c *Console) Start() { progressBar = progressbar.New(2) filename := filepath.Join(c.baseFolder, settings.TITLE_JSON_FILENAME) - titleFile, titlesEtag, err := db.LoadAndUpdateFile(settings.TITLES_JSON_URL, filename, settingsObj.TitlesEtag) + titleFile, titlesEtag, err := db.LoadAndUpdateFile(settingsObj.TitlesJsonUrl, filename, settingsObj.TitlesEtag) if err != nil { fmt.Printf("title json file doesn't exist\n") return @@ -63,7 +63,7 @@ func (c *Console) Start() { progressBar.Add(1) //2. load the versions JSON object filename = filepath.Join(c.baseFolder, settings.VERSIONS_JSON_FILENAME) - versionsFile, versionsEtag, err := db.LoadAndUpdateFile(settings.VERSIONS_JSON_URL, filename, settingsObj.VersionsEtag) + versionsFile, versionsEtag, err := db.LoadAndUpdateFile(settingsObj.VersionsJsonUrl, filename, settingsObj.VersionsEtag) if err != nil { fmt.Printf("version json file doesn't exist\n") return diff --git a/src/gui.go b/src/gui.go index 4f05864..ba2a23c 100644 --- a/src/gui.go +++ b/src/gui.go @@ -380,7 +380,7 @@ func (g *GUI) buildSwitchDb() (*db.SwitchTitlesDB, error) { //1. load the titles JSON object g.UpdateProgress(1, 4, "Downloading titles.json") filename := filepath.Join(g.baseFolder, settings.TITLE_JSON_FILENAME) - titleFile, titlesEtag, err := db.LoadAndUpdateFile(settings.TITLES_JSON_URL, filename, settingsObj.TitlesEtag) + titleFile, titlesEtag, err := db.LoadAndUpdateFile(settingsObj.TitlesJsonUrl, filename, settingsObj.TitlesEtag) if err != nil { return nil, errors.New("failed to download switch titles [reason:" + err.Error() + "]") } @@ -388,7 +388,7 @@ func (g *GUI) buildSwitchDb() (*db.SwitchTitlesDB, error) { g.UpdateProgress(2, 4, "Downloading versions.json") filename = filepath.Join(g.baseFolder, settings.VERSIONS_JSON_FILENAME) - versionsFile, versionsEtag, err := db.LoadAndUpdateFile(settings.VERSIONS_JSON_URL, filename, settingsObj.VersionsEtag) + versionsFile, versionsEtag, err := db.LoadAndUpdateFile(settingsObj.VersionsJsonUrl, filename, settingsObj.VersionsEtag) if err != nil { return nil, errors.New("failed to download switch updates [reason:" + err.Error() + "]") } diff --git a/src/settings/settings.go b/src/settings/settings.go index 6096675..eb9cfdc 100644 --- a/src/settings/settings.go +++ b/src/settings/settings.go @@ -17,13 +17,13 @@ var ( ) const ( - SETTINGS_FILENAME = "settings.json" - TITLE_JSON_FILENAME = "titles.json" - VERSIONS_JSON_FILENAME = "versions.json" - SLM_VERSION = "1.5.0" - TITLES_JSON_URL = "https://tinfoil.media/repo/db/titles.json" - VERSIONS_JSON_URL = "https://raw.githubusercontent.com/blawar/titledb/master/versions.json" - SLM_VERSION_URL = "https://raw.githubusercontent.com/trembon/switch-library-manager/master/version.json" + SETTINGS_FILENAME = "settings.json" + TITLE_JSON_FILENAME = "titles.json" + VERSIONS_JSON_FILENAME = "versions.json" + SLM_VERSION = "1.5.0" + DEFAULT_TITLES_JSON_URL = "https://tinfoil.media/repo/db/titles.json" + DEFAULT_VERSIONS_JSON_URL = "https://raw.githubusercontent.com/blawar/titledb/master/versions.json" + SLM_VERSION_URL = "https://raw.githubusercontent.com/trembon/switch-library-manager/master/version.json" ) const ( @@ -47,7 +47,9 @@ type OrganizeOptions struct { } type AppSettings struct { + VersionsJsonUrl string `json:"versions_json_url"` VersionsEtag string `json:"versions_etag"` + TitlesJsonUrl string `json:"titles_json_url"` TitlesEtag string `json:"titles_etag"` Prodkeys string `json:"prod_keys"` Folder string `json:"folder"` @@ -95,7 +97,9 @@ func ReadSettings(baseFolder string) *AppSettings { func saveDefaultSettings(baseFolder string) *AppSettings { settingsInstance = &AppSettings{ + TitlesJsonUrl: DEFAULT_TITLES_JSON_URL, TitlesEtag: "W/\"a5b02845cf6bd61:0\"", + VersionsJsonUrl: DEFAULT_VERSIONS_JSON_URL, VersionsEtag: "W/\"2ef50d1cb6bd61:0\"", Folder: "", ScanFolders: []string{},