Browse Source

Merge branch 'master' into feature/docker

feature/dockerfile-arm
Gonzalo Javier Aune 5 years ago
parent
commit
4fa57ac654
  1. 4
      README.md
  2. 3
      api/controllers/chats.ts
  3. 3
      api/controllers/confirmations.ts
  4. 3
      api/controllers/contacts.ts
  5. 3
      api/controllers/details.ts
  6. 4
      api/controllers/index.ts
  7. 3
      api/controllers/invoices.ts
  8. 5
      api/controllers/media.ts
  9. 13
      api/controllers/messages.ts
  10. 3
      api/controllers/subscriptions.ts
  11. 5
      api/controllers/uploads.ts
  12. 3
      api/grpc/index.ts
  13. 5
      api/hub.ts
  14. 11
      api/models/index.ts
  15. 3
      api/utils/ldat.ts
  16. 4
      api/utils/lightning.ts
  17. 2
      api/utils/setup.ts
  18. 18
      api/utils/socket.ts
  19. 3
      app.ts
  20. BIN
      binaries/node_sqlite3.node
  21. 34
      config/app.json
  22. 2
      config/config.json
  23. 3
      dist/api/controllers/chats.js
  24. 2
      dist/api/controllers/chats.js.map
  25. 3
      dist/api/controllers/confirmations.js
  26. 2
      dist/api/controllers/confirmations.js.map
  27. 3
      dist/api/controllers/contacts.js
  28. 2
      dist/api/controllers/contacts.js.map
  29. 3
      dist/api/controllers/details.js
  30. 2
      dist/api/controllers/details.js.map
  31. 4
      dist/api/controllers/index.js
  32. 2
      dist/api/controllers/index.js.map
  33. 3
      dist/api/controllers/invoices.js
  34. 2
      dist/api/controllers/invoices.js.map
  35. 5
      dist/api/controllers/media.js
  36. 2
      dist/api/controllers/media.js.map
  37. 10
      dist/api/controllers/messages.js
  38. 2
      dist/api/controllers/messages.js.map
  39. 3
      dist/api/controllers/subscriptions.js
  40. 2
      dist/api/controllers/subscriptions.js.map
  41. 5
      dist/api/controllers/uploads.js
  42. 2
      dist/api/controllers/uploads.js.map
  43. 3
      dist/api/grpc/index.js
  44. 2
      dist/api/grpc/index.js.map
  45. 5
      dist/api/hub.js
  46. 2
      dist/api/hub.js.map
  47. 11
      dist/api/models/index.js
  48. 2
      dist/api/models/index.js.map
  49. 3
      dist/api/utils/ldat.js
  50. 2
      dist/api/utils/ldat.js.map
  51. 3
      dist/api/utils/lightning.js
  52. 2
      dist/api/utils/lightning.js.map
  53. 3
      dist/api/utils/setup.js
  54. 2
      dist/api/utils/setup.js.map
  55. 18
      dist/api/utils/socket.js
  56. 2
      dist/api/utils/socket.js.map
  57. 3
      dist/app.js
  58. 2
      dist/app.js.map
  59. 0
      dist/public/uploads/.gitkeep
  60. 112
      install_guide_myNode.md
  61. 20
      package-lock.json
  62. 12
      package.json

4
README.md

