Skip to content
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

User application installation and discovery support (#106) #107

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Configurable package location paths (#106)
  • Loading branch information
andersevenrud committed Apr 11, 2020
commit 1de1c61be95b35628e0598d164f7e7c7dbfdb3ba
3 changes: 3 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ export const defaultConfiguration = {

packages: {
manifest: '/api/packages/manifest',
vfsPaths: [
'home:/.packages'
],
metadata: []
},

Expand Down
8 changes: 6 additions & 2 deletions src/packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,12 @@ export default class Packages {

const manifest = this.core.config('packages.manifest');

const query = this.core.config('packages.vfsPaths', [])
.map(str => `root[]=${encodeURIComponent(str)}`)
.join('&');

return manifest
? this.core.request(manifest, {}, 'json')
? this.core.request(`${manifest}?${query}`, {}, 'json')
.then(metadata => this.addPackages(metadata))
.then(() => true)
.catch(error => logger.error(error))
Expand Down Expand Up @@ -390,7 +394,7 @@ export default class Packages {
if (list instanceof Array) {
const append = list
.map(iter => Object.assign({
_user: false,
_vfs: null,
type: 'application',
files: []
}, iter));
Expand Down
4 changes: 2 additions & 2 deletions src/utils/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ export const urlResolver = configuration => {
metadata.type === 'icons' ? 'icons' : 'apps'
);

if (metadata._user) {
url = `vfs/readfile?path=${encodeURIComponent(`home:/.packages/${metadata.name}${path}`)}`;
if (metadata._vfs) {
url = `vfs/readfile?path=${encodeURIComponent(`${metadata._vfs}/${metadata.name}${path}`)}`;
} else {
url = `${type}/${metadata.name}${path}`;
}
Expand Down