diff --git a/Backers.md b/Backers.md deleted file mode 100644 index 485bd372..00000000 --- a/Backers.md +++ /dev/null @@ -1,6 +0,0 @@ -# Monthly Donators - -[Martin Grünbaum](https://github.com/alathon) - -Ivan Toshkov -[Simon Joda Stößer](https://github.com/SimJoSt) diff --git a/app/Application.js b/app/Application.js index a47452d6..dbe77934 100644 --- a/app/Application.js +++ b/app/Application.js @@ -23,7 +23,9 @@ Ext.define('Rambox.Application', { ,config: { totalServicesLoaded: 0 ,totalNotifications: 0 + ,googleURLs: [] } + ,launch: function () { const isOnline = require('is-online'); @@ -165,6 +167,14 @@ Ext.define('Rambox.Application', { // Check for updates if ( require('electron').remote.process.argv.indexOf('--without-update') === -1 ) Rambox.app.checkUpdate(true); + // Get Google URLs + 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); + } + }); // Shortcuts const platform = require('electron').remote.process.platform; @@ -267,12 +277,12 @@ Ext.define('Rambox.Application', { ,checkUpdate: function(silence) { console.info('Checking for updates...'); Ext.Ajax.request({ - url: 'https://rambox.pro/api/latestversion.json' + 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.version) ) { + if ( appVersion.isLessThan(json.name) && !json.draft && !json.prerelease ) { console.info('New version is available', json.version); Ext.cq1('app-main').addDocked({ xtype: 'toolbar' diff --git a/app/store/ServicesList.js b/app/store/ServicesList.js index 59d42328..a2172525 100644 --- a/app/store/ServicesList.js +++ b/app/store/ServicesList.js @@ -10,7 +10,7 @@ Ext.define('Rambox.store.ServicesList', { ,proxy: { type: 'ajax', - url: 'https://raw.githubusercontent.com/saenzramiro/rambox/gh-pages/api/services.json', + url: 'https://raw.githubusercontent.com/ramboxapp/community-edition/gh-pages/api/services.json', reader: { type: 'json', rootProperty: 'responseText' diff --git a/app/ux/Auth0.js b/app/ux/Auth0.js index 29360ad1..6d771b37 100644 --- a/app/ux/Auth0.js +++ b/app/ux/Auth0.js @@ -273,9 +273,7 @@ Ext.define('Rambox.ux.Auth0', { authWindow.webContents.on('did-start-loading', function(e) { authWindow.webContents.session.webRequest.onBeforeSendHeaders((details, callback) => { - let googleLoginURLs = ['accounts.google.com/signin/oauth', 'accounts.google.com/ServiceLogin', 'accounts.google.com/_/lookup/accountlookup'] - - googleLoginURLs.forEach((loginURL) => { + 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 }); }); diff --git a/app/ux/WebView.js b/app/ux/WebView.js index c7229bf8..3fbd5475 100644 --- a/app/ux/WebView.js +++ b/app/ux/WebView.js @@ -276,7 +276,6 @@ Ext.define('Rambox.ux.WebView',{ if ( !me.record.get('enabled') ) return; var webview = me.getWebView(); - let googleLoginURLs = ['accounts.google.com/signin', 'accounts.google.com/ServiceLogin', 'accounts.google.com/_/lookup/accountlookup'] me.errorCodeLog = [] // Google Analytics Event @@ -290,7 +289,7 @@ Ext.define('Rambox.ux.WebView',{ console.info('Start loading...', me.src); webview.getWebContents().session.webRequest.onBeforeSendHeaders((details, callback) => { - googleLoginURLs.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'}) + 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 }); }); @@ -600,7 +599,7 @@ Ext.define('Rambox.ux.WebView',{ }) eventsOnDom = true; - googleLoginURLs.forEach((loginURL) => { if ( webview.getURL().indexOf(loginURL) > -1 ) webview.reload() }) + Rambox.app.config.googleURLs.forEach((loginURL) => { if ( webview.getURL().indexOf(loginURL) > -1 ) webview.reload() }) } webview.executeJavaScript(js_inject).then(result => {} ).catch(err => { console.log(err) }) }); diff --git a/electron/main.js b/electron/main.js index 7ea09fd8..f55cdbc0 100644 --- a/electron/main.js +++ b/electron/main.js @@ -15,6 +15,10 @@ const updater = require('./updater'); var fs = require("fs"); const path = require('path'); +// Disk usage: +const disk = require('diskusage'); +const appPath = app.getAppPath(); + if ( isDev ) app.getVersion = function() { return require('../package.json').version; }; // FOR DEV ONLY, BECAUSE IN DEV RETURNS ELECTRON'S VERSION // Initial Config @@ -251,6 +255,40 @@ function updateBadge(title) { if ( messageCount > 0 && !mainWindow.isFocused() && !config.get('dont_disturb') && config.get('flash_frame') ) mainWindow.flashFrame(true); } +function formatBytes(bytes, decimals = 2) { + if (bytes === 0) return '0 Bytes'; + + const k = 1024; + const dm = decimals < 0 ? 0 : decimals; + const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; + + const i = Math.floor(Math.log(bytes) / Math.log(k)); + + return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; +} + +async function availableSpaceWatchDog() { + // optionally render this information also in rambox window + try { + const { available } = await disk.check(appPath); + if (available < 1073741824) { // 1 GB + const options = { + type: 'warning', + buttons: ['OK, quit'], + defaultId: 0, + title: `Running out of disk space! - Rambox shutting down`, + detail: `You've got just ${formatBytes(available)} space left.\n\nRambox has been frozen to prevent settings corruption.\n\nOnce you quit this dialog, Rambox will shutdown.\n\n1 GB of avalable disk space is required.\nFree up space on partition where Rambox is installed then start the app again.\n\nRambox path: \n${appPath}`, + message: `Running out of disk space! - Rambox shutting down`, + }; + + dialog.showMessageBoxSync(null, options); + app.quit(); + } + } catch (err) { + console.error(err) + } +} + ipcMain.on('setBadge', function(event, messageCount, value) { mainWindow.setOverlayIcon(nativeImage.createFromDataURL(value), messageCount.toString()); }); @@ -475,8 +513,8 @@ if ( config.get('disable_gpu') ) app.disableHardwareAcceleration(); // initialization and is ready to create browser windows. app.on('ready', function() { config.get('master_password') ? createMasterPasswordWindow() : createWindow(); + setInterval(availableSpaceWatchDog, 1000 * 60); }); - // Quit when all windows are closed. app.on('window-all-closed', function () { // On OS X it is common for applications and their menu bar diff --git a/package.json b/package.json index 8208f552..cf979d2c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "Rambox", "productName": "Rambox", - "version": "0.7.6", + "version": "0.7.7", "description": "Free and Open Source messaging and emailing app that combines common web applications into one.", "main": "electron/main.js", "repository": { @@ -124,7 +124,10 @@ ], "plugs": [ "default", - "camera" + "camera", + "audio-record", + "audio-playback", + "removable-media" ] }, "linux": { @@ -210,6 +213,7 @@ "auto-launch-patched": "5.0.2", "crypto": "1.0.1", "darkreader": "4.9.17", + "diskusage": "1.1.3", "electron-contextmenu-wrapper": "2.0.0", "electron-is-dev": "0.3.0", "electron-log": "2.2.17",