git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

Commit 3043037e5920603ef66d72b8f0ee962925650cca

Merge branch 'master' into flume

Matt McKegg committed on 5/31/2017, 11:48:21 PM
Parent: afab83769f2f443cbdfb34181531ba4419919be9
Parent: 76c71c64adb968557a0b0f4a8f320fd824454b2d

Files changed

README.mdchanged
main-window.jschanged
modules/app/html/progress-notifier.jschanged
modules/app/html/search.jschanged
modules/page/html/render/message.jschanged
modules/page/html/render/search.jschanged
package.jsonchanged
plugs/blob/sync/url.jschanged
styles/loading.mcsschanged
styles/notifier.mcsschanged
README.mdView
@@ -78,9 +78,9 @@
7878 sudo apt-get install libxext-dev libxtst-dev libxkbfile-dev # spellchecker headers
7979 ```
8080 On Fedora Linux:
8181 ```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
8383 ```
8484
8585 On macOS:
8686
main-window.jsView
@@ -15,8 +15,9 @@
1515 module.exports = function (config) {
1616 var sockets = combine(
1717 overrideConfig(config),
1818 addCommand('app.navigate', setView),
19+ require('patchwork-gatherings'),
1920 require('./modules'),
2021 require('./plugs'),
2122 require('patchcore'),
2223 require('./overrides')
modules/app/html/progress-notifier.jsView
@@ -41,22 +41,25 @@
4141 return 1
4242 }
4343 })
4444
45- var hidden = computed([progress.incompleteFeeds, indexing], (incomplete, indexing) => {
45+ var hidden = sustained(computed([progress.incompleteFeeds, indexing], (incomplete, indexing) => {
4646 return incomplete < 5 && !indexing
47- })
47+ }), 200)
4848
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 }, [
5053 h('div.status', [
51- h('Loading -small', [
54+ when(displaying, h('Loading -small', [
5255 when(computed(progress.incompleteFeeds, (v) => v > 5),
5356 ['Downloading new messages', h('progress', { style: {'margin-left': '10px'}, min: 0, max: 1, value: downloadProgress })],
5457 when(indexing, [
5558 ['Indexing database', h('progress', { style: {'margin-left': '10px'}, min: 0, max: 1, value: indexProgress })]
5659 ], 'Scuttling...')
5760 )
58- ])
61+ ]))
5962 ])
6063 ])
6164 })
6265 }
modules/app/html/search.jsView
@@ -8,9 +8,9 @@
88 })
99
1010 exports.gives = nest('app.html.search')
1111
12-var pages = ['/public', '/private', '/mentions', '/all']
12+var pages = ['/public', '/private', '/mentions', '/all', '/gatherings']
1313
1414 exports.create = function (api) {
1515 return nest('app.html.search', function (setView) {
1616 var getProfileSuggestions = api.profile.async.suggest()
@@ -22,9 +22,9 @@
2222 setView(ev.detail.id)
2323 searchBox.value = ev.detail.id
2424 },
2525 'ev-keydown': (ev) => {
26- if (ev.code === 'Enter') {
26+ if (ev.key === 'Enter') {
2727 doSearch()
2828 ev.preventDefault()
2929 }
3030 }
modules/page/html/render/message.jsView
@@ -59,9 +59,9 @@
5959 h('div.messages', [
6060 when(thread.branchId, h('a.full', {href: thread.rootId}, ['View full thread'])),
6161 map(thread.messages, (msg) => {
6262 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})
6464 })
6565 })
6666 ]),
6767 compose
modules/page/html/render/search.jsView
@@ -6,8 +6,9 @@
66 const pullAbortable = require('pull-abortable')
77 var nest = require('depnest')
88 var Next = require('pull-next')
99 var defer = require('pull-defer')
10+var pullCat = require('pull-cat')
1011
1112 exports.needs = nest({
1213 'sbot.pull.search': 'first',
1314 'sbot.pull.log': 'first',
@@ -27,9 +28,10 @@
2728
2829 const search = Struct({
2930 isLinear: Value(),
3031 linear: Struct({
31- checked: Value(0)
32+ checked: Value(0),
33+ isDone: Value(false)
3234 }),
3335 fulltext: Struct({
3436 isDone: Value(false)
3537 }),
@@ -48,19 +50,19 @@
4850 when(search.isLinear,
4951 h('div.meta', ['Searched: ', search.linear.checked]),
5052 h('section.details', when(hasNoFulltextMatches, h('div.matches', 'No matches')))
5153 )
52- ]),
53- when(search.matches, null, h('Loading -large'))
54+ ])
5455 ])
5556
5657 var content = h('section.content')
5758 var container = h('Scroller', {
5859 style: { overflow: 'auto' }
5960 }, [
6061 h('div.wrapper', [
6162 searchHeader,
62- content
63+ content,
64+ when(search.linear.isDone, null, h('Loading -search'))
6365 ])
6466 ])
6567
6668 var realtimeAborter = pullAbortable()
@@ -93,14 +95,17 @@
9395 // disable full text for now
9496 var aborter = pullAbortable()
9597 search.isLinear.set(true)
9698 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}),
98100 pull.through((msg) => search.linear.checked.set(search.linear.checked() + 1)),
99101 pull.filter(matchesQuery),
100102 pull.through(() => search.matches.set(search.matches() + 1)),
101103 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+ })
103108 )
104109
105110 return h('SplitView', {
106111 hooks: [
@@ -216,9 +221,9 @@
216221 })
217222 ))
218223 })
219224
220- return result
225+ return pauseAfter(result, opts.delay)
221226 })
222227 }
223228
224229 function get (obj, path) {
@@ -242,4 +247,28 @@
242247 return function (element) {
243248 return fn
244249 }
245250 }
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.jsonView
@@ -1,24 +1,25 @@
11 {
22 "name": "ssb-patchwork",
33 "productName": "Patchwork",
44 "repository": "git@github.com:ssbc/patchwork.git",
5- "version": "3.3.3",
5+ "version": "3.4.0",
66 "description": "A decentralized messaging and sharing app built on top of Secure Scuttlebutt (SSB).",
77 "main": "index.js",
88 "scripts": {
99 "test": "echo \"Error: no test specified\" && exit 1",
1010 "start": "electron index.js",
1111 "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"
1313 },
1414 "author": "Secure Scuttlebutt Consortium",
1515 "license": "GPL-3.0",
1616 "dependencies": {
1717 "atomic-file": "^0.1.0",
1818 "bulk-require": "^1.0.0",
1919 "catch-links": "^2.0.1",
2020 "compare-version": "^0.1.2",
21+ "cross-script": "^1.0.1",
2122 "data-uri-to-buffer": "0.0.4",
2223 "deep-equal": "^1.0.1",
2324 "depject": "^3.2.0",
2425 "depnest": "^1.0.2",
@@ -28,9 +29,9 @@
2829 "flumeview-query": "^3.0.3",
2930 "has-network": "0.0.0",
3031 "insert-css": "~1.0.0",
3132 "is-visible": "^2.1.1",
32- "level": "~1.6.0",
33+ "level": "~1.7.0",
3334 "level-memview": "0.0.0",
3435 "map-filter-reduce": "~3.0.3",
3536 "micro-css": "^2.0.0",
3637 "mutant": "^3.18.0",
@@ -38,8 +39,9 @@
3839 "non-private-ip": "^1.4.1",
3940 "on-change-network": "0.0.2",
4041 "on-wakeup": "^1.0.1",
4142 "patchcore": "~0.4.12",
43+ "patchwork-gatherings": "^1.0.2",
4244 "pull-abortable": "^4.1.0",
4345 "pull-defer": "^0.2.2",
4446 "pull-file": "~1.0.0",
4547 "pull-identify-filetype": "^1.1.0",
plugs/blob/sync/url.jsView
@@ -9,9 +9,9 @@
99 exports.create = function (api) {
1010 return nest('blob.sync.url', function (link) {
1111 var config = api.config.sync.load()
1212 var prefix = config.blobsPrefix != null ? config.blobsPrefix : `http://localhost:${config.blobsPort}`
13- if (typeof link.link === 'string') {
13+ if (link && typeof link.link === 'string') {
1414 link = link.link
1515 }
1616 return `${prefix}/${encodeURIComponent(link)}`
1717 })
styles/loading.mcssView
@@ -35,8 +35,22 @@
3535 font-size: 200%
3636 }
3737 }
3838
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+
3953 ::before {
4054 content: ' '
4155 height: 50px
4256 width: 50px
styles/notifier.mcssView
@@ -8,9 +8,8 @@
88 :hover {
99 background: rgb(220, 242, 255);
1010 }
1111
12- animation: 0.5s slide-in
1312 position: relative
1413
1514 -loader {
1615 background: rgb(255, 239, 217);

Built with git-ssb-web