+5
-1
decent/modules_basic/avatar-edit.js
+5
-1
decent/modules_basic/avatar-edit.js
···
48
exports.needs = {
49
message_confirm: 'first',
50
blob_url: 'first',
51
sbot_links: 'first',
52
avatar_name: 'first'
53
}
···
111
img.src = data
112
var _data = dataurl.parse(data)
113
var xhr = new XMLHttpRequest()
114
-
xhr.open('POST', '/blobs/add', true)
115
xhr.responseType = 'text'
116
xhr.onload = function () {
117
if (xhr.status < 200 || xhr.status >= 300) {
···
48
exports.needs = {
49
message_confirm: 'first',
50
blob_url: 'first',
51
+
blobs_url: 'first',
52
sbot_links: 'first',
53
avatar_name: 'first'
54
}
···
112
img.src = data
113
var _data = dataurl.parse(data)
114
var xhr = new XMLHttpRequest()
115
+
var blobsUrl = api.blobs_url()
116
+
var addUrl = blobsUrl.replace(/\/blobs\/get\/?$/, '/blobs/add')
117
+
if (addUrl === blobsUrl) addUrl = '/blobs/add'
118
+
xhr.open('POST', addUrl, true)
119
xhr.responseType = 'text'
120
xhr.onload = function () {
121
if (xhr.status < 200 || xhr.status >= 300) {
+11
-10
decent/modules_basic/avatar-profile.js
+11
-10
decent/modules_basic/avatar-profile.js
···
71
72
73
return h('div.column.profile',
74
-
api.avatar_edit(id),
75
-
api.avatar_action(id),
76
-
h('div.profile__relationships.column',
77
-
h('strong', 'follows'),
78
-
follows_el,
79
-
h('strong', 'friends'),
80
-
friends_el,
81
-
h('strong', 'followers'),
82
-
followers_el
83
)
84
)
85
}
86
87
}
88
-
···
71
72
73
return h('div.column.profile',
74
+
h('div.message.message-card',
75
+
api.avatar_edit(id),
76
+
api.avatar_action(id),
77
+
h('div.profile__relationships.column',
78
+
h('strong', 'follows'),
79
+
follows_el,
80
+
h('strong', 'friends'),
81
+
friends_el,
82
+
h('strong', 'followers'),
83
+
followers_el
84
+
)
85
)
86
)
87
}
88
89
}
-2
decent/modules_basic/feed.js
-2
decent/modules_basic/feed.js
+2
-2
decent/modules_basic/private.js
+2
-2
decent/modules_basic/private.js
+2
-2
decent/modules_basic/public.js
+2
-2
decent/modules_basic/public.js
+1
-1
decent/modules_basic/setup.js
+1
-1
decent/modules_basic/setup.js
+16
-13
decent/modules_core/app.js
+16
-13
decent/modules_core/app.js
···
22
23
function getRoute () {
24
var raw = window.location.hash.substring(1).trim()
25
-
if (!raw || raw === 'tabs') return '/public'
26
-
if (raw[0] === '/' || raw[0] === '@' || raw[0] === '%' || raw[0] === '#')
27
-
return raw
28
-
return '/' + raw
29
}
30
31
function renderRoute (route, container) {
···
44
setTitle(route, view)
45
}
46
47
var navItems = [
48
-
{route: '/public', label: 'Public', icon: 'public'},
49
-
{route: '/private', label: 'Private', icon: 'lock'},
50
-
{route: '/notifications', label: 'Notifications', icon: 'notifications'},
51
-
{route: '/key', label: 'Key', icon: 'key'}
52
]
53
54
var nav = h('ul.nav.pull-left', navItems.map(function (item) {
···
63
var header = h('div.navbar',
64
h('div.navbar-inner',
65
h('div.container-fluid',
66
nav,
67
h('div.pull-right', api.menu())
68
)
···
86
var base = 'Decent SSB'
87
var suffix = (view && view.title) || null
88
if (!suffix) {
89
-
if (route === '/public') suffix = 'Public'
90
-
else if (route === '/private') suffix = 'Private'
91
-
else if (route === '/notifications') suffix = 'Notifications'
92
-
else if (route === '/key') suffix = 'Key'
93
-
else if (route.indexOf('/channel/') === 0) suffix = 'Channel ' + route.slice(9)
94
else if (route[0] === '@') suffix = 'Profile'
95
else if (route[0] === '%') suffix = 'Thread'
96
else if (route[0] === '#') suffix = 'Message'
···
22
23
function getRoute () {
24
var raw = window.location.hash.substring(1).trim()
25
+
if (!raw || raw === 'tabs') return 'public'
26
+
if (raw[0] === '@' || raw[0] === '%' || raw[0] === '#') return raw
27
+
if (raw[0] === '/') return raw.slice(1)
28
+
return raw
29
}
30
31
function renderRoute (route, container) {
···
44
setTitle(route, view)
45
}
46
47
+
var selfId = require('../keys').id
48
var navItems = [
49
+
{route: 'public', label: 'Public', icon: 'public'},
50
+
{route: selfId, label: 'Profile', icon: 'person'},
51
+
{route: 'private', label: 'Private', icon: 'lock'},
52
+
{route: 'notifications', label: 'Notifications', icon: 'notifications'},
53
+
{route: 'key', label: 'Key', icon: 'key'}
54
]
55
56
var nav = h('ul.nav.pull-left', navItems.map(function (item) {
···
65
var header = h('div.navbar',
66
h('div.navbar-inner',
67
h('div.container-fluid',
68
+
h('a.brand', {href: '#public'}, 'Decent'),
69
nav,
70
h('div.pull-right', api.menu())
71
)
···
89
var base = 'Decent SSB'
90
var suffix = (view && view.title) || null
91
if (!suffix) {
92
+
if (route === 'public') suffix = 'Public'
93
+
else if (route === 'private') suffix = 'Private'
94
+
else if (route === 'notifications') suffix = 'Notifications'
95
+
else if (route === 'key') suffix = 'Key'
96
+
else if (route.indexOf('channel/') === 0) suffix = 'Channel ' + route.slice(8)
97
else if (route[0] === '@') suffix = 'Profile'
98
else if (route[0] === '%') suffix = 'Thread'
99
else if (route[0] === '#') suffix = 'Message'
+9
-2
decent/modules_core/file-input.js
+9
-2
decent/modules_core/file-input.js
···
7
var fileInputId = 0
8
9
module.exports = {
10
-
needs: {},
11
gives: 'file_input',
12
create: function (api) {
13
14
function uploadViaHttp (file, cb) {
15
var xhr = new XMLHttpRequest()
16
-
xhr.open('POST', '/blobs/add', true)
17
xhr.responseType = 'text'
18
xhr.onload = function () {
19
if (xhr.status >= 200 && xhr.status < 300)
···
7
var fileInputId = 0
8
9
module.exports = {
10
+
needs: {blobs_url: 'first'},
11
gives: 'file_input',
12
create: function (api) {
13
14
+
function blobsAddUrl () {
15
+
var url = api.blobs_url && api.blobs_url()
16
+
if (!url) return '/blobs/add'
17
+
var addUrl = url.replace(/\/blobs\/get\/?$/, '/blobs/add')
18
+
return addUrl === url ? '/blobs/add' : addUrl
19
+
}
20
+
21
function uploadViaHttp (file, cb) {
22
var xhr = new XMLHttpRequest()
23
+
xhr.open('POST', blobsAddUrl(), true)
24
xhr.responseType = 'text'
25
xhr.onload = function () {
26
if (xhr.status >= 200 && xhr.status < 300)
+2
-2
decent/modules_extra/git-ssb.js
+2
-2
decent/modules_extra/git-ssb.js
···
21
exports.create = function (api) {
22
return {
23
menu_items: function () {
24
-
return h('a', {href: '#/git-ssb'}, '/git-ssb')
25
},
26
27
screen_view: function (path, sbot) {
28
-
if(path === '/git-ssb') {
29
30
var content = h('div.column.scroller__content')
31
var div = h('div.column.scroller',
···
21
exports.create = function (api) {
22
return {
23
menu_items: function () {
24
+
return h('a', {href: '#git-ssb'}, 'Git SSB')
25
},
26
27
screen_view: function (path, sbot) {
28
+
if(path === 'git-ssb') {
29
30
var content = h('div.column.scroller__content')
31
var div = h('div.column.scroller',
+4
-4
decent/modules_extra/key.js
+4
-4
decent/modules_extra/key.js
···
18
exports.create = function (api) {
19
return {
20
menu_items: function () {
21
-
return h('a', {href: '#/key'}, '/key')
22
},
23
screen_view: function (path, sbot) {
24
-
if(path === '/key') {
25
if(process.title === 'browser') {
26
var storedSecret = null
27
try { storedSecret = localStorage['browser/.ssb/secret'] } catch (_) {}
···
39
{style: {'overflow':'auto'}},
40
h('div.scroller__wrapper',
41
h('div.column.scroller__content',
42
-
h('div.message',
43
h('p', {innerHTML: 'Your secret key is: <pre><code>' + (storedSecret || '') + '</code></pre>'}),
44
h('form',
45
importKey,
···
55
)
56
return div
57
} else {
58
-
return h('p', 'Your key is saved at .ssb/secret')
59
}
60
}
61
}
···
18
exports.create = function (api) {
19
return {
20
menu_items: function () {
21
+
return h('a', {href: '#key'}, 'Key')
22
},
23
screen_view: function (path, sbot) {
24
+
if(path === 'key') {
25
if(process.title === 'browser') {
26
var storedSecret = null
27
try { storedSecret = localStorage['browser/.ssb/secret'] } catch (_) {}
···
39
{style: {'overflow':'auto'}},
40
h('div.scroller__wrapper',
41
h('div.column.scroller__content',
42
+
h('div.message.message-card',
43
h('p', {innerHTML: 'Your secret key is: <pre><code>' + (storedSecret || '') + '</code></pre>'}),
44
h('form',
45
importKey,
···
55
)
56
return div
57
} else {
58
+
return h('div.message.message-card', 'Your key is saved at .ssb/secret')
59
}
60
}
61
}
+3
-4
decent/modules_extra/network.js
+3
-4
decent/modules_extra/network.js
···
106
107
return {
108
menu_items: function () {
109
-
return h('a', {href: '#/network'}, '/network')
110
},
111
112
builtin_tabs: function () {
113
-
return ['/network']
114
},
115
116
screen_view: function (path) {
117
118
-
if(path !== '/network') return
119
120
var ol = h('ul.network')
121
···
173
}
174
}
175
176
-
···
106
107
return {
108
menu_items: function () {
109
+
return h('a', {href: '#network'}, 'Network')
110
},
111
112
builtin_tabs: function () {
113
+
return ['network']
114
},
115
116
screen_view: function (path) {
117
118
+
if(path !== 'network') return
119
120
var ol = h('ul.network')
121
···
173
}
174
}
175
+2
-2
decent/modules_extra/notifications.js
+2
-2
decent/modules_extra/notifications.js
+3
-3
decent/modules_extra/query.js
+3
-3
decent/modules_extra/query.js
···
16
17
return {
18
menu_items: function () {
19
-
return h('a', {href:'#/query'}, '/query')
20
},
21
22
builtin_tabs: function () {
23
-
return ['/query']
24
},
25
26
screen_view: function (path) {
27
-
if(path != '/query') return
28
var output, status, editor, stream, query
29
30
function parse () {
···
16
17
return {
18
menu_items: function () {
19
+
return h('a', {href:'#query'}, 'Query')
20
},
21
22
builtin_tabs: function () {
23
+
return ['query']
24
},
25
26
screen_view: function (path) {
27
+
if(path != 'query') return
28
var output, status, editor, stream, query
29
30
function parse () {
+4
-4
decent/modules_extra/versions.js
+4
-4
decent/modules_extra/versions.js
···
10
11
return {
12
menu_items: function () {
13
-
return h('a', {href: '#/versions'}, '/versions')
14
},
15
16
builtin_tabs: function () {
17
-
return ['/versions']
18
},
19
20
screen_view: function (path) {
21
-
if(path !== '/versions') return
22
23
if('undefined' === typeof WebBoot)
24
return h('h1', 'must run with web-boot enabled enviroment')
···
30
content.appendChild(
31
h('div.row',
32
h('a', {
33
-
href: '#/run:'+e.value,
34
onclick: function () {
35
WebBoot.run(e.value, function () {
36
console.log('rebooting to:', e.value)
···
10
11
return {
12
menu_items: function () {
13
+
return h('a', {href: '#versions'}, 'Versions')
14
},
15
16
builtin_tabs: function () {
17
+
return ['versions']
18
},
19
20
screen_view: function (path) {
21
+
if(path !== 'versions') return
22
23
if('undefined' === typeof WebBoot)
24
return h('h1', 'must run with web-boot enabled enviroment')
···
30
content.appendChild(
31
h('div.row',
32
h('a', {
33
+
href: '#run:'+e.value,
34
onclick: function () {
35
WebBoot.run(e.value, function () {
36
console.log('rebooting to:', e.value)
+9
-1
decent/style.css
+9
-1
decent/style.css
···
81
max-width: 680px;
82
margin-left: auto;
83
margin-right: auto;
84
+
padding: 0 0 20px;
85
}
86
87
.message img {
···
261
margin-bottom: 0;
262
}
263
264
+
.navbar .brand {
265
+
padding-left: 0;
266
+
margin-left: 0;
267
+
padding-right: 10px;
268
+
}
269
+
270
.navbar .container-fluid {
271
display: flex;
272
align-items: center;
273
gap: 8px;
274
+
padding-left: 0;
275
+
padding-right: 0;
276
}
277
278
.navbar .nav.pull-left {