Browse Source

Format abea666

pull/3163/head
prettifier[bot] 4 years ago committed by GitHub
parent
commit
92a4ee0745
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 730
      app/Application.js
  2. 75
      app/store/ServicesList.js
  3. 640
      app/ux/Auth0.js
  4. 1777
      app/ux/WebView.js
  5. 1209
      app/view/main/MainController.js
  6. 778
      app/view/preferences/Preferences.js
  7. 64
      electron/main.js
  8. 478
      package.json
  9. 22
      resources/js/darkreader.js
  10. 9
      resources/js/rambox-service-api.js
  11. 253
      resources/languages/en.js

730
app/Application.js

@ -1,334 +1,444 @@
Ext.define('Rambox.Application', { Ext.define("Rambox.Application", {
extend: 'Ext.app.Application' extend: "Ext.app.Application",
,name: 'Rambox' name: "Rambox",
,requires: [ requires: [
'Rambox.ux.Auth0' "Rambox.ux.Auth0",
,'Rambox.util.MD5' "Rambox.util.MD5",
,'Ext.window.Toast' "Ext.window.Toast",
,'Ext.util.Cookies' "Ext.util.Cookies",
] ],
,stores: [ stores: ["ServicesList", "Services"],
'ServicesList'
,'Services'
]
,profiles: [ profiles: ["Offline", "Online"],
'Offline'
,'Online'
]
,config: { config: {
totalServicesLoaded: 0 totalServicesLoaded: 0,
,totalNotifications: 0 totalNotifications: 0,
,googleURLs: [] googleURLs: [],
} },
,launch: function () { launch: function () {
const isOnline = require("is-online");
const Mousetrap = require("mousetrap");
(async () => {
await isOnline().then((res) => {
var hideNoConnection = ipc.sendSync("getConfig").hideNoConnectionDialog;
if (!res && !hideNoConnection) {
Ext.get("spinner") ? Ext.get("spinner").destroy() : null;
Ext.get("background") ? Ext.get("background").destroy() : null;
Ext.Msg.show({
title: "No Internet Connection",
msg:
"Please, check your internet connection. If you use a Proxy, please go to Preferences to configure it. Rambox will try to re-connect in 10 seconds",
width: 300,
closable: false,
buttons: Ext.Msg.YESNO,
buttonText: {
yes: "Ok",
no: "Never show this again",
},
multiline: false,
fn: function (buttonValue, inputText, showConfig) {
if (buttonValue === "no") {
ipc.send("sConfig", { hideNoConnectionDialog: true });
hideNoConnection = true;
}
},
icon: Ext.Msg.QUESTION,
});
setTimeout(function () {
if (!hideNoConnection) ipc.send("reloadApp");
}, 10000);
}
});
})();
const isOnline = require('is-online'); if (
const Mousetrap = require('mousetrap'); !localStorage.getItem("hideMacPermissions") &&
(async () => { process.platform === "darwin" &&
await isOnline().then(res => { (require("electron").remote.systemPreferences.getMediaAccessStatus(
var hideNoConnection = ipc.sendSync('getConfig').hideNoConnectionDialog "microphone"
if ( !res && !hideNoConnection ) { ) !== "granted" ||
Ext.get('spinner') ? Ext.get('spinner').destroy() : null; require("electron").remote.systemPreferences.getMediaAccessStatus(
Ext.get('background') ? Ext.get('background').destroy() : null; "camera"
Ext.Msg.show({ ) !== "granted")
title: 'No Internet Connection' ) {
,msg: 'Please, check your internet connection. If you use a Proxy, please go to Preferences to configure it. Rambox will try to re-connect in 10 seconds' console.info("Checking mac permissions...");
,width: 300 Ext.cq1("app-main").addDocked({
,closable: false xtype: "toolbar",
,buttons: Ext.Msg.YESNO dock: "top",
,buttonText: { style: { background: "#30BBF3" },
yes: 'Ok' items: [
,no: 'Never show this again' "->",
} {
,multiline: false xtype: "label",
,fn: function(buttonValue, inputText, showConfig) { html:
if ( buttonValue === 'no' ) { "<b>Rambox CE needs permissions to use Microphone and Camera for the apps.</b>",
ipc.send('sConfig', { hideNoConnectionDialog: true }); },
hideNoConnection = true; {
} xtype: "button",
} text: "Grant permissions",
,icon: Ext.Msg.QUESTION ui: "decline",
}); handler: async function (btn) {
setTimeout(function() { await require("electron").remote.systemPreferences.askForMediaAccess(
if ( !hideNoConnection ) ipc.send('reloadApp') "microphone"
}, 10000) );
} await require("electron").remote.systemPreferences.askForMediaAccess(
}) "camera"
})(); );
Ext.cq1("app-main").removeDocked(btn.up("toolbar"), true);
},
},
{
xtype: "button",
text: "Never ask again",
ui: "decline",
handler: function (btn) {
Ext.cq1("app-main").removeDocked(btn.up("toolbar"), true);
localStorage.setItem("hideMacPermissions", true);
},
},
"->",
{
glyph: "xf00d@FontAwesome",
baseCls: "",
style: "cursor:pointer;",
handler: function (btn) {
Ext.cq1("app-main").removeDocked(btn.up("toolbar"), true);
},
},
],
});
}
if ( !localStorage.getItem('hideMacPermissions') && process.platform === 'darwin' && (require('electron').remote.systemPreferences.getMediaAccessStatus('microphone') !== 'granted' || require('electron').remote.systemPreferences.getMediaAccessStatus('camera') !== 'granted') ) { Ext.getStore("ServicesList").load(function (records, operations, success) {
console.info('Checking mac permissions...'); if (!success) {
Ext.cq1('app-main').addDocked({ Ext.cq1("app-main").addDocked({
xtype: 'toolbar' xtype: "toolbar",
,dock: 'top' dock: "top",
,style: {background: '#30BBF3'} ui: "servicesnotloaded",
,items: [ style: { background: "#efef6d" },
'->' items: [
,{ "->",
xtype: 'label' {
,html: '<b>Rambox CE needs permissions to use Microphone and Camera for the apps.</b>' xtype: "label",
} html:
,{ "<b>Services couldn't be loaded, some Rambox features will not be available.</b>",
xtype: 'button' },
,text: 'Grant permissions' {
,ui: 'decline' xtype: "button",
,handler: async function(btn) { text: "Reload",
await require('electron').remote.systemPreferences.askForMediaAccess('microphone'); handler: function () {
await require('electron').remote.systemPreferences.askForMediaAccess('camera'); ipc.send("reloadApp");
Ext.cq1('app-main').removeDocked(btn.up('toolbar'), true); },
} },
} "->",
,{ {
xtype: 'button' glyph: "xf00d@FontAwesome",
,text: 'Never ask again' baseCls: "",
,ui: 'decline' style: "cursor:pointer;",
,handler: function(btn) { handler: function (btn) {
Ext.cq1('app-main').removeDocked(btn.up('toolbar'), true); Ext.cq1("app-main").removeDocked(btn.up("toolbar"), true);
localStorage.setItem('hideMacPermissions', true); },
} },
} ],
,'->' });
,{ }
glyph: 'xf00d@FontAwesome' // Prevent track if the user have disabled this option (default: false)
,baseCls: '' if (!ipc.sendSync("sendStatistics")) {
,style: 'cursor:pointer;' ga_storage = {
,handler: function(btn) { Ext.cq1('app-main').removeDocked(btn.up('toolbar'), true); } _enableSSL: Ext.emptyFn,
} _disableSSL: Ext.emptyFn,
] _setAccount: Ext.emptyFn,
}); _setDomain: Ext.emptyFn,
} _setLocale: Ext.emptyFn,
_setCustomVar: Ext.emptyFn,
_deleteCustomVar: Ext.emptyFn,
_trackPageview: Ext.emptyFn,
_trackEvent: Ext.emptyFn,
};
}
// Set Google Analytics events
ga_storage._setAccount("UA-80680424-1");
ga_storage._trackPageview("/index.html", "main");
ga_storage._trackEvent(
"Versions",
require("electron").remote.app.getVersion()
);
Ext.getStore('ServicesList').load(function (records, operations, success) { // Load language for Ext JS library
Ext.Loader.loadScript({
url: Ext.util.Format.format(
"ext/packages/ext-locale/build/ext-locale-{0}.js",
localStorage.getItem("locale-auth0") || "en"
),
});
if (!success) { // Initialize Auth0
Ext.cq1('app-main').addDocked({ if (auth0Cfg.clientID !== "" && auth0Cfg.domain !== "")
xtype: 'toolbar' Rambox.ux.Auth0.init();
,dock: 'top'
,ui: 'servicesnotloaded'
,style: { background: '#efef6d' }
,items: [
'->'
,{
xtype: 'label'
,html: '<b>Services couldn\'t be loaded, some Rambox features will not be available.</b>'
}
,{
xtype: 'button'
,text: 'Reload'
,handler: function() { ipc.send('reloadApp'); }
}
,'->'
,{
glyph: 'xf00d@FontAwesome'
,baseCls: ''
,style: 'cursor:pointer;'
,handler: function(btn) { Ext.cq1('app-main').removeDocked(btn.up('toolbar'), true); }
}
]
});
}
// Prevent track if the user have disabled this option (default: false)
if ( !ipc.sendSync('sendStatistics') ) {
ga_storage = {
_enableSSL: Ext.emptyFn
,_disableSSL: Ext.emptyFn
,_setAccount: Ext.emptyFn
,_setDomain: Ext.emptyFn
,_setLocale: Ext.emptyFn
,_setCustomVar: Ext.emptyFn
,_deleteCustomVar: Ext.emptyFn
,_trackPageview: Ext.emptyFn
,_trackEvent: Ext.emptyFn
}
}
// Set Google Analytics events // Set cookies to help Tooltip.io messages segmentation
ga_storage._setAccount('UA-80680424-1'); Ext.util.Cookies.set(
ga_storage._trackPageview('/index.html', 'main'); "version",
ga_storage._trackEvent('Versions', require('electron').remote.app.getVersion()); require("electron").remote.app.getVersion()
);
if (Ext.util.Cookies.get("auth0") === null)
Ext.util.Cookies.set("auth0", false);
// Load language for Ext JS library // Check for updates
Ext.Loader.loadScript({url: Ext.util.Format.format("ext/packages/ext-locale/build/ext-locale-{0}.js", localStorage.getItem('locale-auth0') || 'en')}); if (
require("electron").remote.process.argv.indexOf("--without-update") ===
-1
)
Rambox.app.checkUpdate(true);
// Initialize Auth0 // Get Google URLs
if ( auth0Cfg.clientID !== '' && auth0Cfg.domain !== '' ) Rambox.ux.Auth0.init(); Ext.Ajax.request({
url:
"https://raw.githubusercontent.com/ramboxapp/community-edition/gh-pages/api/google.json",
method: "GET",
success: function (response) {
Rambox.app.config.googleURLs = Ext.decode(response.responseText);
},
});
// Set cookies to help Tooltip.io messages segmentation // Shortcuts
Ext.util.Cookies.set('version', require('electron').remote.app.getVersion()); const platform = require("electron").remote.process.platform;
if ( Ext.util.Cookies.get('auth0') === null ) Ext.util.Cookies.set('auth0', false); // Prevents default behaviour of Mousetrap, that prevents shortcuts in textareas
Mousetrap.prototype.stopCallback = function (e, element, combo) {
return false;
};
// Add shortcuts to switch services using CTRL + Number
Mousetrap.bind(
platform === "darwin"
? [
"command+1",
"command+2",
"command+3",
"command+4",
"command+5",
"command+6",
"command+7",
"command+8",
"command+9",
]
: [
"ctrl+1",
"ctrl+2",
"ctrl+3",
"ctrl+4",
"ctrl+5",
"ctrl+6",
"ctrl+7",
"ctrl+8",
"ctrl+9",
],
function (e, combo) {
// GROUPS
var tabPanel = Ext.cq1("app-main");
var arg = parseInt(e.key);
if (arg >= tabPanel.items.indexOf(Ext.getCmp("tbfill"))) arg++;
tabPanel.setActiveTab(arg);
}
);
// Add shortcut to main tab (ctrl+,)
Mousetrap.bind(
platform === "darwin" ? "command+," : "ctrl+,",
(e, combo) => {
Ext.cq1("app-main").setActiveTab(0);
}
);
// Add shortcuts to navigate through services
Mousetrap.bind(["ctrl+tab", "ctrl+pagedown"], (e, combo) => {
var tabPanel = Ext.cq1("app-main");
var activeIndex = tabPanel.items.indexOf(tabPanel.getActiveTab());
var i = activeIndex + 1;
// "cycle" (go to the start) when the end is reached or the end is the spacer "tbfill"
if (
i === tabPanel.items.items.length ||
(i === tabPanel.items.items.length - 1 &&
tabPanel.items.items[i].id === "tbfill")
)
i = 0;
// skip spacer
while (tabPanel.items.items[i].id === "tbfill") i++;
tabPanel.setActiveTab(i);
});
Mousetrap.bind(["ctrl+shift+tab", "ctrl+pageup"], (e, combo) => {
var tabPanel = Ext.cq1("app-main");
var activeIndex = tabPanel.items.indexOf(tabPanel.getActiveTab());
var i = activeIndex - 1;
if (i < 0) i = tabPanel.items.items.length - 1;
while (tabPanel.items.items[i].id === "tbfill" || i < 0) i--;
tabPanel.setActiveTab(i);
});
// Add shortcut to search inside a service
Mousetrap.bind(
process.platform === "darwin" ? ["command+alt+f"] : ["shift+alt+f"],
(e, combo) => {
var currentTab = Ext.cq1("app-main").getActiveTab();
if (currentTab.getWebView) currentTab.showSearchBox(true);
}
);
// Add shortcut to Do Not Disturb
Mousetrap.bind(
platform === "darwin" ? ["command+alt+d"] : ["shift+alt+d"],
function (e, combo) {
var btn = Ext.getCmp("disturbBtn");
btn.toggle();
Ext.cq1("app-main").getController().dontDisturb(btn, true);
}
);
// Add shortcut to Lock Rambox
Mousetrap.bind(
platform === "darwin" ? ["command+alt+l"] : ["shift+alt+l"],
(e, combo) => {
var btn = Ext.getCmp("lockRamboxBtn");
Ext.cq1("app-main").getController().lockRambox(btn);
}
);
// Check for updates // Mouse Wheel zooming
if ( require('electron').remote.process.argv.indexOf('--without-update') === -1 ) Rambox.app.checkUpdate(true); document.addEventListener("mousewheel", function (e) {
if (e.ctrlKey) {
var delta = Math.max(-1, Math.min(1, e.wheelDelta || -e.detail));
// Get Google URLs var tabPanel = Ext.cq1("app-main");
Ext.Ajax.request({ if (tabPanel.items.indexOf(tabPanel.getActiveTab()) === 0)
url: 'https://raw.githubusercontent.com/ramboxapp/community-edition/gh-pages/api/google.json' return false;
,method: 'GET'
,success: function(response) {
Rambox.app.config.googleURLs = Ext.decode(response.responseText);
}
});
// Shortcuts if (delta === 1) {
const platform = require('electron').remote.process.platform; // Zoom In
// Prevents default behaviour of Mousetrap, that prevents shortcuts in textareas tabPanel.getActiveTab().zoomIn();
Mousetrap.prototype.stopCallback = function(e, element, combo) { } else {
return false; // Zoom Out
}; tabPanel.getActiveTab().zoomOut();
// Add shortcuts to switch services using CTRL + Number }
Mousetrap.bind(platform === 'darwin' ? ["command+1","command+2","command+3","command+4","command+5","command+6","command+7","command+8","command+9"] : ["ctrl+1","ctrl+2","ctrl+3","ctrl+4","ctrl+5","ctrl+6","ctrl+7","ctrl+8","ctrl+9"], function(e, combo) { // GROUPS }
var tabPanel = Ext.cq1('app-main'); });
var arg = parseInt(e.key);
if ( arg >= tabPanel.items.indexOf(Ext.getCmp('tbfill')) ) arg++;
tabPanel.setActiveTab(arg);
});
// Add shortcut to main tab (ctrl+,)
Mousetrap.bind(platform === 'darwin' ? 'command+,' : 'ctrl+,', (e, combo) => {
Ext.cq1('app-main').setActiveTab(0);
});
// Add shortcuts to navigate through services
Mousetrap.bind(['ctrl+tab', 'ctrl+pagedown'], (e, combo) => {
var tabPanel = Ext.cq1('app-main');
var activeIndex = tabPanel.items.indexOf(tabPanel.getActiveTab());
var i = activeIndex + 1;
// "cycle" (go to the start) when the end is reached or the end is the spacer "tbfill"
if (i === tabPanel.items.items.length || i === tabPanel.items.items.length - 1 && tabPanel.items.items[i].id === 'tbfill') i = 0;
// skip spacer
while (tabPanel.items.items[i].id === 'tbfill') i++;
tabPanel.setActiveTab(i);
});
Mousetrap.bind(['ctrl+shift+tab', 'ctrl+pageup'], (e, combo) => {
var tabPanel = Ext.cq1('app-main');
var activeIndex = tabPanel.items.indexOf(tabPanel.getActiveTab());
var i = activeIndex - 1;
if ( i < 0 ) i = tabPanel.items.items.length - 1;
while ( tabPanel.items.items[i].id === 'tbfill' || i < 0 ) i--;
tabPanel.setActiveTab(i);
});
// Add shortcut to search inside a service
Mousetrap.bind(process.platform === 'darwin' ? ['command+alt+f'] : ['shift+alt+f'], (e, combo) => {
var currentTab = Ext.cq1('app-main').getActiveTab();
if ( currentTab.getWebView ) currentTab.showSearchBox(true);
});
// Add shortcut to Do Not Disturb
Mousetrap.bind(platform === 'darwin' ? ["command+alt+d"] : ["shift+alt+d"], function(e, combo) {
var btn = Ext.getCmp('disturbBtn');
btn.toggle();
Ext.cq1('app-main').getController().dontDisturb(btn, true);
});
// Add shortcut to Lock Rambox
Mousetrap.bind(platform === 'darwin' ? ['command+alt+l'] : ['shift+alt+l'], (e, combo) => {
var btn = Ext.getCmp('lockRamboxBtn');
Ext.cq1('app-main').getController().lockRambox(btn);
});
// Mouse Wheel zooming // Define default value
document.addEventListener('mousewheel', function(e) { if (localStorage.getItem("dontDisturb") === null)
if( e.ctrlKey ) { localStorage.setItem("dontDisturb", false);
var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail))); ipc.send("setDontDisturb", localStorage.getItem("dontDisturb")); // We store it in config
var tabPanel = Ext.cq1('app-main'); if (localStorage.getItem("locked")) {
if ( tabPanel.items.indexOf(tabPanel.getActiveTab()) === 0 ) return false; console.info("Lock Rambox:", "Enabled");
Ext.cq1("app-main").getController().showLockWindow();
}
Ext.getStore("Services").load();
});
},
if ( delta === 1 ) { // Zoom In updateTotalNotifications: function (newValue, oldValue) {
tabPanel.getActiveTab().zoomIn(); newValue = parseInt(newValue);
} else { // Zoom Out if (newValue > 0) {
tabPanel.getActiveTab().zoomOut(); if (Ext.cq1("app-main").getActiveTab().record) {
} document.title =
} "Rambox (" +
}); Rambox.util.Format.formatNumber(newValue) +
") - " +
Ext.cq1("app-main").getActiveTab().record.get("name");
} else {
document.title =
"Rambox (" + Rambox.util.Format.formatNumber(newValue) + ")";
}
} else {
if (Ext.cq1("app-main") && Ext.cq1("app-main").getActiveTab().record) {
document.title =
"Rambox - " + Ext.cq1("app-main").getActiveTab().record.get("name");
} else {
document.title = "Rambox";
}
}
},
// Define default value checkUpdate: function (silence) {
if ( localStorage.getItem('dontDisturb') === null ) localStorage.setItem('dontDisturb', false); console.info("Checking for updates...");
ipc.send('setDontDisturb', localStorage.getItem('dontDisturb')); // We store it in config Ext.Ajax.request({
url:
"https://api.github.com/repos/ramboxapp/community-edition/releases/latest",
method: "GET",
success: function (response) {
var json = Ext.decode(response.responseText);
var appVersion = new Ext.Version(
require("electron").remote.app.getVersion()
);
if (
appVersion.isLessThan(json.name) &&
!json.draft &&
!json.prerelease
) {
console.info("New version is available", json.version);
Ext.cq1("app-main").addDocked({
xtype: "toolbar",
dock: "top",
ui: "newversion",
items: [
"->",
{
xtype: "label",
html:
"<b>" +
locale["app.update[0]"] +
"</b> (" +
json.version +
")" +
(process.platform === "win32"
? " is downloading in the background and you will be notified when it is ready to be installed."
: ""),
},
{
xtype: "button",
text: locale["app.update[1]"],
href:
process.platform === "darwin"
? "https://getrambox.herokuapp.com/download/" +
process.platform +
"_" +
process.arch
: "https://github.com/ramboxapp/community-edition/releases/latest",
hidden: process.platform === "win32",
},
{
xtype: "button",
text: locale["app.update[2]"],
ui: "decline",
tooltip:
"Click here to see more information about the new version.",
href:
"https://github.com/ramboxapp/community-edition/releases/tag/" +
json.version,
},
"->",
{
glyph: "xf00d@FontAwesome",
baseCls: "",
style: "cursor:pointer;",
handler: function (btn) {
Ext.cq1("app-main").removeDocked(btn.up("toolbar"), true);
},
},
],
});
ipc.send("autoUpdater:check-for-updates");
return;
} else if (!silence) {
Ext.Msg.show({
title: locale["app.update[3]"],
message: locale["app.update[4]"],
icon: Ext.Msg.INFO,
buttons: Ext.Msg.OK,
});
}
if ( localStorage.getItem('locked') ) { console.info("Your version is the latest. No need to update.");
console.info('Lock Rambox:', 'Enabled'); },
Ext.cq1('app-main').getController().showLockWindow(); });
} },
Ext.getStore('Services').load();
});
}
,updateTotalNotifications: function( newValue, oldValue ) {
newValue = parseInt(newValue);
if ( newValue > 0 ) {
if ( Ext.cq1('app-main').getActiveTab().record ) {
document.title = 'Rambox (' + Rambox.util.Format.formatNumber(newValue) + ') - '+Ext.cq1('app-main').getActiveTab().record.get('name');
} else {
document.title = 'Rambox (' + Rambox.util.Format.formatNumber(newValue) + ')';
}
} else {
if ( Ext.cq1('app-main') && Ext.cq1('app-main').getActiveTab().record ) {
document.title = 'Rambox - '+Ext.cq1('app-main').getActiveTab().record.get('name');
} else {
document.title = 'Rambox';
}
}
}
,checkUpdate: function(silence) {
console.info('Checking for updates...');
Ext.Ajax.request({
url: 'https://api.github.com/repos/ramboxapp/community-edition/releases/latest'
,method: 'GET'
,success: function(response) {
var json = Ext.decode(response.responseText);
var appVersion = new Ext.Version(require('electron').remote.app.getVersion());
if ( appVersion.isLessThan(json.name) && !json.draft && !json.prerelease ) {
console.info('New version is available', json.version);
Ext.cq1('app-main').addDocked({
xtype: 'toolbar'
,dock: 'top'
,ui: 'newversion'
,items: [
'->'
,{
xtype: 'label'
,html: '<b>'+locale['app.update[0]']+'</b> ('+json.version+')' + ( process.platform === 'win32' ? ' is downloading in the background and you will be notified when it is ready to be installed.' : '' )
}
,{
xtype: 'button'
,text: locale['app.update[1]']
,href: process.platform === 'darwin' ? 'https://getrambox.herokuapp.com/download/'+process.platform+'_'+process.arch : 'https://github.com/ramboxapp/community-edition/releases/latest'
,hidden: process.platform === 'win32'
}
,{
xtype: 'button'
,text: locale['app.update[2]']
,ui: 'decline'
,tooltip: 'Click here to see more information about the new version.'
,href: 'https://github.com/ramboxapp/community-edition/releases/tag/'+json.version
}
,'->'
,{
glyph: 'xf00d@FontAwesome'
,baseCls: ''
,style: 'cursor:pointer;'
,handler: function(btn) { Ext.cq1('app-main').removeDocked(btn.up('toolbar'), true); }
}
]
});
ipc.send('autoUpdater:check-for-updates');
return;
} else if ( !silence ) {
Ext.Msg.show({
title: locale['app.update[3]']
,message: locale['app.update[4]']
,icon: Ext.Msg.INFO
,buttons: Ext.Msg.OK
});
}
console.info('Your version is the latest. No need to update.');
}
});
}
}); });