@ -71,6 +71,10 @@ NOTE: All lncli commands need to be prepended with `docker-compose exec lnd`, th
You can run your own Sphinx node in order to have full ownership over your communication! You can run your own Sphinx node in order to have full ownership over your communication!
### guide
mynode users: here is a complete guide provided by someone who is running Relay at home: [MyNode Guide](https://github.com/stakwork/sphinx-relay/blob/master/install_guide_myNode.md)
### download ### download
`git clone https://github.com/stakwork/sphinx-relay` `git clone https://github.com/stakwork/sphinx-relay`

3
api/controllers/chats.ts

@ -5,8 +5,9 @@ import * as helpers from '../helpers'
import * as socket from '../utils/socket' import * as socket from '../utils/socket'
import { sendNotification } from '../hub' import { sendNotification } from '../hub'
import * as md5 from 'md5' import * as md5 from 'md5'
import * as path from 'path'
const constants = require(__dirname + '/../../config/constants.json') const constants = require(path.join(__dirname,'../../config/constants.json'))
async function getChats(req, res) { async function getChats(req, res) {
const chats = await models.Chat.findAll({ where:{deleted:false}, raw: true }) const chats = await models.Chat.findAll({ where:{deleted:false}, raw: true })

3
api/controllers/confirmations.ts

@ -3,8 +3,9 @@ import {models} from '../models'
import * as socket from '../utils/socket' import * as socket from '../utils/socket'
import * as jsonUtils from '../utils/json' import * as jsonUtils from '../utils/json'
import * as helpers from '../helpers' import * as helpers from '../helpers'
import * as path from 'path'
const constants = require(__dirname + '/../../config/constants.json') const constants = require(path.join(__dirname,'../../config/constants.json'))
export function sendConfirmation({ chat, sender, msg_id }) { export function sendConfirmation({ chat, sender, msg_id }) {
helpers.sendMessage({ helpers.sendMessage({

3
api/controllers/contacts.ts

@ -5,8 +5,9 @@ import * as helpers from '../helpers'
import * as jsonUtils from '../utils/json' import * as jsonUtils from '../utils/json'
import {success, failure} from '../utils/res' import {success, failure} from '../utils/res'
import password from '../utils/password' import password from '../utils/password'
import * as path from 'path'
const constants = require(__dirname + '/../../config/constants.json') const constants = require(path.join(__dirname,'../../config/constants.json'))
const getContacts = async (req, res) => { const getContacts = async (req, res) => {
const contacts = await models.Contact.findAll({ where:{deleted:false}, raw: true }) const contacts = await models.Contact.findAll({ where:{deleted:false}, raw: true })

3
api/controllers/details.ts

@ -2,9 +2,10 @@ import {loadLightning} from '../utils/lightning'
import { success, failure } from '../utils/res' import { success, failure } from '../utils/res'
import * as readLastLines from 'read-last-lines' import * as readLastLines from 'read-last-lines'
import { nodeinfo } from '../utils/nodeinfo'; import { nodeinfo } from '../utils/nodeinfo';
import * as path from 'path'
const env = process.env.NODE_ENV || 'development'; const env = process.env.NODE_ENV || 'development';
const config = require(__dirname + '/../../config/app.json')[env]; const config = require(path.join(__dirname,'../../config/app.json'))[env]
const defaultLogFiles = [ const defaultLogFiles = [
'/home/lnd/.pm2/logs/app-error.log', '/home/lnd/.pm2/logs/app-error.log',

4
api/controllers/index.ts

@ -2,8 +2,9 @@ import {models} from '../models'
import * as lndService from '../grpc' import * as lndService from '../grpc'
import {checkTag} from '../utils/gitinfo' import {checkTag} from '../utils/gitinfo'
import {checkConnection} from '../utils/lightning' import {checkConnection} from '../utils/lightning'
import * as path from 'path'
const constants = require(__dirname + '/../../config/constants.json'); const constants = require(path.join(__dirname,'../../config/constants.json'))
const env = process.env.NODE_ENV || 'development'; const env = process.env.NODE_ENV || 'development';
console.log("=> env:",env) console.log("=> env:",env)
@ -78,6 +79,7 @@ async function set(app) {
app.post('/contacts', controllers.contacts.createContact) app.post('/contacts', controllers.contacts.createContact)
app.delete('/contacts/:id', controllers.contacts.deleteContact) app.delete('/contacts/:id', controllers.contacts.deleteContact)
app.get('/allmessages', controllers.messages.getAllMessages)
app.get('/messages', controllers.messages.getMessages) app.get('/messages', controllers.messages.getMessages)
app.delete('/message/:id', controllers.messages.deleteMessage) app.delete('/message/:id', controllers.messages.deleteMessage)
app.post('/messages', controllers.messages.sendMessage) app.post('/messages', controllers.messages.sendMessage)

3
api/controllers/invoices.ts

@ -7,8 +7,9 @@ import * as helpers from '../helpers'
import { sendNotification } from '../hub' import { sendNotification } from '../hub'
import { success } from '../utils/res' import { success } from '../utils/res'
import {sendConfirmation} from './confirmations' import {sendConfirmation} from './confirmations'
import * as path from 'path'
const constants = require(__dirname + '/../../config/constants.json'); const constants = require(path.join(__dirname,'../../config/constants.json'))
const payInvoice = async (req, res) => { const payInvoice = async (req, res) => {
const lightning = await loadLightning() const lightning = await loadLightning()

5
api/controllers/media.ts

@ -12,10 +12,11 @@ import {CronJob} from 'cron'
import * as zbase32 from '../utils/zbase32' import * as zbase32 from '../utils/zbase32'
import * as schemas from './schemas' import * as schemas from './schemas'
import {sendConfirmation} from './confirmations' import {sendConfirmation} from './confirmations'
import * as path from 'path'
const env = process.env.NODE_ENV || 'development'; const env = process.env.NODE_ENV || 'development';
const config = require(__dirname + '/../../config/app.json')[env]; const config = require(path.join(__dirname,'../../config/app.json'))[env]
const constants = require(__dirname + '/../../config/constants.json'); const constants = require(path.join(__dirname,'../../config/constants.json'))
/* /*

13
api/controllers/messages.ts

@ -7,8 +7,9 @@ import * as jsonUtils from '../utils/json'
import * as helpers from '../helpers' import * as helpers from '../helpers'
import { success } from '../utils/res' import { success } from '../utils/res'
import {sendConfirmation} from './confirmations' import {sendConfirmation} from './confirmations'
import * as path from 'path'
const constants = require(__dirname + '/../../config/constants.json') const constants = require(path.join(__dirname,'../../config/constants.json'))
const getMessages = async (req, res) => { const getMessages = async (req, res) => {
const dateToReturn = req.query.date; const dateToReturn = req.query.date;
@ -69,9 +70,12 @@ const getMessages = async (req, res) => {
} }
const getAllMessages = async (req, res) => { const getAllMessages = async (req, res) => {
const messages = await models.Message.findAll({ order: [['id', 'asc']] }) const limit = (req.query.limit && parseInt(req.query.limit)) || 1000
const offset = (req.query.offset && parseInt(req.query.offset)) || 0
const messages = await models.Message.findAll({ order: [['id', 'asc']], limit, offset })
const chatIds = messages.map(m => m.chatId) const chatIds = messages.map(m => m.chatId)
console.log('=> getAllMessages, chatIds',chatIds) console.log(`=> getAllMessages, limit: ${limit}, offset: ${offset}`)
let chats = chatIds.length > 0 ? await models.Chat.findAll({ where: {deleted:false, id: chatIds} }) : [] let chats = chatIds.length > 0 ? await models.Chat.findAll({ where: {deleted:false, id: chatIds} }) : []
const chatsById = indexBy(chats, 'id') const chatsById = indexBy(chats, 'id')
@ -210,5 +214,6 @@ export {
receiveMessage, receiveMessage,
clearMessages, clearMessages,
readMessages, readMessages,
deleteMessage deleteMessage,
getAllMessages,
} }

3
api/controllers/subscriptions.ts

@ -8,8 +8,9 @@ import * as jsonUtils from '../utils/json'
import * as helpers from '../helpers' import * as helpers from '../helpers'
import * as rsa from '../crypto/rsa' import * as rsa from '../crypto/rsa'
import * as moment from 'moment' import * as moment from 'moment'
import * as path from 'path'
const constants = require(__dirname + '/../../config/constants.json'); const constants = require(path.join(__dirname,'../../config/constants.json'))
// store all current running jobs in memory // store all current running jobs in memory
let jobs = {} let jobs = {}

5
api/controllers/uploads.ts

@ -1,13 +1,14 @@
import {models} from '../models' import {models} from '../models'
import * as path from 'path'
const env = process.env.NODE_ENV || 'development'; const env = process.env.NODE_ENV || 'development';
const config = require(__dirname + '/../../config/app.json')[env]; const config = require(path.join(__dirname,'../../config/app.json'))[env]
// setup disk storage // setup disk storage
var multer = require('multer') var multer = require('multer')
var avatarStorage = multer.diskStorage({ var avatarStorage = multer.diskStorage({
destination: (req, file, cb) => { destination: (req, file, cb) => {
let dir = __dirname.includes('/dist/') ? __dirname+'/..' : __dirname let dir = __dirname.includes('/dist/') ? path.join(__dirname,'..') : __dirname
cb(null, dir + '/../../public/uploads') cb(null, dir + '/../../public/uploads')
}, },
filename: (req, file, cb) => { filename: (req, file, cb) => {

3
api/grpc/index.ts

@ -6,8 +6,9 @@ import * as decodeUtils from '../utils/decode'
import {loadLightning, SPHINX_CUSTOM_RECORD_KEY, verifyAscii} from '../utils/lightning' import {loadLightning, SPHINX_CUSTOM_RECORD_KEY, verifyAscii} from '../utils/lightning'
import * as controllers from '../controllers' import * as controllers from '../controllers'
import * as moment from 'moment' import * as moment from 'moment'
import * as path from 'path'
const constants = require(__dirname + '/../../config/constants.json'); const constants = require(path.join(__dirname,'../../config/constants.json'))
// VERIFY PUBKEY OF SENDER // VERIFY PUBKEY OF SENDER
async function parseAndVerifyPayload(data){ async function parseAndVerifyPayload(data){

5
api/hub.ts

@ -6,10 +6,11 @@ import * as jsonUtils from './utils/json'
import * as helpers from './helpers' import * as helpers from './helpers'
import {nodeinfo} from './utils/nodeinfo' import {nodeinfo} from './utils/nodeinfo'
import { loadLightning } from './utils/lightning' import { loadLightning } from './utils/lightning'
import * as path from 'path'
const constants = require(__dirname + '/../config/constants.json'); const constants = require(path.join(__dirname, '../config/constants.json'))
const env = process.env.NODE_ENV || 'development'; const env = process.env.NODE_ENV || 'development';
const config = require('../config/app.json')[env]; const config = require(path.join(__dirname,'../config/app.json'))[env];
const checkInviteHub = async (params = {}) => { const checkInviteHub = async (params = {}) => {
if (env != "production") { if (env != "production") {

11
api/models/index.ts

@ -1,12 +1,19 @@
import {Sequelize} from 'sequelize-typescript'; import {Sequelize} from 'sequelize-typescript';
import * as path from 'path'
import Chat from './ts/chat'
import Contact from './ts/contact'
import Invite from './ts/invite'
import Message from './ts/message'
import Subscription from './ts/subscription'
import MediaKey from './ts/mediaKey'
const env = process.env.NODE_ENV || 'development'; const env = process.env.NODE_ENV || 'development';
const config = require(__dirname + '/../../config/config.json')[env]; const config = require(path.join(__dirname,'../../config/config.json'))[env]
const sequelize = new Sequelize({ const sequelize = new Sequelize({
...config, ...config,
logging: process.env.SQL_LOG==='true' ? console.log : false, logging: process.env.SQL_LOG==='true' ? console.log : false,
models: [__dirname + '/ts'] models: [Chat,Contact,Invite,Message,Subscription,MediaKey]
}) })
const models = sequelize.models const models = sequelize.models

3
api/utils/ldat.ts

@ -1,8 +1,9 @@
import * as zbase32 from './zbase32' import * as zbase32 from './zbase32'
import {signBuffer} from './lightning' import {signBuffer} from './lightning'
import * as path from 'path'
const env = process.env.NODE_ENV || 'development' const env = process.env.NODE_ENV || 'development'
const config = require(__dirname + '/../../config/app.json')[env] const config = require(path.join(__dirname,'../../config/app.json'))[env]
/* /*
Lightning Data Access Token Lightning Data Access Token

4
api/utils/lightning.ts

@ -4,9 +4,11 @@ import * as grpc from 'grpc'
import { sleep } from '../helpers'; import { sleep } from '../helpers';
import * as sha from 'js-sha256' import * as sha from 'js-sha256'
import * as crypto from 'crypto' import * as crypto from 'crypto'
import * as path from 'path'
// var protoLoader = require('@grpc/proto-loader') // var protoLoader = require('@grpc/proto-loader')
const env = process.env.NODE_ENV || 'development'; const env = process.env.NODE_ENV || 'development';
const config = require(__dirname + '/../../config/app.json')[env]; const config = require(path.join(__dirname,'../../config/app.json'))[env]
const LND_KEYSEND_KEY = 5482373484 const LND_KEYSEND_KEY = 5482373484
const SPHINX_CUSTOM_RECORD_KEY = 133773310 const SPHINX_CUSTOM_RECORD_KEY = 133773310

2
api/utils/setup.ts

@ -114,7 +114,7 @@ async function printQR(){
return return
} }
let theIP = public_ip let theIP = public_ip
if(!theIP.includes(":")) theIP = public_ip+':3001' // if(!theIP.includes(":")) theIP = public_ip+':3001'
const b64 = Buffer.from(`ip::${theIP}::${password||''}`).toString('base64') const b64 = Buffer.from(`ip::${theIP}::${password||''}`).toString('base64')
console.log('Scan this QR in Sphinx app:') console.log('Scan this QR in Sphinx app:')

18
api/utils/socket.ts

@ -1,7 +1,9 @@
import * as WebSocket from 'ws' import * as WebSocket from 'ws'
let connections = new Map() // let connections = new Map()
let connectionCounter = 0 // let connectionCounter = 0
let lastConn: any
const connect = (server) => { const connect = (server) => {
server = new WebSocket.Server({ server }) server = new WebSocket.Server({ server })
@ -10,16 +12,18 @@ const connect = (server) => {
server.on('connection', socket => { server.on('connection', socket => {
console.log('=> [socket] connection received') console.log('=> [socket] connection received')
var id = connectionCounter++; // var id = connectionCounter++;
connections.set(id, socket) // connections.set(id, socket)
lastConn = socket
}) })
} }
const send = (body) => { const send = (body) => {
connections.forEach((socket, index) => { // connections.forEach((socket, index) => {
socket.send(body) // socket.send(body)
}) // })
if(lastConn) lastConn.send(body)
} }
const sendJson = (object) => { const sendJson = (object) => {

3
app.ts

@ -3,6 +3,7 @@ import * as bodyParser from 'body-parser'
import * as helmet from 'helmet' import * as helmet from 'helmet'
import * as cookieParser from 'cookie-parser' import * as cookieParser from 'cookie-parser'
import * as crypto from 'crypto' import * as crypto from 'crypto'
import * as path from 'path'
import {models} from './api/models' import {models} from './api/models'
import logger from './api/utils/logger' import logger from './api/utils/logger'
import {pingHubInterval, checkInvitesHubInterval} from './api/hub' import {pingHubInterval, checkInvitesHubInterval} from './api/hub'
@ -13,7 +14,7 @@ import * as socket from './api/utils/socket'
let server: any = null let server: any = null
const port = process.env.PORT || 3001; const port = process.env.PORT || 3001;
const env = process.env.NODE_ENV || 'development'; const env = process.env.NODE_ENV || 'development';
const config = require(__dirname + '/config/app.json')[env]; const config = require(path.join(__dirname, 'config/app.json'))[env];
process.env.GRPC_SSL_CIPHER_SUITES = 'HIGH+ECDSA' process.env.GRPC_SSL_CIPHER_SUITES = 'HIGH+ECDSA'

BIN
binaries/node_sqlite3.node

Binary file not shown.

34
config/app.json

@ -1,28 +1,32 @@
{ {
"development": { "development": {
"macaroon_location": "/relay/.lnd/data/chain/bitcoin/mainnet/admin.macaroon", "senza_url": "http://localhost:3000/api/v2",
"tls_location": "/relay/.lnd/tls.cert", "macaroon_location": "/Users/evanfeenstra/code/lnd-dev/alice/data/chain/bitcoin/simnet/admin.macaroon",
"node_ip": "172.22.0.2", "tls_location": "/Users/evanfeenstra/Library/Application Support/Lnd/tls.cert",
"lnd_port": "10009", "node_ip": "127.0.0.1",
"lnd_port": "10001",
"node_http_protocol": "http", "node_http_protocol": "http",
"node_http_port": "3000", "node_http_port": "3001",
"hub_api_url": "http://hub.sphinx.chat/api/v1", "hub_api_url": "http://lvh.me/api/v1",
"hub_url": "http://hub.sphinx.chat/ping", "hub_url": "http://lvh.me/ping",
"hub_invite_url": "http://hub.sphinx.chat/invites", "hub_invite_url": "http://lvh.me/invites",
"hub_check_invite_url": "http://hub.sphinx.chat/check_invite", "hub_check_invite_url": "http://lvh.me/check_invite",
"media_host": "memes.sphinx.chat" "media_host": "localhost:5000"
}, },
"production": { "production": {
"macaroon_location": "/relay/.lnd/data/chain/bitcoin/mainnet/admin.macaroon", "senza_url": "https://staging.senza.us/api/v2/",
"tls_location": "/relay/.lnd/tls.cert", "macaroon_location": "/home/ubuntu/.lnd/data/chain/bitcoin/mainnet/admin.macaroon",
"tls_location": "/home/ubuntu/.lnd/tls.cert",
"lnd_log_location": "/home/ubuntu/.lnd/logs/bitcoin/mainnet/lnd.log",
"lncli_location": "/home/ubuntu/go/bin",
"node_ip": "localhost", "node_ip": "localhost",
"lnd_port": "10009",
"node_http_protocol": "http", "node_http_protocol": "http",
"node_http_port": "3000", "node_http_port": "80",
"lnd_port": "10009",
"hub_api_url": "https://hub.sphinx.chat/api/v1", "hub_api_url": "https://hub.sphinx.chat/api/v1",
"hub_url": "https://hub.sphinx.chat/ping", "hub_url": "https://hub.sphinx.chat/ping",
"hub_invite_url": "https://hub.sphinx.chat/invites", "hub_invite_url": "https://hub.sphinx.chat/invites",
"hub_check_invite_url": "https://hub.sphinx.chat/check_invite", "hub_check_invite_url": "https://hub.sphinx.chat/check_invite",
"media_host": "memes.sphinx.chat" "media_host": "memes.sphinx.chat"
} }
} }

2
config/config.json

@ -13,6 +13,6 @@
}, },
"production": { "production": {
"dialect": "sqlite", "dialect": "sqlite",
"storage": "./.lnd/sphinx.db" "storage": "/home/ubuntu/sphinx.db"
} }
} }

3
dist/api/controllers/chats.js

@ -16,7 +16,8 @@ const helpers = require("../helpers");
const socket = require("../utils/socket"); const socket = require("../utils/socket");
const hub_1 = require("../hub"); const hub_1 = require("../hub");
const md5 = require("md5"); const md5 = require("md5");
const constants = require(__dirname + '/../../config/constants.json'); const path = require("path");
const constants = require(path.join(__dirname, '../../config/constants.json'));
function getChats(req, res) { function getChats(req, res) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const chats = yield models_1.models.Chat.findAll({ where: { deleted: false }, raw: true }); const chats = yield models_1.models.Chat.findAll({ where: { deleted: false }, raw: true });

2
dist/api/controllers/chats.js.map

File diff suppressed because one or more lines are too long

3
dist/api/controllers/confirmations.js

@ -14,7 +14,8 @@ const models_1 = require("../models");
const socket = require("../utils/socket"); const socket = require("../utils/socket");
const jsonUtils = require("../utils/json"); const jsonUtils = require("../utils/json");
const helpers = require("../helpers"); const helpers = require("../helpers");
const constants = require(__dirname + '/../../config/constants.json'); const path = require("path");
const constants = require(path.join(__dirname, '../../config/constants.json'));
function sendConfirmation({ chat, sender, msg_id }) { function sendConfirmation({ chat, sender, msg_id }) {
helpers.sendMessage({ helpers.sendMessage({
chat, chat,

2
dist/api/controllers/confirmations.js.map

@ -1 +1 @@
{"version":3,"file":"confirmations.js","sourceRoot":"","sources":["../../../api/controllers/confirmations.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,wCAAgC;AAChC,sCAAgC;AAChC,0CAAyC;AACzC,2CAA0C;AAC1C,sCAAqC;AAErC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,GAAG,8BAA8B,CAAC,CAAA;AAErE,SAAgB,gBAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE;IACxD,OAAO,CAAC,WAAW,CAAC;QACnB,IAAI;QACJ,MAAM;QACN,OAAO,EAAE,EAAC,EAAE,EAAC,MAAM,EAAC;QACpB,IAAI,EAAE,SAAS,CAAC,aAAa,CAAC,YAAY;KAC1C,CAAC,CAAA;AACH,CAAC;AAPD,4CAOC;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;oBACf,MAAM,EAAE,KAAK,CAAC,EAAE;oBAChB,IAAI,EAAE;wBACL,SAAS,CAAC,aAAa,CAAC,OAAO;wBAC/B,SAAS,CAAC,aAAa,CAAC,OAAO;wBAC/B,SAAS,CAAC,aAAa,CAAC,UAAU;qBAClC;oBACD,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,OAAO;iBAClC;gBACD,KAAK,EAAE,CAAC,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;aAC9B,CAAC,CAAA;YAEF,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;YAC3B,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAA;YAEvD,MAAM,CAAC,QAAQ,CAAC;gBACf,IAAI,EAAE,cAAc;gBACpB,QAAQ,EAAE,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC;aACxD,CAAC,CAAA;SACF;IACF,CAAC;CAAA;AA3DD,kDA2DC"}

3
dist/api/controllers/contacts.js

@ -16,7 +16,8 @@ const helpers = require("../helpers");
const jsonUtils = require("../utils/json"); const jsonUtils = require("../utils/json");
const res_1 = require("../utils/res"); const res_1 = require("../utils/res");
const password_1 = require("../utils/password"); const password_1 = require("../utils/password");
const constants = require(__dirname + '/../../config/constants.json'); const path = require("path");
const constants = require(path.join(__dirname, '../../config/constants.json'));
const getContacts = (req, res) => __awaiter(void 0, void 0, void 0, function* () { const getContacts = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
const contacts = yield models_1.models.Contact.findAll({ where: { deleted: false }, raw: true }); const contacts = yield models_1.models.Contact.findAll({ where: { deleted: false }, raw: true });
const invites = yield models_1.models.Invite.findAll({ raw: true }); const invites = yield models_1.models.Invite.findAll({ raw: true });

2
dist/api/controllers/contacts.js.map

File diff suppressed because one or more lines are too long

3
dist/api/controllers/details.js

@ -13,8 +13,9 @@ const lightning_1 = require("../utils/lightning");
const res_1 = require("../utils/res"); const res_1 = require("../utils/res");
const readLastLines = require("read-last-lines"); const readLastLines = require("read-last-lines");
const nodeinfo_1 = require("../utils/nodeinfo"); const nodeinfo_1 = require("../utils/nodeinfo");
const path = require("path");
const env = process.env.NODE_ENV || 'development'; const env = process.env.NODE_ENV || 'development';
const config = require(__dirname + '/../../config/app.json')[env]; const config = require(path.join(__dirname, '../../config/app.json'))[env];
const defaultLogFiles = [ const defaultLogFiles = [
'/home/lnd/.pm2/logs/app-error.log', '/home/lnd/.pm2/logs/app-error.log',
'/var/log/syslog', '/var/log/syslog',

2
dist/api/controllers/details.js.map

@ -1 +1 @@
{"version":3,"file":"details.js","sourceRoot":"","sources":["../../../api/controllers/details.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,kDAAgD;AAChD,sCAA+C;AAC/C,iDAAgD;AAChD,gDAA6C;AAE7C,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAC;AAClD,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,wBAAwB,CAAC,CAAC,GAAG,CAAC,CAAC;AAElE,MAAM,eAAe,GAAG;IACvB,mCAAmC;IACnC,iBAAiB;CACjB,CAAA;AACD,SAAe,YAAY,CAAC,GAAG,EAAE,GAAG;;QACnC,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,eAAe,CAAA;QACtE,IAAI,GAAG,CAAA;QACP,IAAI,GAAG,CAAA;QACP,MAAM,YAAY,CAAC,QAAQ,EAAE,CAAM,QAAQ,EAAA,EAAE;YAC5C,IAAG,CAAC,GAAG,EAAC;gBACP,IAAI;oBACH,MAAM,KAAK,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;oBACrD,IAAG,KAAK,EAAE;wBACT,IAAI,UAAU,GAAG,KAAK,CAA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M,mBAAQ,EAAE,CAAA;IAC7B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACf,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACd,GAAG,CAAC,GAAG,EAAE,CAAA;AACV,CAAC,CAAA,CAAA;AAQA,kCAAW;AAGZ,SAAe,YAAY,CAAC,KAAK,EAAE,QAAQ;;QAC1C,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YAChD,MAAM,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAC7C;IACF,CAAC;CAAA"}

4
dist/api/controllers/index.js

@ -13,7 +13,8 @@ const models_1 = require("../models");
const lndService = require("../grpc"); const lndService = require("../grpc");
const gitinfo_1 = require("../utils/gitinfo"); const gitinfo_1 = require("../utils/gitinfo");
const lightning_1 = require("../utils/lightning"); const lightning_1 = require("../utils/lightning");
const constants = require(__dirname + '/../../config/constants.json'); const path = require("path");
const constants = require(path.join(__dirname, '../../config/constants.json'));
const env = process.env.NODE_ENV || 'development'; const env = process.env.NODE_ENV || 'development';
console.log("=> env:", env); console.log("=> env:", env);
let controllers = { let controllers = {
@ -83,6 +84,7 @@ function set(app) {
app.post('/contacts/:id/keys', controllers.contacts.exchangeKeys); app.post('/contacts/:id/keys', controllers.contacts.exchangeKeys);
app.post('/contacts', controllers.contacts.createContact); app.post('/contacts', controllers.contacts.createContact);
app.delete('/contacts/:id', controllers.contacts.deleteContact); app.delete('/contacts/:id', controllers.contacts.deleteContact);
app.get('/allmessages', controllers.messages.getAllMessages);
app.get('/messages', controllers.messages.getMessages); app.get('/messages', controllers.messages.getMessages);
app.delete('/message/:id', controllers.messages.deleteMessage); app.delete('/message/:id', controllers.messages.deleteMessage);
app.post('/messages', controllers.messages.sendMessage); app.post('/messages', controllers.messages.sendMessage);

2
dist/api/controllers/index.js.map

File diff suppressed because one or more lines are too long

3
dist/api/controllers/invoices.js

@ -18,7 +18,8 @@ const helpers = require("../helpers");
const hub_1 = require("../hub"); const hub_1 = require("../hub");
const res_1 = require("../utils/res"); const res_1 = require("../utils/res");
const confirmations_1 = require("./confirmations"); const confirmations_1 = require("./confirmations");
const constants = require(__dirname + '/../../config/constants.json'); const path = require("path");
const constants = require(path.join(__dirname, '../../config/constants.json'));
const payInvoice = (req, res) => __awaiter(void 0, void 0, void 0, function* () { const payInvoice = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
const lightning = yield lightning_1.loadLightning(); const lightning = yield lightning_1.loadLightning();
const { payment_request } = req.body; const { payment_request } = req.body;

2
dist/api/controllers/invoices.js.map

File diff suppressed because one or more lines are too long

5
dist/api/controllers/media.js

@ -23,9 +23,10 @@ const cron_1 = require("cron");
const zbase32 = require("../utils/zbase32"); const zbase32 = require("../utils/zbase32");
const schemas = require("./schemas"); const schemas = require("./schemas");
const confirmations_1 = require("./confirmations"); const confirmations_1 = require("./confirmations");
const path = require("path");
const env = process.env.NODE_ENV || 'development'; const env = process.env.NODE_ENV || 'development';
const config = require(__dirname + '/../../config/app.json')[env]; const config = require(path.join(__dirname, '../../config/app.json'))[env];
const constants = require(__dirname + '/../../config/constants.json'); const constants = require(path.join(__dirname, '../../config/constants.json'));
/* /*
TODO line 233: parse that from token itself, dont use getMediaInfo at all TODO line 233: parse that from token itself, dont use getMediaInfo at all

2
dist/api/controllers/media.js.map

File diff suppressed because one or more lines are too long

10
dist/api/controllers/messages.js

@ -18,7 +18,8 @@ const jsonUtils = require("../utils/json");
const helpers = require("../helpers"); const helpers = require("../helpers");
const res_1 = require("../utils/res"); const res_1 = require("../utils/res");
const confirmations_1 = require("./confirmations"); const confirmations_1 = require("./confirmations");
const constants = require(__dirname + '/../../config/constants.json'); const path = require("path");
const constants = require(path.join(__dirname, '../../config/constants.json'));
const getMessages = (req, res) => __awaiter(void 0, void 0, void 0, function* () { const getMessages = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
const dateToReturn = req.query.date; const dateToReturn = req.query.date;
if (!dateToReturn) { if (!dateToReturn) {
@ -68,9 +69,11 @@ const getMessages = (req, res) => __awaiter(void 0, void 0, void 0, function* ()
}); });
exports.getMessages = getMessages; exports.getMessages = getMessages;
const getAllMessages = (req, res) => __awaiter(void 0, void 0, void 0, function* () { const getAllMessages = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
const messages = yield models_1.models.Message.findAll({ order: [['id', 'asc']] }); const limit = (req.query.limit && parseInt(req.query.limit)) || 1000;
const offset = (req.query.offset && parseInt(req.query.offset)) || 0;
const messages = yield models_1.models.Message.findAll({ order: [['id', 'asc']], limit, offset });
const chatIds = messages.map(m => m.chatId); const chatIds = messages.map(m => m.chatId);
console.log('=> getAllMessages, chatIds', chatIds); console.log(`=> getAllMessages, limit: ${limit}, offset: ${offset}`);
let chats = chatIds.length > 0 ? yield models_1.models.Chat.findAll({ where: { deleted: false, id: chatIds } }) : []; let chats = chatIds.length > 0 ? yield models_1.models.Chat.findAll({ where: { deleted: false, id: chatIds } }) : [];
const chatsById = underscore_1.indexBy(chats, 'id'); const chatsById = underscore_1.indexBy(chats, 'id');
res_1.success(res, { res_1.success(res, {
@ -78,6 +81,7 @@ const getAllMessages = (req, res) => __awaiter(void 0, void 0, void 0, function*
confirmed_messages: [] confirmed_messages: []
}); });
}); });
exports.getAllMessages = getAllMessages;
function deleteMessage(req, res) { function deleteMessage(req, res) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const id = req.params.id; const id = req.params.id;

2
dist/api/controllers/messages.js.map

File diff suppressed because one or more lines are too long

3
dist/api/controllers/subscriptions.js

@ -19,7 +19,8 @@ const jsonUtils = require("../utils/json");
const helpers = require("../helpers"); const helpers = require("../helpers");
const rsa = require("../crypto/rsa"); const rsa = require("../crypto/rsa");
const moment = require("moment"); const moment = require("moment");
const constants = require(__dirname + '/../../config/constants.json'); const path = require("path");
const constants = require(path.join(__dirname, '../../config/constants.json'));
// store all current running jobs in memory // store all current running jobs in memory
let jobs = {}; let jobs = {};
// init jobs from DB // init jobs from DB

2
dist/api/controllers/subscriptions.js.map

File diff suppressed because one or more lines are too long

5
dist/api/controllers/uploads.js

@ -10,13 +10,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const models_1 = require("../models"); const models_1 = require("../models");
const path = require("path");
const env = process.env.NODE_ENV || 'development'; const env = process.env.NODE_ENV || 'development';
const config = require(__dirname + '/../../config/app.json')[env]; const config = require(path.join(__dirname, '../../config/app.json'))[env];
// setup disk storage // setup disk storage
var multer = require('multer'); var multer = require('multer');
var avatarStorage = multer.diskStorage({ var avatarStorage = multer.diskStorage({
destination: (req, file, cb) => { destination: (req, file, cb) => {
let dir = __dirname.includes('/dist/') ? __dirname + '/..' : __dirname; let dir = __dirname.includes('/dist/') ? path.join(__dirname, '..') : __dirname;
cb(null, dir + '/../../public/uploads'); cb(null, dir + '/../../public/uploads');
}, },
filename: (req, file, cb) => { filename: (req, file, cb) => {

2
dist/api/controllers/uploads.js.map

@ -1 +1 @@
{"version":3,"file":"uploads.js","sourceRoot":"","sources":["../../../api/controllers/uploads.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAAgC;AAEhC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAC;AAClD,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,wBAAwB,CAAC,CAAC,GAAG,CAAC,CAAC;AAElE,qBAAqB;AACrB,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;AAC9B,IAAI,aAAa,GAAG,MAAM,CAAC,WAAW,CAAC;IACrC,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE;QAC7B,IAAI,GAAG,GAAG,SAAS,CAAC,QAAQ,CAAC,Q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AO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,CAAC,CAAA;QAC3E,IAAG,OAAO;YAAE,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAA;KACpD;IAED,IAAG,OAAO,EAAC;QACT,MAAM,IAAI,GAAG,MAAM,eAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,CAAA;QAClE,IAAG,IAAI;YAAE,IAAI,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAA;KAC9C;IAED,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACf,GAAG,CAAC,IAAI,CAAC;QACP,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,QAAQ,CAAC,UAAU,IAAE,CAAC,CAAC;QACnC,OAAO,EAAE,QAAQ,CAAC,OAAO,IAAE,CAAC,CAAC;QAC7B,SAAS;KACV,CAAC,CAAC;IACH,GAAG,CAAC,GAAG,EAAE,CAAC;AACZ,CAAC,CAAA,CAAA;AAIA,gCAAU"}

3
dist/api/grpc/index.js

@ -17,7 +17,8 @@ const decodeUtils = require("../utils/decode");
const lightning_1 = require("../utils/lightning"); const lightning_1 = require("../utils/lightning");
const controllers = require("../controllers"); const controllers = require("../controllers");
const moment = require("moment"); const moment = require("moment");
const constants = require(__dirname + '/../../config/constants.json'); const path = require("path");
const constants = require(path.join(__dirname, '../../config/constants.json'));
// VERIFY PUBKEY OF SENDER // VERIFY PUBKEY OF SENDER
function parseAndVerifyPayload(data) { function parseAndVerifyPayload(data) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {

2
dist/api/grpc/index.js.map

File diff suppressed because one or more lines are too long

5
dist/api/hub.js

@ -17,9 +17,10 @@ const jsonUtils = require("./utils/json");
const helpers = require("./helpers"); const helpers = require("./helpers");
const nodeinfo_1 = require("./utils/nodeinfo"); const nodeinfo_1 = require("./utils/nodeinfo");
const lightning_1 = require("./utils/lightning"); const lightning_1 = require("./utils/lightning");
const constants = require(__dirname + '/../config/constants.json'); const path = require("path");
const constants = require(path.join(__dirname, '../config/constants.json'));
const env = process.env.NODE_ENV || 'development'; const env = process.env.NODE_ENV || 'development';
const config = require('../config/app.json')[env]; const config = require(path.join(__dirname, '../config/app.json'))[env];
const checkInviteHub = (params = {}) => __awaiter(void 0, void 0, void 0, function* () { const checkInviteHub = (params = {}) => __awaiter(void 0, void 0, void 0, function* () {
if (env != "production") { if (env != "production") {
return; return;

2
dist/api/hub.js.map

File diff suppressed because one or more lines are too long

11
dist/api/models/index.js

@ -1,9 +1,16 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const sequelize_typescript_1 = require("sequelize-typescript"); const sequelize_typescript_1 = require("sequelize-typescript");
const path = require("path");
const chat_1 = require("./ts/chat");
const contact_1 = require("./ts/contact");
const invite_1 = require("./ts/invite");
const message_1 = require("./ts/message");
const subscription_1 = require("./ts/subscription");
const mediaKey_1 = require("./ts/mediaKey");
const env = process.env.NODE_ENV || 'development'; const env = process.env.NODE_ENV || 'development';
const config = require(__dirname + '/../../config/config.json')[env]; const config = require(path.join(__dirname, '../../config/config.json'))[env];
const sequelize = new sequelize_typescript_1.Sequelize(Object.assign(Object.assign({}, config), { logging: process.env.SQL_LOG === 'true' ? console.log : false, models: [__dirname + '/ts'] })); const sequelize = new sequelize_typescript_1.Sequelize(Object.assign(Object.assign({}, config), { logging: process.env.SQL_LOG === 'true' ? console.log : false, models: [chat_1.default, contact_1.default, invite_1.default, message_1.default, subscription_1.default, mediaKey_1.default] }));
exports.sequelize = sequelize; exports.sequelize = sequelize;
const models = sequelize.models; const models = sequelize.models;
exports.models = models; exports.models = models;

2
dist/api/models/index.js.map

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/models/index.ts"],"names":[],"mappings":";;AAAA,+DAA+C;AAE/C,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAC;AAClD,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,2BAA2B,CAAC,CAAC,GAAG,CAAC,CAAC;AAErE,MAAM,SAAS,GAAG,IAAI,gCAAS,iCAC1B,MAAM,KACT,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,KAAG,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAC3D,MAAM,EAAE,CAAC,SAAS,GAAG,KAAK,CAAC,IAC3B,CAAA;AAIA,8BAAS;AAHX,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAA;AAI7B,wBAAM"} {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/models/index.ts"],"names":[],"mappings":";;AAAA,+DAA+C;AAC/C,6BAA4B;AAC5B,oCAA4B;AAC5B,0CAAkC;AAClC,wCAAgC;AAChC,0CAAkC;AAClC,oDAA4C;AAC5C,4CAAoC;AAEpC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAC;AAClD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAC,0BAA0B,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAE5E,MAAM,SAAS,GAAG,IAAI,gCAAS,iCAC1B,MAAM,KACT,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,KAAG,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAC3D,MAAM,EAAE,CAAC,cAAI,EAAC,iBAAO,EAAC,gBAAM,EAAC,iBAAO,EAAC,sBAAY,EAAC,kBAAQ,CAAC,IAC3D,CAAA;AAIA,8BAAS;AAHX,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAA;AAI7B,wBAAM"}

3
dist/api/utils/ldat.js

@ -11,8 +11,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const zbase32 = require("./zbase32"); const zbase32 = require("./zbase32");
const lightning_1 = require("./lightning"); const lightning_1 = require("./lightning");
const path = require("path");
const env = process.env.NODE_ENV || 'development'; const env = process.env.NODE_ENV || 'development';
const config = require(__dirname + '/../../config/app.json')[env]; const config = require(path.join(__dirname, '../../config/app.json'))[env];
/* /*
Lightning Data Access Token Lightning Data Access Token
Base64 strings separated by dots: Base64 strings separated by dots:

2
dist/api/utils/ldat.js.map

File diff suppressed because one or more lines are too long

3
dist/api/utils/lightning.js

@ -15,9 +15,10 @@ const grpc = require("grpc");
const helpers_1 = require("../helpers"); const helpers_1 = require("../helpers");
const sha = require("js-sha256"); const sha = require("js-sha256");
const crypto = require("crypto"); const crypto = require("crypto");
const path = require("path");
// var protoLoader = require('@grpc/proto-loader') // var protoLoader = require('@grpc/proto-loader')
const env = process.env.NODE_ENV || 'development'; const env = process.env.NODE_ENV || 'development';
const config = require(__dirname + '/../../config/app.json')[env]; const config = require(path.join(__dirname, '../../config/app.json'))[env];
const LND_KEYSEND_KEY = 5482373484; const LND_KEYSEND_KEY = 5482373484;
exports.LND_KEYSEND_KEY = LND_KEYSEND_KEY; exports.LND_KEYSEND_KEY = LND_KEYSEND_KEY;
const SPHINX_CUSTOM_RECORD_KEY = 133773310; const SPHINX_CUSTOM_RECORD_KEY = 133773310;

2
dist/api/utils/lightning.js.map

File diff suppressed because one or more lines are too long

3
dist/api/utils/setup.js

@ -131,8 +131,7 @@ function printQR() {
return; return;
} }
let theIP = public_ip; let theIP = public_ip;
if (!theIP.includes(":")) // if(!theIP.includes(":")) theIP = public_ip+':3001'
theIP = public_ip + ':3001';
const b64 = Buffer.from(`ip::${theIP}::${password_1.default || ''}`).toString('base64'); const b64 = Buffer.from(`ip::${theIP}::${password_1.default || ''}`).toString('base64');
console.log('Scan this QR in Sphinx app:'); console.log('Scan this QR in Sphinx app:');
console.log(b64); console.log(b64);

2
dist/api/utils/setup.js.map

@ -1 +1 @@
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../api/utils/setup.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2CAA2C;AAC3C,sCAA2C;AAC3C,iDAAoC;AACpC,iCAAgC;AAChC,sCAAqC;AACrC,gDAAwC;AACxC,8CAA0D;AAE1D,MAAM,YAAY,GAAG,CAAC,CAAA;AAEtB,MAAM,aAAa,GAAG,GAAS,EAAE;IAC/B,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAA;IACxC,MAAM,UAAU,EAAE,CAAA;IAClB,IAAI;QACF,MAAM,kBAAS,CAAC,IAAI,EAAE,CAAA;QACtB,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAA;KACpC;IAAC,OAAM,CAAC,EAAE;QACT,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAC,CAAC,CAAC,CAAA;KAChC;IACD,MAAM,OAAO,EAAE,CAAA;IACf,iBAAiB,EAAE,CAAA;IACnB,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;AACnC,CAAC,CAAA,CAAA;AAgEQ,sCAAa;AA9DtB,SAAe,UAAU;;QACvB,IAAI;YACF,MAAM,kBAAS,CAAC,KAAK,CAAC,yBAAyB,YAAY,EAAE,CAAC,CAAA;SAC/D;QAAC,OAAM,CAAC,EAAE;YACT,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAC,CAAC,CAAC,CAAA;SACtC;IACH,CAAC;CAAA;AAED,SAAe,OAAO;;QACpB,IAAI;YACF,MAAM,kBAAS,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAA;SACrE;QAAC,OAAM,CAAC,EAAE;YACT,oCAAoC;SACrC;IACH,CAAC;CAAA;AAED,MAAM,iBAAiB,GAAG,GAAS,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CAAA;aAChC;YAAC,OAAM,CAAC,EAAC;gBACR,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;aACf;SACF;aAAM;YACL,SAAS,GAAG,EAAE,CAAA;SACf;QACD,IAAG,CAAC,SAAS,EAAE;YACb,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAA;YACvC,OAAM;SACP;QACD,IAAI,KAAK,GAAG,SAAS,CAAA;QACrB,qDAAqD;QAErD,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,KAAK,KAAK,kBAAQ,IAAE,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;QAC3E,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAA;QAC1C,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAChB,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAC,EAAC,IAAI,EAAC,UAAU,EAAC,EAAE,UAAU,GAAG,EAAE,GAAG;YACvD,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAClB,CAAC,CAAC,CAAA;IACJ,CAAC;CAAA"}

18
dist/api/utils/socket.js

@ -1,22 +1,26 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const WebSocket = require("ws"); const WebSocket = require("ws");
let connections = new Map(); // let connections = new Map()
let connectionCounter = 0; // let connectionCounter = 0
let lastConn;
const connect = (server) => { const connect = (server) => {
server = new WebSocket.Server({ server }); server = new WebSocket.Server({ server });
console.log('=> [socket] connected to server'); console.log('=> [socket] connected to server');
server.on('connection', socket => { server.on('connection', socket => {
console.log('=> [socket] connection received'); console.log('=> [socket] connection received');
var id = connectionCounter++; // var id = connectionCounter++;
connections.set(id, socket); // connections.set(id, socket)
lastConn = socket;
}); });
}; };
exports.connect = connect; exports.connect = connect;
const send = (body) => { const send = (body) => {
connections.forEach((socket, index) => { // connections.forEach((socket, index) => {
socket.send(body); // socket.send(body)
}); // })
if (lastConn)
lastConn.send(body);
}; };
exports.send = send; exports.send = send;
const sendJson = (object) => { const sendJson = (object) => {

2
dist/api/utils/socket.js.map

@ -1 +1 @@
{"version":3,"file":"socket.js","sourceRoot":"","sources":["../../../api/utils/socket.ts"],"names":[],"mappings":";;AAAA,gCAA+B;AAE/B,IAAI,WAAW,GAAG,IAAI,GAAG,EAAE,CAAA;AAC3B,IAAI,iBAAiB,GAAG,CAAC,CAAA;AAEzB,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,EAAE;IACzB,MAAM,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;IAEzC,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAA;IAE9C,MAAM,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,CAAC,EAAE;QAC/B,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAA;QAC9C,IAAI,EAAE,GAAG,iBAAiB,EAAE,CAAC;QAC7B,WAAW,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;IAC7B,CAAC,CAAC,CAAA;AAEJ,CAAC,CAAA;AAaC,0BAAO;AAXT,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,EAAE;IACpB,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QACpC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACnB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAQC,oBAAI;AANN,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,EAAE;IAC1B,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAA;AAC9B,CAAC,CAAA;AAKC,4BAAQ"} {"version":3,"file":"socket.js","sourceRoot":"","sources":["../../../api/utils/socket.ts"],"names":[],"mappings":";;AAAA,gCAA+B;AAE/B,8BAA8B;AAC9B,4BAA4B;AAE5B,IAAI,QAAa,CAAA;AAEjB,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,EAAE;IACzB,MAAM,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;IAEzC,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAA;IAE9C,MAAM,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,CAAC,EAAE;QAC/B,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAA;QAC9C,gCAAgC;QAChC,8BAA8B;QAC9B,QAAQ,GAAG,MAAM,CAAA;IACnB,CAAC,CAAC,CAAA;AAEJ,CAAC,CAAA;AAcC,0BAAO;AAZT,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,EAAE;IACpB,2CAA2C;IAC3C,sBAAsB;IACtB,KAAK;IACL,IAAG,QAAQ;QAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAClC,CAAC,CAAA;AAQC,oBAAI;AANN,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,EAAE;IAC1B,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAA;AAC9B,CAAC,CAAA;AAKC,4BAAQ"}

3
dist/app.js

@ -14,6 +14,7 @@ const bodyParser = require("body-parser");
const helmet = require("helmet"); const helmet = require("helmet");
const cookieParser = require("cookie-parser"); const cookieParser = require("cookie-parser");
const crypto = require("crypto"); const crypto = require("crypto");
const path = require("path");
const models_1 = require("./api/models"); const models_1 = require("./api/models");
const logger_1 = require("./api/utils/logger"); const logger_1 = require("./api/utils/logger");
const hub_1 = require("./api/hub"); const hub_1 = require("./api/hub");
@ -23,7 +24,7 @@ const socket = require("./api/utils/socket");
let server = null; let server = null;
const port = process.env.PORT || 3001; const port = process.env.PORT || 3001;
const env = process.env.NODE_ENV || 'development'; const env = process.env.NODE_ENV || 'development';
const config = require(__dirname + '/config/app.json')[env]; const config = require(path.join(__dirname, 'config/app.json'))[env];
process.env.GRPC_SSL_CIPHER_SUITES = 'HIGH+ECDSA'; process.env.GRPC_SSL_CIPHER_SUITES = 'HIGH+ECDSA';
var i = 0; var i = 0;
// START SETUP! // START SETUP!

2
dist/app.js.map

@ -1 +1 @@
{"version":3,"file":"app.js","sourceRoot":"","sources":["../app.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mCAAkC;AAClC,0CAAyC;AACzC,iCAAgC;AAChC,8CAA6C;AAC7C,iCAAgC;AAChC,yCAAmC;AACnC,+CAAuC;AACvC,mCAAkE;AAClE,6CAA0D;AAC1D,iDAAgD;AAChD,6CAA4C;AAE5C,IAAI,MAAM,GAAQ,IAAI,CAAA;AACtB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC;AACtC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAC;AAClD,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,kBAAkB,CAAC,CAAC,GAAG,CAAC,CAAC;AAE5D,OAAO,CAAC,GAAG,CAAC,sBAAsB,GAAG,YAAY,CAAA;AAEjD,IAAI,CAAC,GAAG,CAAC,CAAA;AAET,eAAe;AACf,YAAY,EAAE,CAAA;AAEd,SAAe,YAAY;;QAC1B,CAAC,EAAE,CAAA;QACH,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,EAAE,CAAC,CAAA;QACnD,IAAI;YACH,MAAM,WAAW,CAAC,oBAAoB,EAAE,CAAA;YACxC,SAAS,EAAE,CAAA;SACX;QAAC,OAAM,CAAC,EAAE;YACV,UAAU,CAAC,GAAO,EAAE;gBACnB,MAAM,YAAY,EAAE,CAAA;YACrB,CAAC,CAAA,EAAC,IAAI,CAAC,CAAA;SACP;IACF,CAAC;CAAA;AAED,SAAe,SAAS;;QACvB,MAAM,qBAAa,EAAE,CAAC;QACtB,IAAI,MAAM,CAAC,WAAW,EAAE;YACvB,qBAAe,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B,IAAI,EAAE,CAAA;gBACN,OAAM;aACN;SACD;QAED,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;QAExE,IAAI,KAAK,IAAI,IAAI,EAAE;YAClB,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,yBAAyB,EAAE,EAAC,cAAc,EAAG,YAAY,EAAC,CAAC,CAAC;YAC5E,GAAG,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;SAClC;aAAM;YACN,MAAM,IAAI,GAAG,MAAM,eAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAC,CAAC,CAAA;YACtE,MAAM,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC/E,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,IAAI,IAAI,CAAC,SAAS,IAAI,WAAW,EAAE;gBAC5D,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,yBAAyB,EAAE,EAAC,cAAc,EAAG,YAAY,EAAC,CAAC,CAAC;gBAC/E,GAAG,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;aAC/B;iBAAM;gBACN,IAAI,EAAE,CAAC;aACP;SACD;IACF,CAAC;CAAA;AAED,kBAAe,MAAM,CAAA"}

0
dist/public/uploads/.gitkeep

112
install_guide_myNode.md

@ -0,0 +1,112 @@
# Guide: install Sphinx-relay on myNode.
This guide is focused on installing Sphinx-relay on top of myNode. Information about myNode can be found at: https://mynodebtc.com/.
### Preparations
* Be able to connect with your node through SSH.
* Make sure you are running LND version `0.9.0` or higher. This can be seen at http://mynode.local/lnd at the right top. Or by inserting the following console command:
```sh
$ lncli getinfo
> "version": "0.9.0-beta commit=v0.9.0-beta"
```
* Open port `3001/TCP` on your router. How to do this is not included in this guide. https://www.yougetsignal.com/tools/open-ports/ is one of the many websites that can be used to check if a port is opened on your network.
---
## Let's Start
### Open port 3001 on myNode
Open up a console window with SSH. And log in as root
```sh
$ sudo su
```
Open up port 3001 on your machine and make sure it has been added to the list.
```sh
$ ufw allow 3001 comment 'allow Sphinx-Chat'
$ ufw status
> Status: active
>
> To Action From
> -- ------ ----
> 3001 (v6) ALLOW Anywhere (v6) # Sphinx-Chat
```
### Download
login as user bitcoin.
```sh
$ sudo su bitcoin
$ cd
```
Clone the repository from Github and install the package.
```sh
$ git clone https://github.com/stakwork/sphinx-relay
$ cd sphinx-relay
$ npm install
```
### Dependencies
sqlite3: `$ apt-get install sqlite3`
### Configure
Edit the "production" section of config/app.json.
```sh
$ cd
$ cd sphinx-relay/config/
$ nano app.json
```
Change the following 4 lines to:
```
"macaroon_location": "/home/bitcoin/.lnd/data/chain/bitcoin/mainnet/admin.macaroon",
"tls_location": "/mnt/hdd/mynode/lnd/tls.cert",
"lnd_log_location": "/home/bitcoin/.lnd/logs/bitcoin/mainnet/lnd.log",
"lncli_location": "/home/bitcoin/go/bin",
```
Save and exit:
`Ctrl + X`
`Y`
`Enter`
Edit the "production" section of config/config.json
```sh
$ nano config.json
```
Change to following line to:
```
"storage": "/home/bitcoin/sphinx.db"
```
Save and exit:
`Ctrl + X`
`Y`
`Enter`
To connect to your app:
(replace x.x.x.x with your IP)
```sh
$ cd
$ cd sphinx-relay/config/
$ export NODE_IP=x.x.x.x:3001
```
For extra security:
```sh
$ export USE_PASSWORD=true
```
### Activate keysend
We need LND to run with keysend activated. First we check if it is already activated on your node. To do that. Go to http://mynode.local/lnd/config and check if the line `accept-keysend=1` is included somewhere in the text.
If `accept-keysend=1` is already included you can continue without changing anything. If `accept-keysend=1` is not included, add it to a new line and click the `Save` button. This will restart your device. (Restarting could take up to several minutes but also hours, so be patient.)
### Run
Now it's time to run the software.
```sh
$ cd
$ cd sphinx-relay/config/
$ npm run prod
```
When Relay starts up, it will print a QR in the terminal. You can scan this in your app (Android or iOS) to connect!

20
package-lock.json

@ -6943,9 +6943,9 @@
} }
}, },
"needle": { "needle": {
"version": "2.3.3", "version": "2.4.1",
"resolved": "https://registry.npmjs.org/needle/-/needle-2.3.3.tgz", "resolved": "https://registry.npmjs.org/needle/-/needle-2.4.1.tgz",
"integrity": "sha512-EkY0GeSq87rWp1hoq/sH/wnTWgFVhYlnIkbJ0YJFfRgEFlz2RraCjBpFQ+vrEgEdp0ThfyHADmkChEhcb7PKyw==", "integrity": "sha512-x/gi6ijr4B7fwl6WYL9FwlCvRQKGlUNvnceho8wxkwXqN8jvVmmmATTmZPRRG7b/yC1eode26C2HO9jl78Du9g==",
"requires": { "requires": {
"debug": "^3.2.6", "debug": "^3.2.6",
"iconv-lite": "^0.4.4", "iconv-lite": "^0.4.4",
@ -8365,11 +8365,6 @@
} }
} }
}, },
"qrcode-terminal": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/qrcode-terminal/-/qrcode-terminal-0.12.0.tgz",
"integrity": "sha512-EXtzRZmC+YGmGlDFbXKxQiMZNwCLEO6BANKXG4iCtSIM0yqc/pappSx3RIKr4r0uh5JsBckOXeKrB3Iz7mdQpQ=="
},
"qs": { "qs": {
"version": "6.7.0", "version": "6.7.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
@ -9815,13 +9810,12 @@
"dev": true "dev": true
}, },
"sqlite3": { "sqlite3": {
"version": "4.1.1", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-4.1.1.tgz", "resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-4.2.0.tgz",
"integrity": "sha512-CvT5XY+MWnn0HkbwVKJAyWEMfzpAPwnTiB3TobA5Mri44SrTovmmh499NPQP+gatkeOipqPlBLel7rn4E/PCQg==", "integrity": "sha512-roEOz41hxui2Q7uYnWsjMOTry6TcNUNmp8audCx18gF10P2NknwdpF+E+HKvz/F2NvPKGGBF4NGc+ZPQ+AABwg==",
"requires": { "requires": {
"nan": "^2.12.1", "nan": "^2.12.1",
"node-pre-gyp": "^0.11.0", "node-pre-gyp": "^0.11.0"
"request": "^2.87.0"
} }
}, },
"sshpk": { "sshpk": {

12
package.json

@ -15,6 +15,7 @@
"prod": "cp config/app.json dist/config/app.json && cp config/config.json dist/config/config.json && env NODE_ENV=production node dist/app.js", "prod": "cp config/app.json dist/config/app.json && cp config/config.json dist/config/config.json && env NODE_ENV=production node dist/app.js",
"tsc": "rm -rf dist/ && tsc && cp -r public dist/public", "tsc": "rm -rf dist/ && tsc && cp -r public dist/public",
"dev": "rm -rf dist/ && tsc && cp -r public dist/public && node --inspect ./dist/app.js", "dev": "rm -rf dist/ && tsc && cp -r public dist/public && node --inspect ./dist/app.js",
"build-binaries": "rm -rf dist/ && tsc && cp config/app.json dist/config/app.json && cp config/config.json dist/config/config.json && pkg . --target node12-alpine-x64,node12-macos-x64 --out-path binaries",
"start-ecs": "export NODE_ALIAS=$HOSTNAME && export NODE_IP=$(curl $ECS_CONTAINER_METADATA_URI | echo $(jq -r .DockerName).$NODE_DOMAIN) && export NODE_ENV=production && node dist/app.js" "start-ecs": "export NODE_ALIAS=$HOSTNAME && export NODE_IP=$(curl $ECS_CONTAINER_METADATA_URI | echo $(jq -r .DockerName).$NODE_DOMAIN) && export NODE_ENV=production && node dist/app.js"
}, },
"keywords": [], "keywords": [],
@ -65,7 +66,7 @@
"sequelize": "^5.19.3", "sequelize": "^5.19.3",
"sequelize-cli": "^5.5.1", "sequelize-cli": "^5.5.1",
"sequelize-typescript": "^1.1.0", "sequelize-typescript": "^1.1.0",
"sqlite3": "^4.1.1", "sqlite3": "^4.2.0",
"tail": "^2.0.3", "tail": "^2.0.3",
"ts-node": "^8.5.4", "ts-node": "^8.5.4",
"tsc": "^1.20150623.0", "tsc": "^1.20150623.0",
@ -87,5 +88,12 @@
"webpack": "^4.41.0", "webpack": "^4.41.0",
"webpack-cli": "^3.3.9", "webpack-cli": "^3.3.9",
"webpack-dev-server": "^3.8.2" "webpack-dev-server": "^3.8.2"
} },
"pkg": {
"assets": [
"config/*",
"dist/config/*"
]
},
"bin": "dist/app.js"
} }

Loading…
Cancel
Save