-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* frontend: properly handle empty repositories * frontend: add non-free software switch * frontend: refresh when coming back to browser panel * services: get rid of elevate-service symlink, remove legacy script
- Loading branch information
1 parent
479f0d2
commit 9dbc87a
Showing
6 changed files
with
77 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
var repositoryBaseURL = 'https://repo.webosbrew.org/api/apps.json'; | ||
var repositoryNonfreeBaseURL = 'https://repo.webosbrew.org/api/non-free/apps.json'; | ||
|
||
function getConfig() { | ||
var repositoriesConfig = { | ||
repositories: [], | ||
disableDefault: false, | ||
enableNonfree: false, | ||
}; | ||
|
||
try { | ||
var parsed = JSON.parse(window.localStorage['repositoriesConfig']); | ||
if (parsed.disableDefault !== undefined) | ||
repositoriesConfig.disableDefault = parsed.disableDefault; | ||
if (parsed.repositories !== undefined) | ||
repositoriesConfig.repositories = parsed.repositories; | ||
if (parsed.enableNonfree !== undefined) | ||
repositoriesConfig.enableNonfree = parsed.enableNonfree; | ||
} catch (err) { | ||
console.warn('Config load failed:', err); | ||
} | ||
|
||
return repositoriesConfig; | ||
} | ||
|
||
function getRepositories() { | ||
try { | ||
var repositoriesConfig = getConfig(); | ||
var repos = repositoriesConfig.repositories.map(function (repo) { return repo.url; }); | ||
if (!repositoriesConfig.disableDefault) repos.push(repositoryBaseURL); | ||
if (repositoriesConfig.enableNonfree) repos.push(repositoryNonfreeBaseURL); | ||
return repos; | ||
} catch (err) { | ||
console.warn(err); | ||
return [repositoryBaseURL]; | ||
} | ||
} | ||
|
||
function setConfig(config) { | ||
window.localStorage['repositoriesConfig'] = JSON.stringify(config); | ||
console.info(window.localStorage['repositoriesConfig']); | ||
} | ||
|
||
module.exports = { | ||
repositoryBaseURL: repositoryBaseURL, | ||
|
||
getRepositories: getRepositories, | ||
getConfig: getConfig, | ||
setConfig: setConfig, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.