75
app/store/ServicesList.js

@ -1,42 +1,43 @@
Ext.define('Rambox.store.ServicesList', { Ext.define("Rambox.store.ServicesList", {
extend: 'Ext.data.Store' extend: "Ext.data.Store",
,alias: 'store.serviceslist' alias: "store.serviceslist",
,requires: [ requires: ["Ext.data.proxy.LocalStorage"],
'Ext.data.proxy.LocalStorage'
]
,model: 'Rambox.model.ServiceList' model: "Rambox.model.ServiceList",
,proxy: { proxy: {
type: 'ajax', type: "ajax",
url: 'https://raw.githubusercontent.com/ramboxapp/community-edition/gh-pages/api/services.json', url:
reader: { "https://raw.githubusercontent.com/ramboxapp/community-edition/gh-pages/api/services.json",
type: 'json', reader: {
rootProperty: 'responseText' type: "json",
} rootProperty: "responseText",
} },
,listeners: { },
load: function () { listeners: {
Ext.get('spinner') ? Ext.get('spinner').destroy() : null; load: function () {
Ext.get('background') ? Ext.get('background').destroy() : null; Ext.get("spinner") ? Ext.get("spinner").destroy() : null;
this.add({ Ext.get("background") ? Ext.get("background").destroy() : null;
id: 'custom' this.add({
,logo: 'custom.png' id: "custom",
,name: '_Custom Service' logo: "custom.png",
,description: locale['services[38]'] name: "_Custom Service",
,url: '___' description: locale["services[38]"],
,type: 'custom' url: "___",
,allow_popups: true type: "custom",
}) allow_popups: true,
} });
} },
,sorters: [{ },
property: 'name' sorters: [
,direction: 'ASC' {
}] property: "name",
direction: "ASC",
},
],
,autoLoad: true autoLoad: true,
,autoSync: true autoSync: true,
,pageSize: 100000 pageSize: 100000,
}); });

