Skip to content
This repository has been archived by the owner on Mar 30, 2023. It is now read-only.

Commit

Permalink
make paths absolute, keep launch_path. Fixes Issue#41
Browse files Browse the repository at this point in the history
  • Loading branch information
ozten committed Jun 25, 2014
1 parent 1512e0c commit 637eb10
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
12 changes: 10 additions & 2 deletions server/routes/app_install.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,16 @@ module.exports = function(config) {
return res.send('Unable to find version', 404);
}
aVersion.icon_url = Icon.url(aVersion);
aVersion.manifest_url = '/manifest/v/' + aVersion.id + '/app/' + encodeURIComponent(appCode) + '/manifest.webapp';
ctx.signedPackage = '/packaged/v/' + aVersion.id + '/app/' + encodeURIComponent(appCode) + '/package.zip';

aVersion.manifest_url = [
config.publicUrl, 'manifest/v', aVersion.id, 'app',
encodeURIComponent(appCode), 'manifest.webapp'
].join('/');

ctx.signedPackage = [
'packaged/v', aVersion.id, 'app',
encodeURIComponent(appCode), 'package.zip'].join('/');

ctx.signedPackageSize = aVersion.signed_package_size + 'kb';
ctx.version = aVersion;
Version.versionList(anApp, function(err, versions) {
Expand Down
10 changes: 6 additions & 4 deletions server/routes/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ module.exports = function(config) {
return res.send('Unable to load latest version', 500);
}

delete aVersion.manifest.launch_path;
aVersion.manifest.package_path =
'/packaged/v/' + aVersion.id + '/app/' + encodeURIComponent(appCode) + '/package.zip';
//delete aVersion.manifest.launch_path;
aVersion.manifest.package_path = [
config.publicUrl, 'packaged/v', aVersion.id, 'app',
encodeURIComponent(appCode), 'package.zip'
].join('/');
aVersion.manifest.size = aVersion.signed_package_size;

if (!! aVersion.manifest.installs_allowed_from &&
if ( !! aVersion.manifest.installs_allowed_from &&
1 === aVersion.manifest.installs_allowed_from.length &&
'*' === aVersion.manifest.installs_allowed_from[0]) {
// BetaFox installs will work from '*', NO-OP
Expand Down
3 changes: 1 addition & 2 deletions www/js/app_install.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@

install.addEventListener('click', function f(e) {
var url = install.getAttribute('data-package-manifest-url');
url = location.origin + url;
var request = navigator.mozApps.installPackage(url);
request.onsuccess = function() {
// if (!this.result || !this.result.manifest) {
// return alert('Install failed without error');
// }
alert('Installed!');
// TODO replace "install" button with 'installed' widget
};
request.onerror = function() {
alert(this.error.name);
Expand Down

0 comments on commit 637eb10

Please sign in to comment.