Commit 0b16e011754d8816fc45b0d388ab692c97826bf1
fix patch-settings, add uri-encoding!
mix irving committed on 5/8/2018, 7:56:44 AMParent: ca44a0a40e4d24c2b6b42467fac6072170073817
Files changed
message/html/webshares.js | changed |
package-lock.json | changed |
package.json | changed |
message/html/webshares.js | ||
---|---|---|
@@ -13,9 +13,9 @@ | ||
13 | 13 | |
14 | 14 | exports.gives = nest('message.html.webshares') |
15 | 15 | |
16 | 16 | exports.create = (api) => { |
17 | - return nest('message.html.webshares', function shares(msg) { | |
17 | + return nest('message.html.webshares', function shares (msg) { | |
18 | 18 | var id = api.keys.sync.id() |
19 | 19 | var shares = api.message.obs.webshares(msg.key) |
20 | 20 | |
21 | 21 | var iShared = computed(shares, shares => shares.includes(id)) |
@@ -27,9 +27,9 @@ | ||
27 | 27 | isOpen.set(false) |
28 | 28 | } |
29 | 29 | var confirmationDialog = h('div.dialog', [ |
30 | 30 | h('div.message', [ |
31 | - h('p', strings.share.externalShareLabel), | |
31 | + h('p', strings.share.externalShareLabel) | |
32 | 32 | ]), |
33 | 33 | h('div.actions', [ |
34 | 34 | h('Button', { 'ev-click': () => isOpen.set(false) }, strings.userShow.action.cancel), |
35 | 35 | h('Button', { style: { 'margin-left': '10px', 'margin-right': '10px' }, 'ev-click': () => publishAndClose(msg, 'copy') }, strings.share.action.copy), |
@@ -39,22 +39,21 @@ | ||
39 | 39 | ]) |
40 | 40 | |
41 | 41 | var lb = api.app.html.lightbox(confirmationDialog, isOpen) |
42 | 42 | |
43 | - | |
44 | 43 | return h('WebShares', { 'ev-click': () => isOpen.set(true) }, [ |
45 | 44 | h('i.fa.fa-share-alt', { className: when(iShared, '', 'faint') }), |
46 | 45 | h('div.count', count), |
47 | 46 | lb |
48 | 47 | ]) |
49 | 48 | }) |
50 | 49 | |
51 | - function publishShare(msg, action) { | |
50 | + function publishShare (msg, action) { | |
52 | 51 | var sharingScope = api.settings.sync.get('websharingmetrics') |
53 | - var url = `http://share2.ticktack.im:8807/${msg.key}` | |
52 | + var url = `http://share2.ticktack.im:8807/${encodeURIComponent(msg.key)}` | |
54 | 53 | var share = { |
55 | 54 | type: 'share', |
56 | - share: { link: msg.key, content: "blog", url: url } | |
55 | + share: { link: msg.key, content: 'blog', url: url } | |
57 | 56 | } |
58 | 57 | // if it was a private message, then share as private ... |
59 | 58 | if (msg.value.content.recps) { |
60 | 59 | share.recps = msg.value.content.recps.map(function (e) { |
@@ -63,30 +62,30 @@ | ||
63 | 62 | share.private = true |
64 | 63 | } else { |
65 | 64 | // ... else obey configuration settings. |
66 | 65 | switch (sharingScope) { |
67 | - case "private": | |
66 | + case 'private': | |
68 | 67 | share.private = true |
69 | 68 | break |
70 | - case "author": | |
69 | + case 'author': | |
71 | 70 | share.recps = [ |
72 | 71 | id, |
73 | 72 | msg.value.author |
74 | 73 | ] |
75 | 74 | share.private = true |
76 | 75 | break |
77 | - case "public": | |
76 | + case 'public': | |
78 | 77 | default: |
79 | 78 | break |
80 | 79 | } |
81 | 80 | } |
82 | 81 | api.sbot.async.publish(share) |
83 | 82 | |
84 | - if (action == "copy") { | |
85 | - console.log("copying to clipboard") | |
83 | + if (action == 'copy') { | |
84 | + console.log('copying to clipboard') | |
86 | 85 | clipboard.writeText(url) |
87 | 86 | } else { |
88 | - console.log("opening external") | |
89 | - shell.openExternal(url, err => console.log("error", err)) | |
87 | + console.log('opening external') | |
88 | + shell.openExternal(url, err => console.log('error', err)) | |
90 | 89 | } |
91 | 90 | } |
92 | 91 | } |
package-lock.json | ||
---|---|---|
The diff is too large to show. Use a local git client to view these changes. Old file size: 283856 bytes New file size: 283856 bytes |
package.json | ||
---|---|---|
@@ -46,9 +46,9 @@ | ||
46 | 46 | "open-external": "^0.1.1", |
47 | 47 | "patch-drafts": "0.0.6", |
48 | 48 | "patch-history": "^1.0.0", |
49 | 49 | "patch-profile": "^1.0.4", |
50 | - "patch-settings": "^1.0.0", | |
50 | + "patch-settings": "^1.1.2", | |
51 | 51 | "patch-suggest": "^1.1.0", |
52 | 52 | "patchcore": "^1.23.3", |
53 | 53 | "pull-next": "^1.0.1", |
54 | 54 | "pull-next-step": "^1.0.0", |
Built with git-ssb-web