640
app/ux/Auth0.js

@ -1,298 +1,344 @@
Ext.define('Rambox.ux.Auth0', { Ext.define("Rambox.ux.Auth0", {
singleton: true singleton: true,
// private // private
,lock: null lock: null,
,auth0: null auth0: null,
,authService: null authService: null,
,backupCurrent: false backupCurrent: false,
,init: function() { init: function () {
var me = this; var me = this;
var Auth0 = require('auth0-js'); var Auth0 = require("auth0-js");
var _AuthService = require('./resources/js/AuthService'); var _AuthService = require("./resources/js/AuthService");
me.authService = new _AuthService.default({ me.authService = new _AuthService.default({
clientId: auth0Cfg.clientID, clientId: auth0Cfg.clientID,
authorizeEndpoint: 'https://'+auth0Cfg.domain+'/authorize', authorizeEndpoint: "https://" + auth0Cfg.domain + "/authorize",
audience: 'https://'+auth0Cfg.domain+'/userinfo', audience: "https://" + auth0Cfg.domain + "/userinfo",
scope: 'openid profile offline_access', scope: "openid profile offline_access",
redirectUri: 'https://'+auth0Cfg.domain+'/mobile', redirectUri: "https://" + auth0Cfg.domain + "/mobile",
tokenEndpoint: 'https://'+auth0Cfg.domain+'/oauth/token' tokenEndpoint: "https://" + auth0Cfg.domain + "/oauth/token",
}); });
me.auth0 = new Auth0.WebAuth({ clientID: auth0Cfg.clientID, domain : auth0Cfg.domain }); me.auth0 = new Auth0.WebAuth({
clientID: auth0Cfg.clientID,
//me.defineEvents(); domain: auth0Cfg.domain,
} });
,onLogin: function(token, authWindow) { //me.defineEvents();
var me = this; },
authWindow.close(); onLogin: function (token, authWindow) {
var me = this;
me.auth0.client.userInfo(token.access_token, function(err, profile) {
if ( err ) { authWindow.close();
if ( err.error === 401 || err.error === 'Unauthorized' ) return me.renewToken(me.checkConfiguration);
Ext.Msg.hide(); me.auth0.client.userInfo(token.access_token, function (err, profile) {
return Ext.Msg.show({ if (err) {
title: 'Error' if (err.error === 401 || err.error === "Unauthorized")
,message: 'There was an error getting the profile: ' + err.error_description return me.renewToken(me.checkConfiguration);
,icon: Ext.Msg.ERROR Ext.Msg.hide();
,buttons: Ext.Msg.OK return Ext.Msg.show({
}); title: "Error",
} message:
"There was an error getting the profile: " + err.error_description,
profile.user_metadata = profile['https://rambox.pro/user_metadata']; icon: Ext.Msg.ERROR,
delete profile['https://rambox.pro/user_metadata']; buttons: Ext.Msg.OK,
});
// Display a spinner while waiting }
Ext.Msg.wait(locale['app.window[29]'], locale['app.window[28]']);
profile.user_metadata = profile["https://rambox.pro/user_metadata"];
// Google Analytics Event delete profile["https://rambox.pro/user_metadata"];
ga_storage._trackEvent('Users', 'loggedIn');
// Display a spinner while waiting
// Set cookies to help Tooltip.io messages segmentation Ext.Msg.wait(locale["app.window[29]"], locale["app.window[28]"]);
Ext.util.Cookies.set('auth0', true);
// Google Analytics Event
// User is logged in ga_storage._trackEvent("Users", "loggedIn");
// Save the profile and JWT.
localStorage.setItem('profile', JSON.stringify(profile)); // Set cookies to help Tooltip.io messages segmentation
localStorage.setItem('access_token', token.access_token); Ext.util.Cookies.set("auth0", true);
localStorage.setItem('id_token', token.id_token);
localStorage.setItem('refresh_token', token.refresh_token); // User is logged in
// Save the profile and JWT.
if ( !Ext.isEmpty(profile.user_metadata) && !Ext.isEmpty(profile.user_metadata.services) && !me.backupCurrent ) { localStorage.setItem("profile", JSON.stringify(profile));
Ext.each(profile.user_metadata.services, function(s) { localStorage.setItem("access_token", token.access_token);
var service = Ext.create('Rambox.model.Service', s); localStorage.setItem("id_token", token.id_token);
service.save(); localStorage.setItem("refresh_token", token.refresh_token);
Ext.getStore('Services').add(service);
}); if (
!Ext.isEmpty(profile.user_metadata) &&
require('electron').remote.app.relaunch(); !Ext.isEmpty(profile.user_metadata.services) &&
require('electron').remote.app.exit(); !me.backupCurrent
} ) {
Ext.each(profile.user_metadata.services, function (s) {
Ext.Msg.hide(); var service = Ext.create("Rambox.model.Service", s);
Ext.cq1('app-main').getViewModel().set('username', profile.name); service.save();
Ext.cq1('app-main').getViewModel().set('avatar', profile.picture); Ext.getStore("Services").add(service);
}); });
}
require("electron").remote.app.relaunch();
,backupConfiguration: function(callback) { require("electron").remote.app.exit();
var me = this; }
Ext.Msg.wait('Saving backup...', 'Please wait...'); Ext.Msg.hide();
Ext.cq1("app-main").getViewModel().set("username", profile.name);
// Getting all services Ext.cq1("app-main").getViewModel().set("avatar", profile.picture);
var lastupdate = (new Date()).toJSON(); });
var services = []; },
Ext.getStore('Services').each(function(service) {
var s = Ext.clone(service); backupConfiguration: function (callback) {
delete s.data.id; var me = this;
delete s.data.zoomLevel;
services.push(s.data); Ext.Msg.wait("Saving backup...", "Please wait...");
});
// Getting all services
Ext.Ajax.request({ var lastupdate = new Date().toJSON();
url: 'https://rambox.auth0.com/api/v2/users/'+Ext.decode(localStorage.getItem('profile')).sub var services = [];
,method: 'PATCH' Ext.getStore("Services").each(function (service) {
,headers: { authorization: "Bearer " + localStorage.getItem('id_token') } var s = Ext.clone(service);
,jsonData: { user_metadata: { services: services, services_lastupdate: lastupdate } } delete s.data.id;
,success: function(response) { delete s.data.zoomLevel;
Ext.Msg.hide(); services.push(s.data);
// Save the last update in localStorage });
var profile = Ext.decode(localStorage.getItem('profile'));
if ( !profile.user_metadata ) profile.user_metadata = {}; Ext.Ajax.request({
profile.user_metadata.services_lastupdate = lastupdate; url:
localStorage.setItem('profile', Ext.encode(profile)); "https://rambox.auth0.com/api/v2/users/" +
Ext.cq1('app-main').getViewModel().set('last_sync', new Date(lastupdate).toUTCString()); Ext.decode(localStorage.getItem("profile")).sub,
method: "PATCH",
Ext.toast({ headers: { authorization: "Bearer " + localStorage.getItem("id_token") },
html: '<i class="fa fa-check fa-3x fa-pull-left" aria-hidden="true"></i> Your configuration were successfully backed up.' jsonData: {
,title: 'Synchronize Configuration' user_metadata: { services: services, services_lastupdate: lastupdate },
,width: 300 },
,align: 't' success: function (response) {
,closable: false Ext.Msg.hide();
}); // Save the last update in localStorage
var profile = Ext.decode(localStorage.getItem("profile"));
if ( Ext.isFunction(callback) ) callback.bind(me)(); if (!profile.user_metadata) profile.user_metadata = {};
} profile.user_metadata.services_lastupdate = lastupdate;
,failure: function(response) { localStorage.setItem("profile", Ext.encode(profile));
if ( response.status === 401 ) return me.renewToken(me.backupConfiguration); Ext.cq1("app-main")
.getViewModel()
Ext.Msg.hide(); .set("last_sync", new Date(lastupdate).toUTCString());
Ext.toast({
html: '<i class="fa fa-times fa-3x fa-pull-left" aria-hidden="true"></i> Error occurred when trying to backup your configuration.' Ext.toast({
,title: 'Synchronize Configuration' html:
,width: 300 '<i class="fa fa-check fa-3x fa-pull-left" aria-hidden="true"></i> Your configuration were successfully backed up.',
,align: 't' title: "Synchronize Configuration",
,closable: false width: 300,
}); align: "t",
closable: false,
if ( Ext.isFunction(callback) ) callback.bind(me)(); });
console.error(response); if (Ext.isFunction(callback)) callback.bind(me)();
} },
}); failure: function (response) {
} if (response.status === 401)
return me.renewToken(me.backupConfiguration);
,restoreConfiguration: function() {
var me = this; Ext.Msg.hide();
Ext.toast({
me.auth0.client.userInfo(localStorage.getItem('access_token'), function(err, profile) { html:
if ( err ) { '<i class="fa fa-times fa-3x fa-pull-left" aria-hidden="true"></i> Error occurred when trying to backup your configuration.',
if ( err.code === 401 ) return me.renewToken(me.restoreConfiguration); title: "Synchronize Configuration",
return Ext.Msg.show({ width: 300,
title: 'Error' align: "t",
,message: 'There was an error getting the profile: ' + err.description closable: false,
,icon: Ext.Msg.ERROR });
,buttons: Ext.Msg.OK
}); if (Ext.isFunction(callback)) callback.bind(me)();
}
console.error(response);
profile.user_metadata = profile['https://rambox.pro/user_metadata']; },
delete profile['https://rambox.pro/user_metadata']; });
},
// First we remove all current services
Ext.cq1('app-main').getController().removeAllServices(false, function() { restoreConfiguration: function () {
if ( !profile.user_metadata || !profile.user_metadata.services ) return; var me = this;
Ext.each(profile.user_metadata.services, function(s) {
var service = Ext.create('Rambox.model.Service', s); me.auth0.client.userInfo(
service.save(); localStorage.getItem("access_token"),
Ext.getStore('Services').add(service); function (err, profile) {
}); if (err) {
if (err.code === 401) return me.renewToken(me.restoreConfiguration);
require('electron').remote.getCurrentWindow().reload(); return Ext.Msg.show({
}); title: "Error",
}); message:
} "There was an error getting the profile: " + err.description,
icon: Ext.Msg.ERROR,
,checkConfiguration: function() { buttons: Ext.Msg.OK,
var me = this; });
}
me.auth0.client.userInfo(localStorage.getItem('access_token'), function(err, profile) {
if ( err ) { profile.user_metadata = profile["https://rambox.pro/user_metadata"];
if ( err.code === 401 ) return me.renewToken(me.checkConfiguration); delete profile["https://rambox.pro/user_metadata"];
return Ext.Msg.show({
title: 'Error' // First we remove all current services
,message: 'There was an error getting the profile: ' + err.description Ext.cq1("app-main")
,icon: Ext.Msg.ERROR .getController()
,buttons: Ext.Msg.OK .removeAllServices(false, function () {
}); if (!profile.user_metadata || !profile.user_metadata.services)
} return;
Ext.each(profile.user_metadata.services, function (s) {
profile.user_metadata = profile['https://rambox.pro/user_metadata']; var service = Ext.create("Rambox.model.Service", s);
delete profile['https://rambox.pro/user_metadata']; service.save();
Ext.getStore("Services").add(service);
if ( !profile.user_metadata ) { });
Ext.toast({
html: 'You don\'t have any backup yet.' require("electron").remote.getCurrentWindow().reload();
,title: 'Synchronize Configuration' });
,width: 300 }
,align: 't' );
,closable: false },
});
return; checkConfiguration: function () {
} var me = this;
if ( Math.floor(new Date(profile.user_metadata.services_lastupdate) / 1000) > Math.floor(new Date(Ext.decode(localStorage.getItem('profile')).user_metadata.services_lastupdate) / 1000) ) { me.auth0.client.userInfo(
Ext.toast({ localStorage.getItem("access_token"),
html: 'Your settings are out of date.' function (err, profile) {
,title: 'Synchronize Configuration' if (err) {
,width: 300 if (err.code === 401) return me.renewToken(me.checkConfiguration);
,align: 't' return Ext.Msg.show({
,closable: false title: "Error",
}); message:
} else { "There was an error getting the profile: " + err.description,
Ext.toast({ icon: Ext.Msg.ERROR,
html: '<i class="fa fa-check fa-3x fa-pull-left" aria-hidden="true"></i> Latest backup is already applied.' buttons: Ext.Msg.OK,
,title: 'Synchronize Configuration' });
,width: 300 }
,align: 't'
,closable: false profile.user_metadata = profile["https://rambox.pro/user_metadata"];
}); delete profile["https://rambox.pro/user_metadata"];
}
}); if (!profile.user_metadata) {
} Ext.toast({
html: "You don't have any backup yet.",
,renewToken: function(callback) { title: "Synchronize Configuration",
var me = this; width: 300,
align: "t",
Ext.Ajax.request({ closable: false,
url: 'https://rambox.auth0.com/oauth/token' });
,method: 'POST' return;
,jsonData: { }
grant_type: 'refresh_token'
,client_id: auth0Cfg.clientID if (
,client_secret: auth0Cfg.clientSecret Math.floor(
,refresh_token: localStorage.getItem('refresh_token') new Date(profile.user_metadata.services_lastupdate) / 1000
,api_type: 'app' ) >
} Math.floor(
,success: function(response) { new Date(
var json = Ext.decode(response.responseText); Ext.decode(
localStorage.setItem('access_token', json.access_token); localStorage.getItem("profile")
localStorage.setItem('id_token', json.id_token); ).user_metadata.services_lastupdate
) / 1000
if ( Ext.isFunction(callback) ) callback.bind(me)(); )
} ) {
,failure: function(response) { Ext.toast({
console.error(response); html: "Your settings are out of date.",
} title: "Synchronize Configuration",
}); width: 300,
} align: "t",
closable: false,
,login: function() { });
var me = this; } else {
Ext.toast({
var electron = require('electron').remote; html:
var authWindow = new electron.BrowserWindow({ '<i class="fa fa-check fa-3x fa-pull-left" aria-hidden="true"></i> Latest backup is already applied.',
title: 'Rambox - Login' title: "Synchronize Configuration",
,width: 400 width: 300,
,height: 600 align: "t",
,maximizable: false closable: false,
,minimizable: false });
,resizable: true }
,closable: true }
,center: true );
,autoHideMenuBar: true },
,skipTaskbar: true
,fullscreenable: false renewToken: function (callback) {
,parent: require('electron').remote.getCurrentWindow() var me = this;
,webPreferences: {
partition: 'persist:rambox' Ext.Ajax.request({
} url: "https://rambox.auth0.com/oauth/token",
}); method: "POST",
jsonData: {
authWindow.on('closed', function() { grant_type: "refresh_token",
authWindow = null; client_id: auth0Cfg.clientID,
}); client_secret: auth0Cfg.clientSecret,
refresh_token: localStorage.getItem("refresh_token"),
authWindow.loadURL(me.authService.requestAuthCode()); api_type: "app",
},
authWindow.webContents.on('did-start-loading', function(e) { success: function (response) {
authWindow.webContents.session.webRequest.onBeforeSendHeaders((details, callback) => { var json = Ext.decode(response.responseText);
Rambox.app.config.googleURLs.forEach((loginURL) => { localStorage.setItem("access_token", json.access_token);
if ( details.url.indexOf(loginURL) > -1 ) details.requestHeaders['User-Agent'] = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0' }) localStorage.setItem("id_token", json.id_token);
callback({ cancel: false, requestHeaders: details.requestHeaders });
}); if (Ext.isFunction(callback)) callback.bind(me)();
}); },
failure: function (response) {
authWindow.webContents.on('did-navigate', function(e, url) { console.error(response);
me.authService.requestAccessCode(url, me.onLogin.bind(me), authWindow); },
}); });
} },
,logout: function() { login: function () {
var me = this; var me = this;
localStorage.removeItem('profile'); var electron = require("electron").remote;
localStorage.removeItem('id_token'); var authWindow = new electron.BrowserWindow({
localStorage.removeItem('refresh_token'); title: "Rambox - Login",
localStorage.removeItem('access_token'); width: 400,
height: 600,
// Set cookies to help Tooltip.io messages segmentation maximizable: false,
Ext.util.Cookies.set('auth0', false); minimizable: false,
} resizable: true,
closable: true,
center: true,
autoHideMenuBar: true,
skipTaskbar: true,
fullscreenable: false,
parent: require("electron").remote.getCurrentWindow(),
webPreferences: {
partition: "persist:rambox",
},
});
authWindow.on("closed", function () {
authWindow = null;
});
authWindow.loadURL(me.authService.requestAuthCode());
authWindow.webContents.on("did-start-loading", function (e) {
authWindow.webContents.session.webRequest.onBeforeSendHeaders(
(details, callback) => {
Rambox.app.config.googleURLs.forEach((loginURL) => {
if (details.url.indexOf(loginURL) > -1)
details.requestHeaders["User-Agent"] =
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0";
});
callback({ cancel: false, requestHeaders: details.requestHeaders });
}
);
});
authWindow.webContents.on("did-navigate", function (e, url) {
me.authService.requestAccessCode(url, me.onLogin.bind(me), authWindow);
});
},
logout: function () {
var me = this;
localStorage.removeItem("profile");
localStorage.removeItem("id_token");
localStorage.removeItem("refresh_token");
localStorage.removeItem("access_token");
// Set cookies to help Tooltip.io messages segmentation
Ext.util.Cookies.set("auth0", false);
},
}); });

1777
app/ux/WebView.js

File diff suppressed because it is too large Load Diff

1209
app/view/main/MainController.js

File diff suppressed because it is too large Load Diff

778
app/view/preferences/Preferences.js

@ -1,382 +1,412 @@
Ext.define('Rambox.view.preferences.Preferences',{ Ext.define("Rambox.view.preferences.Preferences", {
extend: 'Ext.window.Window' extend: "Ext.window.Window",
,xtype: 'preferences' xtype: "preferences",
,requires: [ requires: [
'Rambox.view.preferences.PreferencesController' "Rambox.view.preferences.PreferencesController",
,'Rambox.view.preferences.PreferencesModel' "Rambox.view.preferences.PreferencesModel",
,'Ext.form.field.ComboBox' "Ext.form.field.ComboBox",
,'Ext.form.field.Checkbox' "Ext.form.field.Checkbox",
] ],
,controller: 'preferences-preferences' controller: "preferences-preferences",
,viewModel: { viewModel: {
type: 'preferences-preferences' type: "preferences-preferences",
} },
,title: locale['preferences[0]'] title: locale["preferences[0]"],
,width: 420 width: 420,
,height: 500 height: 500,
,modal: true modal: true,
,closable: true closable: true,
,minimizable: false minimizable: false,
,maximizable: false maximizable: false,
,draggable: true draggable: true,
,resizable: false resizable: false,
,scrollable: 'vertical' scrollable: "vertical",
,bodyStyle: 'margin-right:15px;' bodyStyle: "margin-right:15px;",
,buttons: [ buttons: [
{ {
text: locale['button[1]'] text: locale["button[1]"],
,ui: 'decline' ui: "decline",
,handler: 'cancel' handler: "cancel",
} },
,'->' "->",
,{ {
text: locale['button[4]'] text: locale["button[4]"],
,handler: 'save' handler: "save",
} },
] ],
,initComponent: function() { initComponent: function () {
var config = ipc.sendSync('getConfig'); var config = ipc.sendSync("getConfig");
var defaultServiceOptions = []; var defaultServiceOptions = [];
defaultServiceOptions.push({ value: 'ramboxTab', label: 'Rambox Tab' }); defaultServiceOptions.push({ value: "ramboxTab", label: "Rambox Tab" });
defaultServiceOptions.push({ value: 'last', label: 'Last Active Service' }); defaultServiceOptions.push({ value: "last", label: "Last Active Service" });
Ext.getStore('Services').each(function(rec) { Ext.getStore("Services").each(function (rec) {
defaultServiceOptions.push({ defaultServiceOptions.push({
value: rec.get('id') value: rec.get("id"),
,label: rec.get('name') label: rec.get("name"),
}); });
}); });
this.items = [ this.items = [
{ {
xtype: 'form' xtype: "form",
,bodyPadding: 20 bodyPadding: 20,
,items: [ items: [
{ {
xtype: 'container' xtype: "container",
,layout: 'hbox' layout: "hbox",
,items: [ items: [
{ {
xtype: 'combo' xtype: "combo",
,name: 'locale' name: "locale",
,fieldLabel: 'Language' fieldLabel: "Language",
,labelAlign: 'left' labelAlign: "left",
,flex: 1 flex: 1,
,labelWidth: 80 labelWidth: 80,
,value: config.locale value: config.locale,
,displayField: 'label' displayField: "label",
,valueField: 'value' valueField: "value",
,editable: false editable: false,
,store: Ext.create('Ext.data.Store', { store: Ext.create("Ext.data.Store", {
fields: ['value', 'label'] fields: ["value", "label"],
,data: [ data: [
{ 'value': 'af', 'auth0': 'af', 'label': 'Afrikaans' } { value: "af", auth0: "af", label: "Afrikaans" },
,{ 'value': 'ar', 'auth0': 'en', 'label': 'Arabic' } { value: "ar", auth0: "en", label: "Arabic" },
,{ 'value': 'bs2', 'auth0': 'en', 'label': 'Barndutsch, Switzerland' } {
,{ 'value': 'bn', 'auth0': 'en', 'label': 'Bengali' } value: "bs2",
,{ 'value': 'bg', 'auth0': 'en', 'label': 'Bulgarian' } auth0: "en",
,{ 'value': 'ca', 'auth0': 'ca', 'label': 'Catalan' } label: "Barndutsch, Switzerland",
,{ 'value': 'ceb', 'auth0': 'en', 'label': 'Cebuano' } },
,{ 'value': 'zh-CN', 'auth0': 'zh', 'label': 'Chinese Simplified' } { value: "bn", auth0: "en", label: "Bengali" },
,{ 'value': 'zh-TW', 'auth0': 'zh-tw', 'label': 'Chinese Traditional' } { value: "bg", auth0: "en", label: "Bulgarian" },
,{ 'value': 'hr', 'auth0': 'en', 'label': 'Croatian' } { value: "ca", auth0: "ca", label: "Catalan" },
,{ 'value': 'cs', 'auth0': 'cs', 'label': 'Czech' } { value: "ceb", auth0: "en", label: "Cebuano" },
,{ 'value': 'da', 'auth0': 'da', 'label': 'Danish' } {
,{ 'value': 'nl', 'auth0': 'nl', 'label': 'Dutch' } value: "zh-CN",
,{ 'value': 'en', 'auth0': 'en', 'label': 'English' } auth0: "zh",
,{ 'value': 'fi', 'auth0': 'fi', 'label': 'Finnish' } label: "Chinese Simplified",
,{ 'value': 'fil', 'auth0': 'en', 'label': 'Filipino' } },
,{ 'value': 'fr', 'auth0': 'fr', 'label': 'French' } {
,{ 'value': 'de', 'auth0': 'de', 'label': 'German' } value: "zh-TW",
,{ 'value': 'de-CH', 'auth0': 'de', 'label': 'German, Switzerland' } auth0: "zh-tw",
,{ 'value': 'el', 'auth0': 'el', 'label': 'Greek' } label: "Chinese Traditional",
,{ 'value': 'he', 'auth0': 'en', 'label': 'Hebrew' } },
,{ 'value': 'hi', 'auth0': 'en', 'label': 'Hindi' } { value: "hr", auth0: "en", label: "Croatian" },
,{ 'value': 'hu', 'auth0': 'hu', 'label': 'Hungarian' } { value: "cs", auth0: "cs", label: "Czech" },
,{ 'value': 'id', 'auth0': 'en', 'label': 'Indonesian' } { value: "da", auth0: "da", label: "Danish" },
,{ 'value': 'it', 'auth0': 'it', 'label': 'Italian' } { value: "nl", auth0: "nl", label: "Dutch" },
,{ 'value': 'ja', 'auth0': 'ja', 'label': 'Japanese' } { value: "en", auth0: "en", label: "English" },
,{ 'value': 'ko', 'auth0': 'ko', 'label': 'Korean' } { value: "fi", auth0: "fi", label: "Finnish" },
,{ 'value': 'no', 'auth0': 'no', 'label': 'Norwegian' } { value: "fil", auth0: "en", label: "Filipino" },
,{ 'value': 'fa', 'auth0': 'fa', 'label': 'Persian' } { value: "fr", auth0: "fr", label: "French" },
,{ 'value': 'pl', 'auth0': 'pl', 'label': 'Polish' } { value: "de", auth0: "de", label: "German" },
,{ 'value': 'pt-PT', 'auth0': 'pt-br', 'label': 'Portuguese' } {
,{ 'value': 'pt-BR', 'auth0': 'pt-br', 'label': 'Portuguese (Brazilian)' } value: "de-CH",
,{ 'value': 'ro', 'auth0': 'ro', 'label': 'Romanian' } auth0: "de",
,{ 'value': 'ru', 'auth0': 'ru', 'label': 'Russian' } label: "German, Switzerland",
,{ 'value': 'sr', 'auth0': 'en', 'label': 'Serbian (Cyrillic)' } },
,{ 'value': 'sk', 'auth0': 'sk', 'label': 'Slovak' } { value: "el", auth0: "el", label: "Greek" },
,{ 'value': 'es-ES', 'auth0': 'es', 'label': 'Spanish' } { value: "he", auth0: "en", label: "Hebrew" },
,{ 'value': 'sv-SE', 'auth0': 'sv', 'label': 'Swedish' } { value: "hi", auth0: "en", label: "Hindi" },
,{ 'value': 'tl', 'auth0': 'en', 'label': 'Tagalog' } { value: "hu", auth0: "hu", label: "Hungarian" },
,{ 'value': 'th', 'auth0': 'en', 'label': 'Thai' } { value: "id", auth0: "en", label: "Indonesian" },
,{ 'value': 'tr', 'auth0': 'tr', 'label': 'Turkish' } { value: "it", auth0: "it", label: "Italian" },
,{ 'value': 'uk', 'auth0': 'en', 'label': 'Ukrainian' } { value: "ja", auth0: "ja", label: "Japanese" },
,{ 'value': 'ur-PK', 'auth0': 'en', 'label': 'Urdu (Pakistan)' } { value: "ko", auth0: "ko", label: "Korean" },
,{ 'value': 'vi', 'auth0': 'en', 'label': 'Vietnamese' } { value: "no", auth0: "no", label: "Norwegian" },
] { value: "fa", auth0: "fa", label: "Persian" },
}) { value: "pl", auth0: "pl", label: "Polish" },
} { value: "pt-PT", auth0: "pt-br", label: "Portuguese" },
,{ {
xtype: 'button' value: "pt-BR",
,text: 'Help us Translate' auth0: "pt-br",
,style: 'border-top-left-radius:0;border-bottom-left-radius:0;' label: "Portuguese (Brazilian)",
,href: 'https://crowdin.com/project/rambox/invite' },
} { value: "ro", auth0: "ro", label: "Romanian" },
] { value: "ru", auth0: "ru", label: "Russian" },
} { value: "sr", auth0: "en", label: "Serbian (Cyrillic)" },
,{ { value: "sk", auth0: "sk", label: "Slovak" },
xtype: 'label' { value: "es-ES", auth0: "es", label: "Spanish" },
,text: 'English is the only language that has full translation. We are working with all the others, help us!' { value: "sv-SE", auth0: "sv", label: "Swedish" },
,style: 'display:block;font-size:10px;line-height:15px;' { value: "tl", auth0: "en", label: "Tagalog" },
,margin: '0 0 10 0' { value: "th", auth0: "en", label: "Thai" },
} { value: "tr", auth0: "tr", label: "Turkish" },
,{ { value: "uk", auth0: "en", label: "Ukrainian" },
xtype: 'checkbox' { value: "ur-PK", auth0: "en", label: "Urdu (Pakistan)" },
,name: 'auto_launch' { value: "vi", auth0: "en", label: "Vietnamese" },
,boxLabel: locale['preferences[5]'] ],
,value: config.auto_launch }),
} },
,{ {
xtype: 'checkbox' xtype: "button",
,name: 'start_minimized' text: "Help us Translate",
,boxLabel: locale['preferences[4]'] style: "border-top-left-radius:0;border-bottom-left-radius:0;",
,value: config.start_minimized href: "https://crowdin.com/project/rambox/invite",
} },
,{ ],
xtype: 'checkbox' },
,name: 'darkreader' {
,boxLabel: locale['preferences[29]'] xtype: "label",
,value: config.darkreader text:
} "English is the only language that has full translation. We are working with all the others, help us!",
,{ style: "display:block;font-size:10px;line-height:15px;",
xtype: 'checkbox' margin: "0 0 10 0",
,name: 'hide_menu_bar' },
,boxLabel: locale['preferences[1]']+' (<code>Alt</code> key to display)' {
,value: config.hide_menu_bar xtype: "checkbox",
,hidden: process.platform === 'darwin' name: "auto_launch",
} boxLabel: locale["preferences[5]"],
,{ value: config.auto_launch,
xtype: 'combo' },
,name: 'tabbar_location' {
,fieldLabel: locale['preferences[11]'] xtype: "checkbox",
,labelAlign: 'left' name: "start_minimized",
,width: 380 boxLabel: locale["preferences[4]"],
,labelWidth: 180 value: config.start_minimized,
,value: config.tabbar_location },
,displayField: 'label' {
,valueField: 'value' xtype: "checkbox",
,editable: false name: "darkreader",
,store: Ext.create('Ext.data.Store', { boxLabel: locale["preferences[29]"],
fields: ['value', 'label'] value: config.darkreader,
,data: [ },
{ 'value': 'top', 'label': 'Top' } {
,{ 'value': 'left', 'label': 'Left' } xtype: "checkbox",
,{ 'value': 'bottom', 'label': 'Bottom' } name: "hide_menu_bar",
,{ 'value': 'right', 'label': 'Right' } boxLabel:
] locale["preferences[1]"] + " (<code>Alt</code> key to display)",
}) value: config.hide_menu_bar,
} hidden: process.platform === "darwin",
,{ },
xtype: 'checkbox' {
,name: 'hide_tabbar_labels' xtype: "combo",
,boxLabel: locale['preferences[28]'] name: "tabbar_location",
,value: config.hide_tabbar_labels fieldLabel: locale["preferences[11]"],
} labelAlign: "left",
,{ width: 380,
xtype: 'combo' labelWidth: 180,
,name: 'default_service' value: config.tabbar_location,
,fieldLabel: locale['preferences[12]'] displayField: "label",
,labelAlign: 'top' valueField: "value",
//,width: 380 editable: false,
//,labelWidth: 105 store: Ext.create("Ext.data.Store", {
,value: config.default_service fields: ["value", "label"],
,displayField: 'label' data: [
,valueField: 'value' { value: "top", label: "Top" },
,editable: false { value: "left", label: "Left" },
,store: Ext.create('Ext.data.Store', { { value: "bottom", label: "Bottom" },
fields: ['value', 'label'] { value: "right", label: "Right" },
,data: defaultServiceOptions ],
}) }),
} },
,{ {
xtype: 'combo' xtype: "checkbox",
,name: 'window_display_behavior' name: "hide_tabbar_labels",
,fieldLabel: locale['preferences[13]'] boxLabel: locale["preferences[28]"],
,labelAlign: 'left' value: config.hide_tabbar_labels,
,width: 380 },
,labelWidth: 105 {
,value: config.window_display_behavior xtype: "combo",
,displayField: 'label' name: "default_service",
,valueField: 'value' fieldLabel: locale["preferences[12]"],
,editable: false labelAlign: "top",
,store: Ext.create('Ext.data.Store', { //,width: 380
fields: ['value', 'label'] //,labelWidth: 105
,data: [ value: config.default_service,
{ 'value': 'show_taskbar', 'label': locale['preferences[14]'] } displayField: "label",
,{ 'value': 'show_trayIcon', 'label': locale['preferences[15]'] } valueField: "value",
,{ 'value': 'taskbar_tray', 'label': locale['preferences[16]'] } editable: false,
] store: Ext.create("Ext.data.Store", {
}) fields: ["value", "label"],
,hidden: process.platform === 'darwin' data: defaultServiceOptions,
} }),
,{ },
xtype: 'combo' {
,name: 'window_close_behavior' xtype: "combo",
,fieldLabel: locale['preferences[17]'] name: "window_display_behavior",
,labelAlign: 'left' fieldLabel: locale["preferences[13]"],
,width: 380 labelAlign: "left",
,labelWidth: 180 width: 380,
,value: config.window_close_behavior labelWidth: 105,
,displayField: 'label' value: config.window_display_behavior,
,valueField: 'value' displayField: "label",
,editable: false valueField: "value",
,store: Ext.create('Ext.data.Store', { editable: false,
fields: ['value', 'label'] store: Ext.create("Ext.data.Store", {
,data: [ fields: ["value", "label"],
{ 'value': 'keep_in_tray', 'label': locale['preferences[18]'] } data: [
,{ 'value': 'keep_in_tray_and_taskbar', 'label': locale['preferences[19]'] } { value: "show_taskbar", label: locale["preferences[14]"] },
,{ 'value': 'quit', 'label': locale['preferences[20]'] } { value: "show_trayIcon", label: locale["preferences[15]"] },
] { value: "taskbar_tray", label: locale["preferences[16]"] },
}) ],
,hidden: process.platform === 'darwin' }),
} hidden: process.platform === "darwin",
,{ },
xtype: 'checkbox' {
,name: 'always_on_top' xtype: "combo",
,boxLabel: locale['preferences[21]'] name: "window_close_behavior",
,value: config.always_on_top fieldLabel: locale["preferences[17]"],
} labelAlign: "left",
,{ width: 380,
xtype: 'checkbox' labelWidth: 180,
,name: 'systemtray_indicator' value: config.window_close_behavior,
,boxLabel: locale['preferences[22]'] displayField: "label",
,value: config.systemtray_indicator valueField: "value",
,hidden: process.platform === 'darwin' editable: false,
} store: Ext.create("Ext.data.Store", {
,{ fields: ["value", "label"],
xtype: 'checkbox' data: [
,name: 'flash_frame' { value: "keep_in_tray", label: locale["preferences[18]"] },
,boxLabel: process.platform === 'darwin' ? locale['preferences[10]'] : locale['preferences[9]'] {
,value: config.flash_frame value: "keep_in_tray_and_taskbar",
} label: locale["preferences[19]"],
,{ },
xtype: 'checkbox' { value: "quit", label: locale["preferences[20]"] },
,name: 'disable_gpu' ],
,boxLabel: locale['preferences[23]'] }),
,value: config.disable_gpu hidden: process.platform === "darwin",
} },
,{ {
xtype: 'checkbox' xtype: "checkbox",
,name: 'enable_hidpi_support' name: "always_on_top",
,boxLabel: locale['preferences[8]'] boxLabel: locale["preferences[21]"],
,value: config.enable_hidpi_support value: config.always_on_top,
,hidden: process.platform !== 'win32' },
}, {
{ xtype: "checkbox",
xtype: 'textfield' name: "systemtray_indicator",
,fieldLabel: 'Override User-Agent for all services (needs to relaunch)' boxLabel: locale["preferences[22]"],
,labelAlign: 'top' value: config.systemtray_indicator,
,name: 'user_agent' hidden: process.platform === "darwin",
,value: config.user_agent },
,width: 360 {
,emptyText: 'Leave blank for default user agent' xtype: "checkbox",
} name: "flash_frame",
,{ boxLabel:
xtype: 'fieldset' process.platform === "darwin"
,title: locale['preferences[24]'] ? locale["preferences[10]"]
,collapsed: !config.master_password : locale["preferences[9]"],
,checkboxToggle: true value: config.flash_frame,
,checkboxName: 'master_password' },
,margin: '10 0 0 0' {
,padding: 10 xtype: "checkbox",
,layout: 'hbox' name: "disable_gpu",
,defaults: { labelAlign: 'top' } boxLabel: locale["preferences[23]"],
,items: [ value: config.disable_gpu,
{ },
xtype: 'textfield' {
,inputType: 'password' xtype: "checkbox",
,fieldLabel: locale['preferences[25]'] name: "enable_hidpi_support",
,name: 'master_password1' boxLabel: locale["preferences[8]"],
,itemId: 'pass' value: config.enable_hidpi_support,
,flex: 1 hidden: process.platform !== "win32",
,listeners: { },
validitychange: function(field) { {
field.next().validate(); xtype: "textfield",
}, fieldLabel:
blur: function(field) { "Override User-Agent for all services (needs to relaunch)",
field.next().validate(); labelAlign: "top",
} name: "user_agent",
} value: config.user_agent,
} width: 360,
,{ emptyText: "Leave blank for default user agent",
xtype: 'textfield' },
,inputType: 'password' {
,fieldLabel: locale['preferences[26]'] xtype: "fieldset",
,name: 'master_password2' title: locale["preferences[24]"],
,margin: '0 0 0 10' collapsed: !config.master_password,
,vtype: 'password' checkboxToggle: true,
,initialPassField: 'pass' checkboxName: "master_password",
,flex: 1 margin: "10 0 0 0",
} padding: 10,
] layout: "hbox",
} defaults: { labelAlign: "top" },
,{ items: [
xtype: 'fieldset' {
,title: 'Proxy (needs to relaunch) - <a href="https://github.com/saenzramiro/rambox/wiki/FREE-PROXY-SERVERS" target="_blank">Free Proxy Servers</a>' xtype: "textfield",
,collapsed: !config.proxy inputType: "password",
,checkboxToggle: true fieldLabel: locale["preferences[25]"],
,checkboxName: 'proxy' name: "master_password1",
,margin: '10 0 0 0' itemId: "pass",
,padding: 10 flex: 1,
,layout: 'vbox' listeners: {
,defaults: { labelAlign: 'left' } validitychange: function (field) {
,items: [ field.next().validate();
{ },
xtype: 'textfield' blur: function (field) {
,vtype: 'url' field.next().validate();
,fieldLabel: 'Host' },
,name: 'proxyHost' },
,value: config.proxyHost },
//,flex: 1 {
} xtype: "textfield",
,{ inputType: "password",
xtype: 'numberfield' fieldLabel: locale["preferences[26]"],
,fieldLabel: 'Port' name: "master_password2",
,name: 'proxyPort' margin: "0 0 0 10",
,value: config.proxyPort vtype: "password",
} initialPassField: "pass",
,{ flex: 1,
xtype: 'textfield' },
,fieldLabel: 'Login' ],
,name: 'proxyLogin' },
,value: config.proxyLogin {
,emptyText: 'Optional' xtype: "fieldset",
} title:
,{ 'Proxy (needs to relaunch) - <a href="https://github.com/saenzramiro/rambox/wiki/FREE-PROXY-SERVERS" target="_blank">Free Proxy Servers</a>',
xtype: 'textfield' collapsed: !config.proxy,
,fieldLabel: 'Password' checkboxToggle: true,
,name: 'proxyPassword' checkboxName: "proxy",
,value: config.proxyPassword margin: "10 0 0 0",
,emptyText: 'Optional' padding: 10,
,inputType: 'password' layout: "vbox",
} defaults: { labelAlign: "left" },
] items: [
} {
,{ xtype: "textfield",
xtype: 'checkbox' vtype: "url",
,name: 'sendStatistics' fieldLabel: "Host",
,boxLabel: locale['preferences[27]'] name: "proxyHost",
,value: config.sendStatistics value: config.proxyHost,
} //,flex: 1
] },
} {
]; xtype: "numberfield",
fieldLabel: "Port",
name: "proxyPort",
value: config.proxyPort,
},
{
xtype: "textfield",
fieldLabel: "Login",
name: "proxyLogin",
value: config.proxyLogin,
emptyText: "Optional",
},
{
xtype: "textfield",
fieldLabel: "Password",
name: "proxyPassword",
value: config.proxyPassword,
emptyText: "Optional",
inputType: "password",
},
],
},
{
xtype: "checkbox",
name: "sendStatistics",
boxLabel: locale["preferences[27]"],
value: config.sendStatistics,
},
],
},
];
this.callParent(); this.callParent();
} },
}); });

64
electron/main.js

@ -33,38 +33,38 @@ if (isDev)
// Initial Config // Initial Config
const config = new Config({ const config = new Config({
defaults: { defaults: {
always_on_top: false always_on_top: false,
,hide_menu_bar: false hide_menu_bar: false,
,tabbar_location: 'top' tabbar_location: "top",
,hide_tabbar_labels: false hide_tabbar_labels: false,
,window_display_behavior: 'taskbar_tray' window_display_behavior: "taskbar_tray",
,auto_launch: !isDev auto_launch: !isDev,
,flash_frame: true flash_frame: true,
,window_close_behavior: 'keep_in_tray' window_close_behavior: "keep_in_tray",
,start_minimized: false start_minimized: false,
,darkreader: true darkreader: true,
,systemtray_indicator: true systemtray_indicator: true,
,master_password: false master_password: false,
,dont_disturb: false dont_disturb: false,
,disable_gpu: process.platform === 'linux' disable_gpu: process.platform === "linux",
,proxy: false proxy: false,
,proxyHost: '' proxyHost: "",
,proxyPort: '' proxyPort: "",
,proxyLogin: '' proxyLogin: "",
,proxyPassword: '' proxyPassword: "",
,locale: 'en' locale: "en",
,enable_hidpi_support: false enable_hidpi_support: false,
,user_agent: '' user_agent: "",
,default_service: 'ramboxTab' default_service: "ramboxTab",
,sendStatistics: false sendStatistics: false,
,x: undefined x: undefined,
,y: undefined y: undefined,
,width: 1000 width: 1000,
,height: 800 height: 800,
,maximized: false maximized: false,
} },
}); });
// Fix issues with HiDPI scaling on Windows platform // Fix issues with HiDPI scaling on Windows platform

478
package.json

@ -1,241 +1,241 @@
{ {
"name": "Rambox", "name": "Rambox",
"productName": "Rambox", "productName": "Rambox",
"version": "0.7.9", "version": "0.7.9",
"description": "Free and Open Source messaging and emailing app that combines common web applications into one.", "description": "Free and Open Source messaging and emailing app that combines common web applications into one.",
"main": "electron/main.js", "main": "electron/main.js",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/ramboxapp/community-edition.git" "url": "https://github.com/ramboxapp/community-edition.git"
}, },
"bugs": { "bugs": {
"url": "https://github.com/ramboxapp/community-edition/issues" "url": "https://github.com/ramboxapp/community-edition/issues"
}, },
"homepage": "https://rambox.app", "homepage": "https://rambox.app",
"keywords": [ "keywords": [
"Rambox", "Rambox",
"messaging", "messaging",
"app", "app",
"slack", "slack",
"whatsapp", "whatsapp",
"facebook", "facebook",
"messenger", "messenger",
"telegram", "telegram",
"google", "google",
"hangouts", "hangouts",
"skype" "skype"
], ],
"author": "Rambox LLC <[email protected]>", "author": "Rambox LLC <[email protected]>",
"license": "GPL-3.0", "license": "GPL-3.0",
"scripts": { "scripts": {
"start": "electron electron/main.js", "start": "electron electron/main.js",
"start:debug": "electron electron/main.js --enable-logging", "start:debug": "electron electron/main.js --enable-logging",
"dev": "electron electron/main.js", "dev": "electron electron/main.js",
"test": "./node_modules/.bin/mocha test/tests/**/*.spec.js", "test": "./node_modules/.bin/mocha test/tests/**/*.spec.js",
"sencha:clean": "rm -rf ./build/production", "sencha:clean": "rm -rf ./build/production",
"sencha:compile": "sencha app build && npm --prefix ./build/production/Rambox/ install ./build/production/Rambox/", "sencha:compile": "sencha app build && npm --prefix ./build/production/Rambox/ install ./build/production/Rambox/",
"sencha:compile:build": "sencha app build", "sencha:compile:build": "sencha app build",
"clean": "rm -rf ./dist", "clean": "rm -rf ./dist",
"clean:osx": "rm -rf ./dist/Rambox-darwin-*", "clean:osx": "rm -rf ./dist/Rambox-darwin-*",
"clean:win": "rm -rf ./dist/Rambox-win32-*", "clean:win": "rm -rf ./dist/Rambox-win32-*",
"pack": "npm run pack:osx && npm run pack:win", "pack": "npm run pack:osx && npm run pack:win",
"pack:osx": "electron-packager \"./build/production/Rambox/\" \"Rambox\" --out=dist --platform=darwin --arch=x64 --icon=resources/installer/Icon.icns --app-version=0.2.0 --build-version=64-bit --version-string.CompanyName=\"Rambox\" --version-string.ProductName=\"Rambox\" --asar --prune --overwrite", "pack:osx": "electron-packager \"./build/production/Rambox/\" \"Rambox\" --out=dist --platform=darwin --arch=x64 --icon=resources/installer/Icon.icns --app-version=0.2.0 --build-version=64-bit --version-string.CompanyName=\"Rambox\" --version-string.ProductName=\"Rambox\" --asar --prune --overwrite",
"pack:win": "npm run pack:win32 && npm run pack:win64", "pack:win": "npm run pack:win32 && npm run pack:win64",
"pack:win32": "electron-packager \"./build/production/Rambox/\" \"Rambox\" --out=dist --platform=win32 --arch=ia32 --icon=resources/installer/Icon.ico --app-version=0.2.0 --build-version=32-bit --version-string.CompanyName=\"Rambox\" --version-string.ProductName=\"Rambox\" --asar --prune --overwrite", "pack:win32": "electron-packager \"./build/production/Rambox/\" \"Rambox\" --out=dist --platform=win32 --arch=ia32 --icon=resources/installer/Icon.ico --app-version=0.2.0 --build-version=32-bit --version-string.CompanyName=\"Rambox\" --version-string.ProductName=\"Rambox\" --asar --prune --overwrite",
"pack:win64": "electron-packager \"./build/production/Rambox/\" \"Rambox\" --out=dist --platform=win32 --arch=x64 --icon=resources/installer/Icon.ico --app-version=0.2.0 --build-version=64-bit --version-string.CompanyName=\"Rambox\" --version-string.ProductName=\"Rambox\" --asar --prune --overwrite", "pack:win64": "electron-packager \"./build/production/Rambox/\" \"Rambox\" --out=dist --platform=win32 --arch=x64 --icon=resources/installer/Icon.ico --app-version=0.2.0 --build-version=64-bit --version-string.CompanyName=\"Rambox\" --version-string.ProductName=\"Rambox\" --asar --prune --overwrite",
"pack:linux": "npm run pack:linux32 && npm run pack:linux64", "pack:linux": "npm run pack:linux32 && npm run pack:linux64",
"pack:linux32": "electron-packager \"./build/production/Rambox/\" \"Rambox\" --out=dist --platform=linux --arch=ia32 --icon=resources/installer/Icon.ico --app-version=0.2.0 --build-version=64-bit --version-string.CompanyName=\"Rambox\" --version-string.ProductName=\"Rambox\" --asar --prune --overwrite", "pack:linux32": "electron-packager \"./build/production/Rambox/\" \"Rambox\" --out=dist --platform=linux --arch=ia32 --icon=resources/installer/Icon.ico --app-version=0.2.0 --build-version=64-bit --version-string.CompanyName=\"Rambox\" --version-string.ProductName=\"Rambox\" --asar --prune --overwrite",
"pack:linux64": "electron-packager \"./build/production/Rambox/\" \"Rambox\" --out=dist --platform=linux --arch=x64 --icon=resources/installer/Icon.ico --app-version=0.2.0 --build-version=64-bit --version-string.CompanyName=\"Rambox\" --version-string.ProductName=\"Rambox\" --asar --prune --overwrite", "pack:linux64": "electron-packager \"./build/production/Rambox/\" \"Rambox\" --out=dist --platform=linux --arch=x64 --icon=resources/installer/Icon.ico --app-version=0.2.0 --build-version=64-bit --version-string.CompanyName=\"Rambox\" --version-string.ProductName=\"Rambox\" --asar --prune --overwrite",
"build": "npm run build:linux && npm run build:osx && npm run build:win", "build": "npm run build:linux && npm run build:osx && npm run build:win",
"build:osx": "electron-builder --macos", "build:osx": "electron-builder --macos",
"build:linux": "electron-builder --linux --publish=onTagOrDraft", "build:linux": "electron-builder --linux --publish=onTagOrDraft",
"build:linux32": "electron-builder --linux --ia32 --publish=onTagOrDraft", "build:linux32": "electron-builder --linux --ia32 --publish=onTagOrDraft",
"build:linux64": "electron-builder --linux --x64 --publish=onTagOrDraft", "build:linux64": "electron-builder --linux --x64 --publish=onTagOrDraft",
"build:win": "electron-builder --win --ia32 --x64", "build:win": "electron-builder --win --ia32 --x64",
"build:win32": "electron-builder --win --ia32", "build:win32": "electron-builder --win --ia32",
"build:win64": "electron-builder --win --x64", "build:win64": "electron-builder --win --x64",
"setup:osx": "npm run sencha:clean && npm run sencha:compile && npm run clean:osx && npm run pack:osx && npm run build:osx", "setup:osx": "npm run sencha:clean && npm run sencha:compile && npm run clean:osx && npm run pack:osx && npm run build:osx",
"setup:win": "npm run sencha:clean && npm run sencha:compile && npm run clean:win && npm run pack:win && npm run build:win", "setup:win": "npm run sencha:clean && npm run sencha:compile && npm run clean:win && npm run pack:win && npm run build:win",
"all:win": "npm run sencha:clean && npm run sencha:compile && npm run clean:win && npm run pack:win && npm run zip:win32 && npm run zip:win64 && npm run build:win", "all:win": "npm run sencha:clean && npm run sencha:compile && npm run clean:win && npm run pack:win && npm run zip:win32 && npm run zip:win64 && npm run build:win",
"all:linux": "npm run sencha:clean && npm run sencha:compile && npm run build:linux", "all:linux": "npm run sencha:clean && npm run sencha:compile && npm run build:linux",
"translations:download": "node languages.js download", "translations:download": "node languages.js download",
"translations:generate": "node languages.js generate" "translations:generate": "node languages.js generate"
}, },
"build": { "build": {
"productName": "Rambox", "productName": "Rambox",
"appId": "com.grupovrs.ramboxce", "appId": "com.grupovrs.ramboxce",
"afterSign": "resources/installer/notarize.js", "afterSign": "resources/installer/notarize.js",
"asar": true, "asar": true,
"electronVersion": "11.4.10", "electronVersion": "11.4.10",
"electronDownload": { "electronDownload": {
"version": "11.4.10" "version": "11.4.10"
}, },
"mac": { "mac": {
"category": "public.app-category.productivity", "category": "public.app-category.productivity",
"artifactName": "Rambox-${version}-mac.${ext}", "artifactName": "Rambox-${version}-mac.${ext}",
"target": [ "target": [
"default" "default"
], ],
"hardenedRuntime": true, "hardenedRuntime": true,
"gatekeeperAssess": false, "gatekeeperAssess": false,
"entitlements": "resources/installer/entitlements.mac.plist", "entitlements": "resources/installer/entitlements.mac.plist",
"entitlementsInherit": "resources/installer/entitlements.mac.plist", "entitlementsInherit": "resources/installer/entitlements.mac.plist",
"extendInfo": { "extendInfo": {
"NSMicrophoneUsageDescription": "Apps inside Rambox CE may need access to your microphone. Please, grant access to have a better experience.", "NSMicrophoneUsageDescription": "Apps inside Rambox CE may need access to your microphone. Please, grant access to have a better experience.",
"NSCameraUsageDescription": "Apps inside Rambox CE may need access to your camera. Please, grant access to have a better experience." "NSCameraUsageDescription": "Apps inside Rambox CE may need access to your camera. Please, grant access to have a better experience."
} }
}, },
"dmg": { "dmg": {
"title": "Rambox", "title": "Rambox",
"iconSize": 128, "iconSize": 128,
"sign": false, "sign": false,
"contents": [ "contents": [
{ {
"x": 355, "x": 355,
"y": 125, "y": 125,
"type": "link", "type": "link",
"path": "/Applications" "path": "/Applications"
}, },
{ {
"x": 155, "x": 155,
"y": 125, "y": 125,
"type": "file" "type": "file"
} }
] ]
}, },
"win": { "win": {
"publisherName": "Rambox LLC", "publisherName": "Rambox LLC",
"artifactName": "Rambox-${version}-win-${arch}.${ext}", "artifactName": "Rambox-${version}-win-${arch}.${ext}",
"target": [ "target": [
"nsis", "nsis",
"zip" "zip"
] ]
}, },
"nsis": { "nsis": {
"deleteAppDataOnUninstall": true, "deleteAppDataOnUninstall": true,
"oneClick": false, "oneClick": false,
"perMachine": false, "perMachine": false,
"runAfterFinish": true "runAfterFinish": true
}, },
"snap": { "snap": {
"publish": [ "publish": [
{ {
"provider": "github" "provider": "github"
} }
], ],
"plugs": [ "plugs": [
"default", "default",
"camera", "camera",
"audio-record", "audio-record",
"audio-playback", "audio-playback",
"removable-media", "removable-media",
"raw-usb", "raw-usb",
"u2f-devices", "u2f-devices",
"cups-control" "cups-control"
] ]
}, },
"linux": { "linux": {
"icon": "resources/installer/icons", "icon": "resources/installer/icons",
"category": "Network", "category": "Network",
"desktop": { "desktop": {
"Terminal": "false", "Terminal": "false",
"Type": "Application", "Type": "Application",
"Categories": "GTK;GNOME;Network;Email;Chat;InstantMessaging;" "Categories": "GTK;GNOME;Network;Email;Chat;InstantMessaging;"
}, },
"artifactName": "Rambox-${version}-linux-${arch}.${ext}", "artifactName": "Rambox-${version}-linux-${arch}.${ext}",
"executableArgs": [ "executableArgs": [
"--no-sandbox" "--no-sandbox"
], ],
"target": [ "target": [
{ {
"target": "snap", "target": "snap",
"arch": [ "arch": [
"x64" "x64"
] ]
}, },
{ {
"target": "AppImage", "target": "AppImage",
"arch": [ "arch": [
"x64", "x64",
"ia32" "ia32"
] ]
}, },
{ {
"target": "deb", "target": "deb",
"arch": [ "arch": [
"x64", "x64",
"ia32" "ia32"
] ]
}, },
{ {
"target": "rpm", "target": "rpm",
"arch": [ "arch": [
"x64", "x64",
"ia32" "ia32"
] ]
}, },
{ {
"target": "zip", "target": "zip",
"arch": [ "arch": [
"x64", "x64",
"ia32" "ia32"
] ]
}, },
{ {
"target": "tar.gz", "target": "tar.gz",
"arch": [ "arch": [
"x64", "x64",
"ia32" "ia32"
] ]
} }
] ]
}, },
"directories": { "directories": {
"buildResources": "resources/installer/", "buildResources": "resources/installer/",
"output": "dist/" "output": "dist/"
}, },
"publish": [ "publish": [
{ {
"provider": "github", "provider": "github",
"owner": "ramboxapp", "owner": "ramboxapp",
"repo": "community-edition", "repo": "community-edition",
"vPrefixedTagName": false "vPrefixedTagName": false
} }
] ]
}, },
"devDependencies": { "devDependencies": {
"asar": "0.12.4", "asar": "0.12.4",
"chai": "3.5.0", "chai": "3.5.0",
"crowdin": "1.0.0", "crowdin": "1.0.0",
"csvjson": "4.3.3", "csvjson": "4.3.3",
"electron": "11.4.10", "electron": "11.4.10",
"electron-builder": "22.9.1", "electron-builder": "22.9.1",
"electron-notarize": "1.0.0", "electron-notarize": "1.0.0",
"electron-packager": "15.1.0", "electron-packager": "15.1.0",
"mocha": "5.2.0", "mocha": "5.2.0",
"spectron": "3.8.0" "spectron": "3.8.0"
}, },
"dependencies": { "dependencies": {
"@exponent/electron-cookies": "2.0.0", "@exponent/electron-cookies": "2.0.0",
"auth0-js": "9.13.2", "auth0-js": "9.13.2",
"auto-launch-patched": "5.0.2", "auto-launch-patched": "5.0.2",
"crypto": "1.0.1", "crypto": "1.0.1",
"darkreader": "4.9.17", "darkreader": "4.9.17",
"diskusage": "1.1.3", "diskusage": "1.1.3",
"electron-contextmenu-wrapper": "git+https://github.com/ramboxapp/electron-contextmenu-wrapper.git", "electron-contextmenu-wrapper": "git+https://github.com/ramboxapp/electron-contextmenu-wrapper.git",
"electron-is-dev": "0.3.0", "electron-is-dev": "0.3.0",
"electron-log": "2.2.17", "electron-log": "2.2.17",
"electron-store": "6.0.0", "electron-store": "6.0.0",
"electron-updater": "4.1.2", "electron-updater": "4.1.2",
"is-online": "8.2.0", "is-online": "8.2.0",
"mime": "2.3.1", "mime": "2.3.1",
"mousetrap": "1.6.3", "mousetrap": "1.6.3",
"request": "2.88.0", "request": "2.88.0",
"request-promise": "4.2.2", "request-promise": "4.2.2",
"rimraf": "2.6.1", "rimraf": "2.6.1",
"tmp": "0.0.28" "tmp": "0.0.28"
}, },
"volta": { "volta": {
"node": "14.16.1" "node": "14.16.1"
} }
} }

