Merge pull request #2196 from oxen-io/clearnet

Session 1.7.8 without calls
pull/3064/head
Audric Ackermann 3 years ago committed by GitHub
commit 296fea4924
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,11 +2,21 @@ const path = require('path');
const fs = require('fs'); const fs = require('fs');
const rimraf = require('rimraf'); const rimraf = require('rimraf');
const SQL = require('better-sqlite3'); const SQL = require('better-sqlite3');
const { app, dialog, clipboard } = require('electron'); const { app, dialog, clipboard, Notification } = require('electron');
const { redactAll } = require('../js/modules/privacy'); const { redactAll } = require('../js/modules/privacy');
const { remove: removeUserConfig } = require('./user_config');
const { map, isString, fromPairs, forEach, last, isEmpty, isObject, isNumber } = require('lodash'); const {
map,
flattenDeep,
uniq,
isString,
fromPairs,
forEach,
last,
isEmpty,
isObject,
isNumber,
} = require('lodash');
/* eslint-disable camelcase */ /* eslint-disable camelcase */
@ -1392,16 +1402,17 @@ function updateToLokiSchemaVersion21(currentVersion, db) {
`); `);
// all closed group admins // all closed group admins
const closedGroupRows = getAllClosedGroupConversations(db) || []; const closedGroups = getAllClosedGroupConversations(db) || [];
const adminIds = closedGroupRows.map(json => jsonToObject(json).groupAdmins); const adminIds = closedGroups.map(g => g.groupAdmins);
forEach(adminIds, id => { const flattenedAdmins = uniq(flattenDeep(adminIds)) || [];
db.exec(
forEach(flattenedAdmins, id => {
db.prepare(
` `
UPDATE ${CONVERSATIONS_TABLE} SET UPDATE ${CONVERSATIONS_TABLE} SET
json = json_set(json, '$.didApproveMe', 1, '$.isApproved', 1) json = json_set(json, '$.didApproveMe', 1, '$.isApproved', 1)
WHERE type = id WHERE id = $id;
values ($id);
` `
).run({ ).run({
id, id,
@ -1482,6 +1493,14 @@ function _initializePaths(configDir) {
databaseFilePath = path.join(dbDir, 'db.sqlite'); databaseFilePath = path.join(dbDir, 'db.sqlite');
} }
function showFailedToStart() {
const notification = new Notification({
title: 'Session failed to start',
body: 'Please start from terminal and open a github issue',
});
notification.show();
}
function initialize({ configDir, key, messages, passwordAttempt }) { function initialize({ configDir, key, messages, passwordAttempt }) {
if (globalInstance) { if (globalInstance) {
throw new Error('Cannot initialize more than once!'); throw new Error('Cannot initialize more than once!');
@ -1544,9 +1563,7 @@ function initialize({ configDir, key, messages, passwordAttempt }) {
clipboard.writeText(`Database startup error:\n\n${redactAll(error.stack)}`); clipboard.writeText(`Database startup error:\n\n${redactAll(error.stack)}`);
} else { } else {
close(); close();
removeDB(); showFailedToStart();
removeUserConfig();
app.relaunch();
} }
app.exit(1); app.exit(1);
@ -2314,8 +2331,8 @@ function getUnreadCountByConversation(conversationId) {
function getMessageCountByType(conversationId, type = '%') { function getMessageCountByType(conversationId, type = '%') {
const row = globalInstance const row = globalInstance
.prepare( .prepare(
`SELECT count(*) from ${MESSAGES_TABLE} `SELECT count(*) from ${MESSAGES_TABLE}
WHERE conversationId = $conversationId WHERE conversationId = $conversationId
AND type = $type;` AND type = $type;`
) )
.get({ .get({

@ -2,7 +2,7 @@
"name": "session-desktop", "name": "session-desktop",
"productName": "Session", "productName": "Session",
"description": "Private messaging from your desktop", "description": "Private messaging from your desktop",
"version": "1.8.2", "version": "1.7.8",
"license": "GPL-3.0", "license": "GPL-3.0",
"author": { "author": {
"name": "Oxen Labs", "name": "Oxen Labs",

@ -31,7 +31,7 @@ window.getNodeVersion = () => config.node_version;
window.sessionFeatureFlags = { window.sessionFeatureFlags = {
useOnionRequests: true, useOnionRequests: true,
useCallMessage: true, useCallMessage: false,
}; };
window.versionInfo = { window.versionInfo = {

Loading…
Cancel
Save