Commit 3043037e5920603ef66d72b8f0ee962925650cca
Merge branch 'master' into flume
Matt McKegg committed on 5/31/2017, 11:48:21 PMParent: afab83769f2f443cbdfb34181531ba4419919be9
Parent: 76c71c64adb968557a0b0f4a8f320fd824454b2d
Files changed
README.md | changed |
main-window.js | changed |
modules/app/html/progress-notifier.js | changed |
modules/app/html/search.js | changed |
modules/page/html/render/message.js | changed |
modules/page/html/render/search.js | changed |
package.json | changed |
plugs/blob/sync/url.js | changed |
styles/loading.mcss | changed |
styles/notifier.mcss | changed |
README.md | ||
---|---|---|
@@ -78,9 +78,9 @@ | ||
78 | 78 | sudo apt-get install libxext-dev libxtst-dev libxkbfile-dev # spellchecker headers |
79 | 79 | ``` |
80 | 80 | On Fedora Linux: |
81 | 81 | ```shell |
82 | -sudo dnr install libXext-devel libXtst-devel libxkbfile-devel gcc-c++ m4 automake libtool | |
82 | +sudo dnf install libXext-devel libXtst-devel libxkbfile-devel gcc-c++ m4 automake libtool | |
83 | 83 | ``` |
84 | 84 | |
85 | 85 | On macOS: |
86 | 86 |
main-window.js | ||
---|---|---|
@@ -15,8 +15,9 @@ | ||
15 | 15 | module.exports = function (config) { |
16 | 16 | var sockets = combine( |
17 | 17 | overrideConfig(config), |
18 | 18 | addCommand('app.navigate', setView), |
19 | + require('patchwork-gatherings'), | |
19 | 20 | require('./modules'), |
20 | 21 | require('./plugs'), |
21 | 22 | require('patchcore'), |
22 | 23 | require('./overrides') |
modules/app/html/progress-notifier.js | ||
---|---|---|
@@ -41,22 +41,25 @@ | ||
41 | 41 | return 1 |
42 | 42 | } |
43 | 43 | }) |
44 | 44 | |
45 | - var hidden = computed([progress.incompleteFeeds, indexing], (incomplete, indexing) => { | |
45 | + var hidden = sustained(computed([progress.incompleteFeeds, indexing], (incomplete, indexing) => { | |
46 | 46 | return incomplete < 5 && !indexing |
47 | - }) | |
47 | + }), 200) | |
48 | 48 | |
49 | - return h('div.info', { hidden: sustained(hidden, 2000) }, [ | |
49 | + // HACK: css animations take up WAY TO MUCH cpu, remove from dom when inactive | |
50 | + var displaying = computed(sustained(hidden, 500, x => !x), hidden => !hidden) | |
51 | + | |
52 | + return h('div.info', { hidden }, [ | |
50 | 53 | h('div.status', [ |
51 | - h('Loading -small', [ | |
54 | + when(displaying, h('Loading -small', [ | |
52 | 55 | when(computed(progress.incompleteFeeds, (v) => v > 5), |
53 | 56 | ['Downloading new messages', h('progress', { style: {'margin-left': '10px'}, min: 0, max: 1, value: downloadProgress })], |
54 | 57 | when(indexing, [ |
55 | 58 | ['Indexing database', h('progress', { style: {'margin-left': '10px'}, min: 0, max: 1, value: indexProgress })] |
56 | 59 | ], 'Scuttling...') |
57 | 60 | ) |
58 | - ]) | |
61 | + ])) | |
59 | 62 | ]) |
60 | 63 | ]) |
61 | 64 | }) |
62 | 65 | } |
modules/app/html/search.js | ||
---|---|---|
@@ -8,9 +8,9 @@ | ||
8 | 8 | }) |
9 | 9 | |
10 | 10 | exports.gives = nest('app.html.search') |
11 | 11 | |
12 | -var pages = ['/public', '/private', '/mentions', '/all'] | |
12 | +var pages = ['/public', '/private', '/mentions', '/all', '/gatherings'] | |
13 | 13 | |
14 | 14 | exports.create = function (api) { |
15 | 15 | return nest('app.html.search', function (setView) { |
16 | 16 | var getProfileSuggestions = api.profile.async.suggest() |
@@ -22,9 +22,9 @@ | ||
22 | 22 | setView(ev.detail.id) |
23 | 23 | searchBox.value = ev.detail.id |
24 | 24 | }, |
25 | 25 | 'ev-keydown': (ev) => { |
26 | - if (ev.code === 'Enter') { | |
26 | + if (ev.key === 'Enter') { | |
27 | 27 | doSearch() |
28 | 28 | ev.preventDefault() |
29 | 29 | } |
30 | 30 | } |
modules/page/html/render/message.js | ||
---|---|---|
@@ -59,9 +59,9 @@ | ||
59 | 59 | h('div.messages', [ |
60 | 60 | when(thread.branchId, h('a.full', {href: thread.rootId}, ['View full thread'])), |
61 | 61 | map(thread.messages, (msg) => { |
62 | 62 | return computed([msg, thread.previousKey(msg)], (msg, previousId) => { |
63 | - return api.message.html.render(msg, {previousId, backlinks: true}) | |
63 | + return api.message.html.render(msg, {pageId: id, previousId, backlinks: true}) | |
64 | 64 | }) |
65 | 65 | }) |
66 | 66 | ]), |
67 | 67 | compose |
modules/page/html/render/search.js | ||
---|---|---|
@@ -6,8 +6,9 @@ | ||
6 | 6 | const pullAbortable = require('pull-abortable') |
7 | 7 | var nest = require('depnest') |
8 | 8 | var Next = require('pull-next') |
9 | 9 | var defer = require('pull-defer') |
10 | +var pullCat = require('pull-cat') | |
10 | 11 | |
11 | 12 | exports.needs = nest({ |
12 | 13 | 'sbot.pull.search': 'first', |
13 | 14 | 'sbot.pull.log': 'first', |
@@ -27,9 +28,10 @@ | ||
27 | 28 | |
28 | 29 | const search = Struct({ |
29 | 30 | isLinear: Value(), |
30 | 31 | linear: Struct({ |
31 | - checked: Value(0) | |
32 | + checked: Value(0), | |
33 | + isDone: Value(false) | |
32 | 34 | }), |
33 | 35 | fulltext: Struct({ |
34 | 36 | isDone: Value(false) |
35 | 37 | }), |
@@ -48,19 +50,19 @@ | ||
48 | 50 | when(search.isLinear, |
49 | 51 | h('div.meta', ['Searched: ', search.linear.checked]), |
50 | 52 | h('section.details', when(hasNoFulltextMatches, h('div.matches', 'No matches'))) |
51 | 53 | ) |
52 | - ]), | |
53 | - when(search.matches, null, h('Loading -large')) | |
54 | + ]) | |
54 | 55 | ]) |
55 | 56 | |
56 | 57 | var content = h('section.content') |
57 | 58 | var container = h('Scroller', { |
58 | 59 | style: { overflow: 'auto' } |
59 | 60 | }, [ |
60 | 61 | h('div.wrapper', [ |
61 | 62 | searchHeader, |
62 | - content | |
63 | + content, | |
64 | + when(search.linear.isDone, null, h('Loading -search')) | |
63 | 65 | ]) |
64 | 66 | ]) |
65 | 67 | |
66 | 68 | var realtimeAborter = pullAbortable() |
@@ -93,14 +95,17 @@ | ||
93 | 95 | // disable full text for now |
94 | 96 | var aborter = pullAbortable() |
95 | 97 | search.isLinear.set(true) |
96 | 98 | pull( |
97 | - nextStepper(api.sbot.pull.log, {reverse: true, limit: 1000, live: false}), | |
99 | + nextStepper(api.sbot.pull.log, {reverse: true, limit: 500, live: false, delay: 100}), | |
98 | 100 | pull.through((msg) => search.linear.checked.set(search.linear.checked() + 1)), |
99 | 101 | pull.filter(matchesQuery), |
100 | 102 | pull.through(() => search.matches.set(search.matches() + 1)), |
101 | 103 | aborter, |
102 | - Scroller(container, content, renderMsg, false, false) | |
104 | + Scroller(container, content, renderMsg, false, false, err => { | |
105 | + if (err) console.log(err) | |
106 | + search.linear.isDone.set(true) | |
107 | + }) | |
103 | 108 | ) |
104 | 109 | |
105 | 110 | return h('SplitView', { |
106 | 111 | hooks: [ |
@@ -216,9 +221,9 @@ | ||
216 | 221 | }) |
217 | 222 | )) |
218 | 223 | }) |
219 | 224 | |
220 | - return result | |
225 | + return pauseAfter(result, opts.delay) | |
221 | 226 | }) |
222 | 227 | } |
223 | 228 | |
224 | 229 | function get (obj, path) { |
@@ -242,4 +247,28 @@ | ||
242 | 247 | return function (element) { |
243 | 248 | return fn |
244 | 249 | } |
245 | 250 | } |
251 | + | |
252 | +function pauseAfter (stream, delay) { | |
253 | + if (!delay) { | |
254 | + return stream | |
255 | + } else { | |
256 | + return pullCat([ | |
257 | + stream, | |
258 | + wait(delay) | |
259 | + ]) | |
260 | + } | |
261 | +} | |
262 | + | |
263 | +function wait (delay) { | |
264 | + return function (abort, cb) { | |
265 | + if (abort) { | |
266 | + cb(true) | |
267 | + } else { | |
268 | + setTimeout(() => { | |
269 | + cb(true) | |
270 | + console.log('delay') | |
271 | + }, delay) | |
272 | + } | |
273 | + } | |
274 | +} |
package.json | ||
---|---|---|
@@ -1,24 +1,25 @@ | ||
1 | 1 | { |
2 | 2 | "name": "ssb-patchwork", |
3 | 3 | "productName": "Patchwork", |
4 | 4 | "repository": "git@github.com:ssbc/patchwork.git", |
5 | - "version": "3.3.3", | |
5 | + "version": "3.4.0", | |
6 | 6 | "description": "A decentralized messaging and sharing app built on top of Secure Scuttlebutt (SSB).", |
7 | 7 | "main": "index.js", |
8 | 8 | "scripts": { |
9 | 9 | "test": "echo \"Error: no test specified\" && exit 1", |
10 | 10 | "start": "electron index.js", |
11 | 11 | "postinstall": "npm run rebuild", |
12 | - "rebuild": "npm rebuild --runtime=electron --target=$(electron -v) --abi=$(electron --abi) --disturl=https://atom.io/download/atom-shell" | |
12 | + "rebuild": "cross-script npm rebuild --runtime=electron \"--target=$(electron -v)\" \"--abi=$(electron --abi)\" --disturl=https://atom.io/download/atom-shell" | |
13 | 13 | }, |
14 | 14 | "author": "Secure Scuttlebutt Consortium", |
15 | 15 | "license": "GPL-3.0", |
16 | 16 | "dependencies": { |
17 | 17 | "atomic-file": "^0.1.0", |
18 | 18 | "bulk-require": "^1.0.0", |
19 | 19 | "catch-links": "^2.0.1", |
20 | 20 | "compare-version": "^0.1.2", |
21 | + "cross-script": "^1.0.1", | |
21 | 22 | "data-uri-to-buffer": "0.0.4", |
22 | 23 | "deep-equal": "^1.0.1", |
23 | 24 | "depject": "^3.2.0", |
24 | 25 | "depnest": "^1.0.2", |
@@ -28,9 +29,9 @@ | ||
28 | 29 | "flumeview-query": "^3.0.3", |
29 | 30 | "has-network": "0.0.0", |
30 | 31 | "insert-css": "~1.0.0", |
31 | 32 | "is-visible": "^2.1.1", |
32 | - "level": "~1.6.0", | |
33 | + "level": "~1.7.0", | |
33 | 34 | "level-memview": "0.0.0", |
34 | 35 | "map-filter-reduce": "~3.0.3", |
35 | 36 | "micro-css": "^2.0.0", |
36 | 37 | "mutant": "^3.18.0", |
@@ -38,8 +39,9 @@ | ||
38 | 39 | "non-private-ip": "^1.4.1", |
39 | 40 | "on-change-network": "0.0.2", |
40 | 41 | "on-wakeup": "^1.0.1", |
41 | 42 | "patchcore": "~0.4.12", |
43 | + "patchwork-gatherings": "^1.0.2", | |
42 | 44 | "pull-abortable": "^4.1.0", |
43 | 45 | "pull-defer": "^0.2.2", |
44 | 46 | "pull-file": "~1.0.0", |
45 | 47 | "pull-identify-filetype": "^1.1.0", |
plugs/blob/sync/url.js | ||
---|---|---|
@@ -9,9 +9,9 @@ | ||
9 | 9 | exports.create = function (api) { |
10 | 10 | return nest('blob.sync.url', function (link) { |
11 | 11 | var config = api.config.sync.load() |
12 | 12 | var prefix = config.blobsPrefix != null ? config.blobsPrefix : `http://localhost:${config.blobsPort}` |
13 | - if (typeof link.link === 'string') { | |
13 | + if (link && typeof link.link === 'string') { | |
14 | 14 | link = link.link |
15 | 15 | } |
16 | 16 | return `${prefix}/${encodeURIComponent(link)}` |
17 | 17 | }) |
styles/loading.mcss | ||
---|---|---|
@@ -35,8 +35,22 @@ | ||
35 | 35 | font-size: 200% |
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | + -search { | |
40 | + height: 200px | |
41 | + | |
42 | + ::before { | |
43 | + height: 100px | |
44 | + width: 100px | |
45 | + } | |
46 | + ::after { | |
47 | + color: #CCC; | |
48 | + content: 'Seaching...' | |
49 | + font-size: 200% | |
50 | + } | |
51 | + } | |
52 | + | |
39 | 53 | ::before { |
40 | 54 | content: ' ' |
41 | 55 | height: 50px |
42 | 56 | width: 50px |
Built with git-ssb-web