22
resources/js/darkreader.js

@ -1,14 +1,14 @@
const { ipcRenderer } = require('electron'); const { ipcRenderer } = require("electron");
const darkreader = require('darkreader'); const darkreader = require("darkreader");
darkreader.setFetchMethod(window.fetch); darkreader.setFetchMethod(window.fetch);
const getIsEnabled = () => ipcRenderer.sendSync("getConfig").darkreader;
const canEnable = () =>
document.readyState === "complete" || document.readyState === "interactive";
const getIsEnabled = () => ipcRenderer.sendSync('getConfig').darkreader; document.addEventListener("readystatechange", () => {
const canEnable = () => document.readyState === 'complete' || document.readyState === 'interactive'; console.log(document.readyState);
if (canEnable()) {
document.addEventListener('readystatechange', () => { getIsEnabled() ? darkreader.enable() : darkreader.disable();
console.log(document.readyState) }
if (canEnable()) { });
getIsEnabled()? darkreader.enable(): darkreader.disable();
}
});

9
resources/js/rambox-service-api.js

@ -3,9 +3,12 @@
*/ */
const { desktopCapturer, ipcRenderer } = require("electron"); const { desktopCapturer, ipcRenderer } = require("electron");
require("./darkreader.js") require("./darkreader.js");
const { ipcRenderer } = require('electron'); const { ipcRenderer } = require("electron");
const { ContextMenuBuilder, ContextMenuListener } = require('electron-contextmenu-wrapper'); const {
ContextMenuBuilder,
ContextMenuListener,
} = require("electron-contextmenu-wrapper");
/** /**
* Make the Rambox API available via a global "rambox" variable. * Make the Rambox API available via a global "rambox" variable.

253
resources/languages/en.js

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save