Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

Commit d067143

Browse files
authored
Merge branch 'master' into ssb-legacy-conn
2 parents bebc217 + be38ae3 commit d067143

File tree

12 files changed

+82
-15
lines changed

12 files changed

+82
-15
lines changed

lib/catch-links.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
var Url = require('url')
2-
31
module.exports = function (root, cb) {
42
root.addEventListener('click', (ev) => {
53
if (ev.altKey || ev.ctrlKey || ev.metaKey || ev.shiftKey || ev.defaultPrevented) {
@@ -18,8 +16,16 @@ module.exports = function (root, cb) {
1816
var href = anchor.getAttribute('href')
1917

2018
if (href) {
21-
var url = Url.parse(href)
22-
if (url.host) {
19+
var isUrl
20+
21+
try {
22+
var url = new URL(href)
23+
isUrl = true
24+
} catch (e) {
25+
isUrl = false
26+
}
27+
28+
if (isUrl && url.host) {
2329
cb(href, true)
2430
} else if (href !== '#') {
2531
cb(href, false, anchor.anchor)

lib/scroller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var pull = require('pull-stream')
22
var Pause = require('pull-pause')
3-
var { h, onceIdle, computed, Value } = require('mutant')
3+
var { h, computed, Value } = require('mutant')
44

55
window.stopIt = false
66

locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,5 +300,6 @@
300300
"You have chosen to privately ignore this person.": "You have chosen to privately ignore this person.",
301301
"No new messages will be downloaded. Existing messages will be hidden.": "No new messages will be downloaded. Existing messages will be hidden.",
302302
"You have chosen to publicly block this person.": "You have chosen to publicly block this person.",
303-
"Click for options to block syncing with this person and/or hide their posts": "Click for options to block syncing with this person and/or hide their posts"
303+
"Click for options to block syncing with this person and/or hide their posts": "Click for options to block syncing with this person and/or hide their posts",
304+
"invited you to this gathering": "invited you to this gathering"
304305
}

main-window.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ var ref = require('ssb-ref')
1313
var setupContextMenuAndSpellCheck = require('./lib/context-menu-and-spellcheck')
1414
var watch = require('mutant/watch')
1515
var requireStyle = require('require-style')
16+
var ssbUri = require('ssb-uri')
1617

1718
try {
1819
var mouseForwardBack = require('mouse-forward-back')
@@ -289,6 +290,15 @@ module.exports = function (config) {
289290
if (!err && handler) {
290291
handler(href)
291292
} else {
293+
if (href.startsWith('ssb:')) {
294+
try {
295+
href = ssbUri.toSigilLink(href)
296+
} catch (e) {
297+
// error can be safely ignored
298+
// it just means this isn't an SSB URI
299+
}
300+
}
301+
292302
// no external handler found, use page.html.render
293303
previewElement.cancel()
294304
views.setView(href, anchor)

modules/app/html/search.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var h = require('mutant/h')
22
var nest = require('depnest')
33
var addSuggest = require('suggest-box')
4+
var ssbUri = require('ssb-uri')
45

56
exports.needs = nest({
67
'profile.async.suggest': 'first',
@@ -48,10 +49,18 @@ exports.create = function (api) {
4849
return searchBox
4950

5051
function doSearch () {
52+
const prefixes = ['/', '?', '@', '#', '%', 'ssb:']
5153
var value = searchBox.value.trim()
52-
if (value.startsWith('/') || value.startsWith('?') || value.startsWith('@') || value.startsWith('#') || value.startsWith('%') || value.startsWith('&')) {
54+
55+
if (prefixes.some(p => value.startsWith(p))) {
5356
if (value.startsWith('@') && value.length < 30) {
5457
// probably not a key
58+
} else if (value.startsWith('ssb:')) {
59+
try {
60+
setView(ssbUri.toSigilLink(value))
61+
} catch (e) {
62+
// not a URI
63+
}
5564
} else if (value.length > 2) {
5665
setView(value)
5766
}

modules/feed/html/rollup.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ var Abortable = require('pull-abortable')
55
var Scroller = require('../../../lib/scroller')
66
var extend = require('xtend')
77
var GroupSummaries = require('../../../lib/group-summaries')
8-
var rootBumpTypes = ['mention', 'channel-mention']
8+
var rootBumpTypes = ['mention', 'channel-mention', 'invite']
99
var getBump = require('../../../lib/get-bump')
1010
var many = require('../../../lib/many')
1111

1212
var bumpMessages = {
1313
'reaction': 'liked this message',
14+
'invite': 'invited you to this gathering',
1415
'reply': 'replied to this message',
1516
'updated': 'added changes',
1617
'mention': 'mentioned you',

modules/invite/dhtAcceptSheet.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var { h, when, Value, Proxy } = require('mutant')
1+
var { h, when, Value } = require('mutant')
22
var nest = require('depnest')
33
var electron = require('electron')
44

modules/invite/dhtCreateSheet.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ exports.create = function (api) {
4646
'ev-click': () => {
4747
api.sbot.async.createDHT((err, code) => {
4848
if (err) {
49-
created.set(false)
49+
creating.set(false)
5050
showDialog({
5151
type: 'error',
5252
title: i18n('Error'),

package-lock.json

Lines changed: 34 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
"ssb-server": "^13.3.0",
9191
"ssb-sort": "^1.1.0",
9292
"ssb-tags": "^0.2.0",
93+
"ssb-uri": "^1.0.1",
9394
"ssb-ws": "~3.0.2",
9495
"standard": "^12.0.1",
9596
"suggest-box": "github:mmckegg/suggest-box#scroll-selection-into-view",

0 commit comments

Comments
 (0)