From dffcf51f888c3476dfd3f57fbaedd151514dd580 Mon Sep 17 00:00:00 2001 From: Ryan Tharp Date: Wed, 4 Sep 2019 00:07:30 -0700 Subject: [PATCH] add defaultPublicChatServer to config --- app/sql.js | 7 +++++-- config/default.json | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/sql.js b/app/sql.js index bd1e4f1e6..056058077 100644 --- a/app/sql.js +++ b/app/sql.js @@ -5,6 +5,7 @@ const sql = require('@journeyapps/sqlcipher'); const { app, dialog, clipboard } = require('electron'); const { redactAll } = require('../js/modules/privacy'); const { remove: removeUserConfig } = require('./user_config'); +const config = require('./config'); const pify = require('pify'); const uuidv4 = require('uuid/v4'); @@ -833,9 +834,11 @@ async function updateToLokiSchemaVersion1(currentVersion, instance) { }; const lokiPublicServerData = { - serverUrl: 'https://chat.lokinet.org', + // make sure we don't have a trailing slash just in case + serverUrl: config.get('defaultPublicChatServer').replace(/\/*$/, ''), token: null, }; + console.log('lokiPublicServerData', lokiPublicServerData); const baseData = { friendRequestStatus: 4, // Friends @@ -851,7 +854,7 @@ async function updateToLokiSchemaVersion1(currentVersion, instance) { const publicChatData = { ...baseData, - id: 'publicChat:1@chat.lokinet.org', + id: 'publicChat:1@' + lokiPublicServerData.serverUrl.replace(/^https?\:\/\//i, ''), server: lokiPublicServerData.serverUrl, name: 'Loki Public Chat', channelId: '1', diff --git a/config/default.json b/config/default.json index 8740d6b93..a1e9adf51 100644 --- a/config/default.json +++ b/config/default.json @@ -22,5 +22,6 @@ "certificateAuthority": "-----BEGIN CERTIFICATE-----\nMIID7zCCAtegAwIBAgIJAIm6LatK5PNiMA0GCSqGSIb3DQEBBQUAMIGNMQswCQYD\nVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5j\naXNjbzEdMBsGA1UECgwUT3BlbiBXaGlzcGVyIFN5c3RlbXMxHTAbBgNVBAsMFE9w\nZW4gV2hpc3BlciBTeXN0ZW1zM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FaI4nL8QU4La1x2en\n4DGXRaLMPRwjELNgQPodR38zoCMuA8gHZfZYYoZ7D7Q1wNUiVHcxuFrEeBaYJbLE\nrwLV\n-----END CERTIFICATE-----\n", "import": false, - "serverTrustRoot": "BbqY1DzohE4NUZoVF+L18oUPrK3kILllLEJh2UnPSsEx" + "serverTrustRoot": "BbqY1DzohE4NUZoVF+L18oUPrK3kILllLEJh2UnPSsEx", + "defaultPublicChatServer": "https://chat.lokinet.org/" }