secure-scuttlebot classic
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

see if this fixes the remote issue

+7 -52
+6 -31
patchbay/config.js
··· 6 6 7 7 if (typeof window !== 'undefined' && window.PATCHBAY_REMOTE) { 8 8 remote = window.PATCHBAY_REMOTE 9 - 10 - if (typeof localStorage !== 'undefined') { 11 - try { localStorage.remote = remote } catch (e) {} 12 - } 13 - } else if (typeof localStorage !== 'undefined') { 14 - try { 15 - remote = localStorage.remote || null 16 - } catch (e) { 17 - remote = null 18 - } 19 9 } 20 10 21 11 return remote ··· 25 15 if (!remote || typeof window === 'undefined' || !window.location) return remote 26 16 27 17 try { 28 - var parts = remote.split('~') 29 - var base = parts[0] 30 - var suffix = parts.length > 1 ? '~' + parts.slice(1).join('~') : '' 18 + var shsIndex = remote.indexOf('~shs:') 19 + if (shsIndex === -1) return remote 31 20 32 - var u = URL.parse(base) 33 - 34 - if (!u || !u.protocol || !/^wss?:$/.test(u.protocol)) return remote 35 - 36 - // Only rewrite when the remote thinks it's localhost 37 - if (u.hostname !== 'localhost' && u.hostname !== '127.0.0.1') return remote 38 - 21 + var key = remote.substring(shsIndex + 5) 39 22 var loc = window.location 40 23 41 - // Use the page's hostname, keep the original port 42 - u.protocol = loc.protocol === 'https:' ? 'wss:' : 'ws:' 43 - u.hostname = loc.hostname 44 - if (!u.port) { 45 - u.port = loc.port || (loc.protocol === 'https:' ? '443' : '80') 46 - } 24 + var proto = loc.protocol === 'https:' ? 'wss' : 'ws' 25 + var host = loc.host || (loc.hostname + (loc.port ? ':' + loc.port : '')) 47 26 48 - var formatted = URL.format(u) 49 - if (formatted.charAt(formatted.length - 1) === '/') 50 - formatted = formatted.slice(0, -1) 51 - 52 - return formatted + suffix 27 + return proto + '://' + host + '~shs:' + key 53 28 } catch (e) { 54 29 return remote 55 30 }
+1 -11
patchbay/modules_basic/invite.js
··· 60 60 function next () { 61 61 onProgress('following...') 62 62 63 - //remove the seed from the shs address. 64 - //then it's correct address. 65 - //this should make the browser connect to this as remote. 66 - //we don't want to do this if when using this locally, though. 67 - if(process.title === 'browser') 68 - localStorage.remote = data.remote 69 - 70 63 api.sbot_publish({ 71 64 type: 'contact', 72 65 contact: data.key, ··· 115 108 }) 116 109 } 117 110 118 - // If we are in the browser, 119 - // and do not already have a remote set, automatically trigger the invite. 120 - if(process.title == 'browser' && !localStorage.remote) attempt() 111 + // If we are in the browser, the user can click "accept" to trigger the invite. 121 112 122 113 return div 123 114 } 124 115 } 125 116 } 126 -
-10
patchbay/modules_extra/key.js
··· 34 34 } 35 35 36 36 var importKey = h('textarea', {placeholder: 'import an existing public/private key', name: 'textarea'}) 37 - var importRemote = h('textarea', {placeholder: 'import an existing remote', name: 'textarea'}) 38 37 var content = h('div.column.scroller__content') 39 38 var div = h('div.column.scroller', 40 39 {style: {'overflow':'auto'}}, ··· 48 47 localStorage['browser/.ssb/secret'] = importKey.value.replace(/\s+/g, ' ') 49 48 alert('Your public/private key has been updated') 50 49 e.preventDefault() 51 - }}, 'Import'), 52 - h('p', {innerHTML: 'Your ws remote is: <pre>' + localStorage.remote + '</pre>'}), 53 - h('form', 54 - importRemote, 55 - h('button', {onclick: function (e){ 56 - localStorage.remote = importRemote.value 57 - alert('Your websocket remote has been updated') 58 - e.preventDefault() 59 50 }}, 'Import') 60 - ) 61 51 ) 62 52 ) 63 53 )