mirror of
https://github.com/moparisthebest/kaiwa
synced 2024-10-31 15:45:09 -04:00
Add option to install locally with firefox
This commit is contained in:
parent
17d3882a8a
commit
943dff7b69
@ -24,6 +24,16 @@ module.exports = HumanModel.define({
|
|||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (navigator.mozApps) {
|
||||||
|
this.installable = true;
|
||||||
|
var req = navigator.mozApps.checkInstalled(window.location.origin + '/manifest.webapp');
|
||||||
|
req.onsuccess = function (e) {
|
||||||
|
if (req.result) {
|
||||||
|
self.installedFirefox = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
this.markActive();
|
this.markActive();
|
||||||
},
|
},
|
||||||
session: {
|
session: {
|
||||||
@ -35,7 +45,9 @@ module.exports = HumanModel.define({
|
|||||||
idleSince: 'date',
|
idleSince: 'date',
|
||||||
allowAlerts: ['bool', true, false],
|
allowAlerts: ['bool', true, false],
|
||||||
badge: ['string', true, ''],
|
badge: ['string', true, ''],
|
||||||
pageTitle: ['string', true, '']
|
pageTitle: ['string', true, ''],
|
||||||
|
installable: ['bool', true, false],
|
||||||
|
installedFirefox: ['bool', true, false]
|
||||||
},
|
},
|
||||||
derived: {
|
derived: {
|
||||||
title: {
|
title: {
|
||||||
|
@ -19,6 +19,7 @@ module.exports = BasePage.extend({
|
|||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
'click .enableAlerts': 'enableAlerts',
|
'click .enableAlerts': 'enableAlerts',
|
||||||
|
'click .installFirefox': 'installFirefox',
|
||||||
'dragover': 'handleAvatarChangeDragOver',
|
'dragover': 'handleAvatarChangeDragOver',
|
||||||
'drop': 'handleAvatarChange',
|
'drop': 'handleAvatarChange',
|
||||||
'change #uploader': 'handleAvatarChange',
|
'change #uploader': 'handleAvatarChange',
|
||||||
@ -39,6 +40,9 @@ module.exports = BasePage.extend({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
installFirefox: function () {
|
||||||
|
navigator.mozApps.install(window.location.origin + '/manifest.webapp');
|
||||||
|
},
|
||||||
handleAvatarChangeDragOver: function (e) {
|
handleAvatarChangeDragOver: function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return false;
|
return false;
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
</header>
|
</header>
|
||||||
<section class="box connect">
|
<section class="box connect">
|
||||||
<h2>Connecting...</h2>
|
<h2>Connecting...</h2>
|
||||||
|
<a href="/logout">Cancel</a>
|
||||||
</section>
|
</section>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -178,7 +178,7 @@ exports.pages.groupchat = function anonymous(locals) {
|
|||||||
exports.pages.main = function anonymous(locals) {
|
exports.pages.main = function anonymous(locals) {
|
||||||
var buf = [];
|
var buf = [];
|
||||||
with (locals || {}) {
|
with (locals || {}) {
|
||||||
buf.push('<section class="page main"><div><h3>Current status</h3><div contenteditable="true" class="status"></div></div><div id="avatarChanger"><h3>Change Avatar</h3><div class="uploadRegion"><p>Drag and drop a new avatar here</p><img/><form><input id="uploader" type="file"/></form></div></div><div><h3>Alerts</h3><button class="enableAlerts">Enable alerts</button></div></section>');
|
buf.push('<section class="page main"><div><h3>Current status</h3><div contenteditable="true" class="status"></div></div><div id="avatarChanger"><h3>Change Avatar</h3><div class="uploadRegion"><p>Drag and drop a new avatar here</p><img/><form><input id="uploader" type="file"/></form></div></div><div><h3>Desktop Integration</h3><button class="enableAlerts">Enable alerts</button><button class="installFirefox">Install app</button></div></section>');
|
||||||
}
|
}
|
||||||
return buf.join("");
|
return buf.join("");
|
||||||
};
|
};
|
||||||
|
@ -13,5 +13,6 @@ section.page.main
|
|||||||
input#uploader(type="file")
|
input#uploader(type="file")
|
||||||
|
|
||||||
div
|
div
|
||||||
h3 Alerts
|
h3 Desktop Integration
|
||||||
button.enableAlerts Enable alerts
|
button.enableAlerts Enable alerts
|
||||||
|
button.installFirefox Install app
|
||||||
|
BIN
public/images/icon_128x128.png
Normal file
BIN
public/images/icon_128x128.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.3 KiB |
7
public/manifest.webapp
Normal file
7
public/manifest.webapp
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"name": "Otalk",
|
||||||
|
"description": "Modern XMPP client",
|
||||||
|
"icons": {
|
||||||
|
"128": "/images/icon_128x128.png"
|
||||||
|
}
|
||||||
|
}
|
@ -54,6 +54,11 @@ app.get('/oauth/callback', function (req, res) {
|
|||||||
res.render('oauthLogin');
|
res.render('oauthLogin');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.get('/manifest.webapp', function (req, res) {
|
||||||
|
res.set('Content-Type', 'application/x-web-app-manifest+json');
|
||||||
|
res.sent(fs.readFileSync('public/manifest.webapp'));
|
||||||
|
});
|
||||||
|
|
||||||
// serves app on every other url
|
// serves app on every other url
|
||||||
app.get('*', clientApp.html());
|
app.get('*', clientApp.html());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user