git ssb

16+

Dominic / patchbay



Commit 2714beb84a9764d8bb5b2e11f19bac1c8289b0b8

Merge branch 'better-channels' of github.com:ssbc/patchbay into better-channels

mix irving committed on 10/16/2017, 10:01:59 PM
Parent: 8b5b920e5132a013a0492373f4dbf3e11cfcf8bd
Parent: 97931cc5ac68d994ecbf365634ad086a07abb2e5

Files changed

README.mdchanged
app/styles/css/global.jschanged
app/styles/mcss/lightbox.mcssadded
app/styles/mcss/markdown.mcssadded
app/styles/mcss/search-highlights.mcssadded
app/styles/mcss/suggest-box.mcssadded
background-process.jschanged
contact/html/relationships.jschanged
contact/html/relationships.mcsschanged
main.jschanged
message/html/compose.jschanged
message/html/render/follow.jsdeleted
message/html/render/contact.jsadded
package-lock.jsonchanged
package.jsonchanged
README.mdView
@@ -59,9 +59,8 @@
5959
6060 sbot server
6161
6262 # then in another tab (these must be separate commands)
63-sbot plugins.install ssb-contacts
6463 sbot plugins.install ssb-about
6564 sbot plugins.install ssb-backlinks
6665 sbot plugins.install ssb-fulltext # for faster searches
6766
app/styles/css/global.jsView
@@ -16,50 +16,8 @@
1616 line-height: 1.4;
1717 color: #222;
1818 }
1919
20-blockquote {
21- border-left: 2px #ccc solid;
22- color: #666;
23- padding-left: .6rem;
24- margin-left: .6rem;
25- font-size: .85rem;
26-}
27-
28-blockquote p:last-child {
29- margin-bottom: .35ex;
30-}
31-
32-pre {
33- background-color: #f5f5f5;
34- padding: .3rem;
35- color: #444;
36-}
37-
38-.emoji {
39- height: 1.2em;
40- width: 1.2em;
41- vertical-align: middle;
42- margin-top: -0.2em;
43-}
44-
45-p, ul, ol {
46- margin-top: .35em;
47-}
48-
49-h1, h2, h3, h4, h5, h6 {
50- margin: 0;
51-}
52-h1, h2 {
53- margin-bottom: .5em
54-}
55-h1 { font-size: 1.4rem; }
56-h2 { font-size: 1.2em; }
57-h3 { font-size: 1.15rem; }
58-h4 { font-size: 1.12rem; }
59-h5 { font-size: 1.1rem; }
60-h6 { font-size: 1rem; }
61-
6220 * {
6321 word-break: break-word;
6422 }
6523
@@ -67,43 +25,25 @@
6725 color: #0088cc;
6826 text-decoration: none;
6927 }
7028
71-a:hover,
72-a:focus {
29 +a:hover, a:focus {
7330 color: #005580;
7431 text-decoration: underline;
7532 }
7633
77-pre {
78- white-space: pre-wrap;
79- word-wrap: break-word;
34 +input:focus, .compose:focus {
35 + outline: none;
36 + border-color: #0088cc;
37 + box-shadow: 0 0 4px #0088cc;
8038 }
8139
82-p {
83- margin-top: .35ex;
84-}
85-
86-hr {
87- border: solid #eee;
88- clear: both;
89- border-width: 1px 0 0;
90- height: 0;
91- margin-bottom: .9em;
92-}
93-
9440 input, textarea {
9541 border: none;
9642 border-radius: .2em;
9743 font-family: sans-serif;
9844 }
9945
100-input:focus, .compose:focus, button:focus {
101- outline: none;
102- border-color: #0088cc;
103- box-shadow: 0 0 4px #0088cc;
104-}
105-
10646 textarea {
10747 padding: .5em;
10848 font-size: 1em;
10949 }
@@ -124,34 +64,15 @@
12464 text-transform: uppercase;
12565 font-weight: bold;
12666 font-size: .7em;
12767 }
128-
68 +button:focus {
69 + outline: none;
70 + border-color: #0088cc;
71 + box-shadow: 0 0 4px #0088cc;
72 +}
12973 button:hover {
13074 background: #ccc;
13175 border: 1px solid #bbb;
13276 }
13377
134-/* TextNodeSearcher highlights */
135-
136-highlight {
137- background: #ff8;
138-}
139-
140-/* lightbox - used in message-confirm */
141-
142-div.lightbox {
143- position: fixed;
144- left: 0px;
145- right: 0px;
146- top: 50px;
147- overflow: auto;
148- width: 780px;
149- max-width: 100%;
150- padding: 25px;
151- margin: auto;
152- z-index: 2;
153- background: #f5f5f5;
154- border: 1px solid #eee;
155- border-radius: .2em;
156-}
15778 `
app/styles/mcss/lightbox.mcssView
@@ -1,0 +1,20 @@
1 +/* lightbox - used in message-confirm */
2 +
3 +body {
4 + div.lightbox {
5 + position: fixed
6 + left: 0px
7 + right: 0px
8 + top: 50px
9 + overflow: auto
10 + width: 780px
11 + max-width: 100%
12 + padding: 25px
13 + margin: auto
14 + z-index: 2
15 + background: #f5f5f5
16 + border: 1px solid #eee
17 + border-radius: .2em
18 + }
19 +}
20 +
app/styles/mcss/markdown.mcssView
@@ -1,0 +1,83 @@
1 +Markdown {
2 +
3 + p, ul, ol {
4 + }
5 +
6 + hr {
7 + height: 0
8 + border: solid #ddd
9 + border-width: 1px 0 0
10 + clear: both
11 + margin-bottom: .9em
12 + white-space: pre-wrap
13 + word-wrap: break-word
14 + }
15 +
16 + pre {
17 + background-color: #f5f5f5
18 + color: #c121dc
19 + padding: .3rem
20 + code {
21 + border: none
22 + }
23 + }
24 + (code) {
25 + background-color: #f5f5f5
26 + color: #c121dc
27 + padding: 0.1rem .2rem
28 + border: 1px solid #e6e6e6
29 + border-radius: 2px
30 + }
31 +
32 + blockquote {
33 + color: #666
34 + font-style: italic
35 + font-size: 1rem
36 +
37 + p {
38 + :last-child {
39 + margin-bottom: .35ex
40 + }
41 + }
42 + }
43 +
44 + ul, ol {
45 + padding-left: 1rem
46 + margin-top: .35rem
47 +
48 + (ul, ol) {
49 + padding-left: 1.5rem
50 + }
51 +
52 + }
53 + ul.task-list {
54 + padding-left: 0
55 +
56 + (li.task-list-item) {
57 + list-style-type: none
58 + }
59 + }
60 +
61 +
62 + (img.emoji) {
63 + height: 1.2em
64 + width: 1.2em
65 + vertical-align: middle
66 + margin-top: -0.2em
67 + }
68 +
69 +
70 + h1, h2, h3, h4, h5, h6 {
71 + margin: 0
72 + }
73 + h1, h2 {
74 + margin-bottom: .5em
75 + }
76 + h1 { font-size: 1.4rem }
77 + h2 { font-size: 1.2em }
78 + h3 { font-size: 1.15rem }
79 + h4 { font-size: 1.12rem }
80 + h5 { font-size: 1.1rem }
81 + h6 { font-size: 1rem }
82 + }
83 +
app/styles/mcss/search-highlights.mcssView
@@ -1,0 +1,11 @@
1 +/* TextNodeSearcher highlights */
2 +
3 +Markdown {
4 + (highlight) {
5 +
6 + color: fuchsia
7 + padding: 0 .2rem
8 + margin: 0 .1rem
9 + }
10 +}
11 +
app/styles/mcss/suggest-box.mcssView
@@ -1,0 +1,97 @@
1 +// SuggestBox
2 +body {
3 + div.suggest-box {
4 + width: max-content
5 + background-color: #fff
6 +
7 + min-width: 20rem
8 + max-width: 35rem
9 + padding: .2rem .5rem
10 + margin-top: .35rem
11 + border: 1px gainsboro solid
12 +
13 + ul {
14 + list-style-type: none
15 + padding: 0
16 +
17 + li {
18 + display: flex
19 + align-items: center
20 +
21 + padding-right: .2rem
22 + margin-bottom: .2rem
23 +
24 + img {
25 + height: 36px
26 + width: 36px
27 + min-width: 36px
28 + padding: .2rem
29 + }
30 +
31 + strong {
32 + font-weight: 300
33 + min-width: 7rem
34 + margin-left: .5rem
35 + margin-right: .5rem
36 +
37 + span.subtle {
38 + color: #aaa
39 + }
40 + }
41 +
42 + small {
43 + flex-grow: 1
44 +
45 + margin-left: .5rem
46 + padding-right: .2rem
47 + font-size: 1rem
48 +
49 + display: flex
50 + justify-content: flex-end
51 +
52 + div.aliases {
53 + flex-grow: 1
54 +
55 + font-size: .8rem
56 + color: #666
57 + margin-right: .5rem
58 +
59 + display: flex
60 + flex-wrap: wrap
61 +
62 + div.alias {
63 + margin-right: .4rem
64 + -bold {
65 + font-weight: 600
66 + }
67 + }
68 + }
69 +
70 + div.key {
71 + align-self: flex-end
72 +
73 + margin: auto 0
74 +
75 + font-family: monospace
76 + font-size: .8rem
77 + min-width: 5rem
78 + }
79 + }
80 + }
81 +
82 + li.selected {
83 + color: #fff
84 + background: #0caaf9
85 +
86 + img {}
87 + strong {}
88 + small {
89 + div.aliases {
90 + color: #eee
91 + }
92 + }
93 + }
94 + }
95 + }
96 +}
97 +
background-process.jsView
@@ -16,9 +16,8 @@
1616 .use(require('scuttlebot/plugins/local'))
1717 .use(require('scuttlebot/plugins/logging'))
1818 .use(require('ssb-query'))
1919 .use(require('ssb-about'))
20- .use(require('ssb-contacts'))
2120 .use(require('ssb-fulltext'))
2221 // .use(require('ssb-ebt'))
2322 .use(require('ssb-ws'))
2423
contact/html/relationships.jsView
@@ -3,22 +3,17 @@
33
44 exports.gives = nest('contact.html.relationships')
55
66 exports.needs = nest({
7- about: {
8- 'html.image': 'first',
9- 'obs.name': 'first'
10- },
11- contact: {
12- async: {
13- follow: 'first',
14- unfollow: 'first'
15- },
16- obs: {
17- followers: 'first',
18- following: 'first'
19- }
20- },
7 + 'about.html.image': 'first',
8 + 'about.obs.name': 'first',
9 + 'contact.async.follow': 'first',
10 + 'contact.async.unfollow': 'first',
11 + 'contact.async.block': 'first',
12 + 'contact.async.unblock': 'first',
13 + 'contact.obs.followers': 'first',
14 + 'contact.obs.following': 'first',
15 + 'contact.obs.blockers': 'first',
2116 'keys.sync.id': 'first'
2217 })
2318
2419 exports.create = function (api) {
@@ -30,9 +25,9 @@
3025 var rawFollowing = api.contact.obs.following(id)
3126 var rawFollowers = api.contact.obs.followers(id)
3227
3328 var friends = computed([rawFollowing, rawFollowers], (following, followers) => {
34- return [...following].filter(follow => followers.has(follow))
29 + return [...following].filter(follow => followers.includes(follow))
3530 })
3631 var following = computed([rawFollowing, friends], (following, friends) => {
3732 return [...following].filter(follow => !friends.includes(follow))
3833 })
@@ -41,10 +36,10 @@
4136 })
4237
4338 var myId = api.keys.sync.id()
4439 var ImFollowing = api.contact.obs.following(myId)
45- var IFollowThem = computed([ImFollowing], ImFollowing => ImFollowing.has(id))
46- var theyFollowMe = computed([rawFollowing], following => following.has(myId))
40 + var IFollowThem = computed([ImFollowing], ImFollowing => ImFollowing.includes(id))
41 + var theyFollowMe = computed([rawFollowing], following => following.includes(myId))
4742
4843 var relationshipStatus = computed([IFollowThem, theyFollowMe], (IFollowThem, theyFollowMe) => {
4944 return IFollowThem && theyFollowMe ? '- you are friends'
5045 : IFollowThem ? '- you follow them'
@@ -58,25 +53,51 @@
5853 api.about.html.image(id)
5954 )
6055 }
6156
57 + const { unfollow, follow, block, unblock } = api.contact.async
58 + const blockers = api.contact.obs.blockers(id)
59 + const ImBlockingThem = computed(blockers, blockers => blockers.includes(myId))
60 +
6261 return h('Relationships', [
6362 h('header', 'Relationships'),
6463 when(id !== myId,
6564 h('div.your-status', [
6665 h('header', 'Your status'),
67- h('section.action', [
66 + h('section -friendship', [
6867 when(ImFollowing.sync,
6968 when(IFollowThem,
70- h('button', { 'ev-click': () => api.contact.async.unfollow(id) }, 'Unfollow'),
71- h('button', { 'ev-click': () => api.contact.async.follow(id) }, 'Follow')
69 + h('button', { 'ev-click': () => unfollow(id) }, 'Unfollow'),
70 + h('button', { 'ev-click': () => follow(id) }, 'Follow')
7271 ),
7372 h('button', { disabled: 'disabled' }, 'Loading...')
74- )
73 + ),
74 + when(ImFollowing.sync, h('div.relationship-status', relationshipStatus)),
7575 ]),
76- when(ImFollowing.sync, h('section.status', relationshipStatus))
76 + h('section -blocking', [
77 + when(ImBlockingThem,
78 + h('button', { 'ev-click': () => unblock(id, console.log) }, 'unblock'),
79 + h('button', { 'ev-click': () => block(id, console.log) }, 'BLOCK')
80 + ),
81 + h('div.explainer', [
82 + "Blocking tells everyone you don't want to communicate with a person.",
83 + h('ul', [
84 + h('li', 'You will no longer receive messages from this person'),
85 + h('li', "This person won't get any new information about you (including this block)"),
86 + h('li', "Your followers will see you have blocked this person - their apps need to know so that they don't pass your information on."),
87 + ])
88 + ])
89 + ])
7790 ])
7891 ),
92 + computed(blockers, blockers => {
93 + if (blockers.length === 0) return ''
94 +
95 + return h('div.blockers', [
96 + h('header', 'Blocked by'),
97 + h('section', blockers.map(imageLink))
98 + ])
99 + }),
79100 h('div.friends', [
80101 h('header', 'Friends'),
81102 h('section', map(friends, imageLink))
82103 ]),
contact/html/relationships.mcssView
@@ -34,15 +34,51 @@
3434 align-items: center
3535
3636 margin: 0
3737
38- section.action {
39- button { margin-left: 0 }
38 + display: flex
4039
40 + section {
41 + button { margin: 0 }
42 +
43 + -friendship {
44 + display: flex
45 + div.relationship-status {
46 + margin: auto
47 + margin-left: .5rem
48 + }
49 +
50 + }
51 + -blocking {
52 + margin-left: 8rem
53 + position: relative
54 +
55 + button {}
56 +
57 + div.explainer {
58 + visibility: hidden
59 + position: absolute
60 + background: #fff
61 + width: 24rem
62 + left: 1rem
63 + bottom: 2rem
64 + padding: .5rem
65 + box-shadow: rgba(0, 0, 0, 0.2) 2px 2px 8px
66 +
67 + ul {
68 + font-size: .8rem
69 + padding-left: 1rem
70 + }
71 + }
72 +
73 + :hover {
74 + div.explainer {
75 + visibility: visible
76 + }
77 + }
78 + }
4179 }
42- section.status {
43-
44- }
80 +
4581 }
4682
4783 div.friends {
4884 section a {
main.jsView
@@ -18,21 +18,23 @@
1818 styles: bulk(__dirname, [ 'styles/**/*.js' ]),
1919
2020 config: require('./config'), // shouldn't be in here ?
2121 contextMenu: require('patch-context'),
22 + inbox: require('patch-inbox'),
23 + history: require('patch-history')
2224 }
2325 }
2426
2527
2628 // from more specialized to more general
2729 const sockets = combine(
2830 //require('ssb-horcrux'),
2931 //require('patch-hub'),
32 +
3033 require('ssb-chess'),
3134 require('patchbay-gatherings'),
32- require('patch-inbox'),
33- require('patch-history'),
34- require('patch-settings'),
35 + // require('patch-network),
36 + require('patch-settings'), // might need to be in patchbay
3537 patchbay,
3638 require('patchcore')
3739 )
3840
message/html/compose.jsView
@@ -73,9 +73,8 @@
7373 h('div.close', { 'ev-click': () => warningMessage.set(null) }, 'x')
7474 ]
7575 )
7676 var fileInput = api.blob.html.input(file => {
77-
7877 const megabytes = file.size / 1024 / 1024
7978 if (megabytes >= 5) {
8079 const rounded = Math.floor(megabytes*100)/100
8180 warningMessage.set([
message/html/render/follow.jsView
@@ -1,37 +1,0 @@
1-const nest = require('depnest')
2-const extend = require('xtend')
3-const { isFeed } = require('ssb-ref')
4-
5-exports.gives = nest('message.html.render')
6-
7-exports.needs = nest({
8- 'about.html.link': 'first',
9- 'message.html': {
10- decorate: 'reduce',
11- layout: 'first'
12- }
13-})
14-
15-exports.create = function (api) {
16- return nest('message.html.render', follow)
17-
18- function follow (msg, opts) {
19- const { type, contact, following } = msg.value.content
20- if (type !== 'contact') return
21- if (!isFeed(contact)) return
22-
23- const element = api.message.html.layout(msg, extend({
24- content: renderContent({ contact, following }),
25- layout: 'mini'
26- }, opts))
27-
28- return api.message.html.decorate(element, { msg })
29- }
30-
31- function renderContent ({ contact, following }) {
32- return [
33- following ? 'followed ' : 'unfollowed ',
34- api.about.html.link(contact)
35- ]
36- }
37-}
message/html/render/contact.jsView
@@ -1,0 +1,43 @@
1 +const nest = require('depnest')
2 +const extend = require('xtend')
3 +const { isFeed } = require('ssb-ref')
4 +
5 +exports.gives = nest('message.html.render')
6 +
7 +exports.needs = nest({
8 + 'about.html.link': 'first',
9 + 'message.html': {
10 + decorate: 'reduce',
11 + layout: 'first'
12 + }
13 +})
14 +
15 +exports.create = function (api) {
16 + return nest('message.html.render', follow)
17 +
18 + function follow (msg, opts) {
19 + const { type, contact, following, blocking } = msg.value.content
20 + if (type !== 'contact') return
21 + if (!isFeed(contact)) return
22 +
23 + const element = api.message.html.layout(msg, extend({
24 + content: renderContent({ contact, following, blocking }),
25 + layout: 'mini'
26 + }, opts))
27 +
28 + return api.message.html.decorate(element, { msg })
29 + }
30 +
31 + function renderContent ({ contact, following, blocking }) {
32 + const name = api.about.html.link(contact)
33 +
34 + if (blocking != undefined) return [
35 + blocking ? 'blocked ' : 'unblocked ',
36 + name
37 + ]
38 + if (following != undefined) return [
39 + following ? 'followed ' : 'unfollowed ',
40 + name
41 + ]
42 + }
43 +}
package-lock.jsonView
The diff is too large to show. Use a local git client to view these changes.
Old file size: 305368 bytes
New file size: 305901 bytes
package.jsonView
@@ -1,7 +1,7 @@
11 {
22 "name": "patchbay",
3- "version": "7.11.1",
3 + "version": "7.12.1",
44 "description": "patchbay 2, built on patchcore",
55 "main": "main.js",
66 "scripts": {
77 "lint": "standard",
@@ -59,9 +59,9 @@
5959 "patch-hub": "^1.1.0",
6060 "patch-inbox": "^1.0.2",
6161 "patch-settings": "^1.0.0",
6262 "patchbay-gatherings": "^2.0.0",
63- "patchcore": "^1.10.3",
63 + "patchcore": "^1.12.0",
6464 "pull-abortable": "^4.1.1",
6565 "pull-cat": "^1.1.11",
6666 "pull-next": "1.0.0",
6767 "pull-scroll": "^1.0.9",
@@ -69,13 +69,13 @@
6969 "read-directory": "^2.0.0",
7070 "require-style": "^1.0.0",
7171 "scuttlebot": "^10.4.4",
7272 "setimmediate": "^1.0.5",
73- "ssb-chess": "1.4.4",
73 + "ssb-chess": "1.4.5",
7474 "ssb-horcrux": "^0.1.3",
75- "ssb-ws": "^1.0.3",
7675 "ssb-mentions": "~0.4.0",
7776 "ssb-mutual": "^0.1.0",
77 + "ssb-ws": "^1.0.3",
7878 "style-resolve": "^1.0.1",
7979 "suggest-box": "^2.2.3",
8080 "text-node-searcher": "^1.1.1",
8181 "xtend": "^4.0.1"
@@ -85,10 +85,9 @@
8585 "electron": "~1.6.11",
8686 "ssb-about": "^0.1.0",
8787 "ssb-backlinks": "^0.4.0",
8888 "ssb-blobs": "^1.1.3",
89- "ssb-contacts": "0.0.2",
90- "ssb-friends": "^2.2.2",
89 + "ssb-friends": "^2.2.3",
9190 "ssb-fulltext": "^1.0.1",
9291 "ssb-keys": "^7.0.10",
9392 "ssb-mentions": "^0.4.0",
9493 "ssb-private": "^0.1.2",

Built with git-ssb-web