Skip to content

Commit 4835635

Browse files
committed
Many small bugfixes
1 parent 92792f2 commit 4835635

File tree

10 files changed

+3531
-936
lines changed

10 files changed

+3531
-936
lines changed

app.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@ app.on("ready", () => {
266266
// load default identity and start
267267
try {
268268
let defaultIdentity = getDefaultIdentity()
269-
console.log("default identity", defaultIdentity)
270269
if (defaultIdentity.startServer) {
271270
startServer(defaultIdentity)
272271
} else if (defaultIdentity) {

package-lock.json

Lines changed: 3490 additions & 902 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
"ssb-keys": "^8.2.0",
110110
"ssb-lan": "^1.2.3",
111111
"ssb-logging": "^1.0.0",
112-
"ssb-markdown": "^4.0.1",
112+
"ssb-markdown": "^6.0.7",
113113
"ssb-marked": "^0.7.4",
114114
"ssb-master": "^1.0.3",
115115
"ssb-meme": "^1.1.0",

ui/core/kernel/prefs.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const defaultPreferencesContent = `
2020
#
2121
[Preferences]
2222
theme = "light"
23-
textSize = "prose-lg"
23+
textSize = "prose"
2424
limit = "40"
2525
2626
[MessageTypes]
@@ -52,10 +52,12 @@ const preferencesFileExists = () => {
5252

5353
if (fileExists) {
5454
const data = TOML.parse(fs.readFileSync(prefsFile))
55-
console.log(data)
5655
if (data?.Preferences?.defaultIdentity &&
5756
data[data?.Preferences?.defaultIdentity]?.id) {
5857
return true
58+
} else if (data?.preferences?.defaultIdentity &&
59+
data[data?.preferences?.defaultIdentity]?.id) {
60+
return true
5961
}
6062
}
6163

@@ -75,6 +77,11 @@ const loadSavedData = async () => {
7577
const data = TOML.parse(fs.readFileSync(prefsFile))
7678

7779
if (data) {
80+
if (data.hasOwnProperty("preferences")) {
81+
// old prefs file, migrate
82+
data.Preferences = data.preferences
83+
delete data.preferences
84+
}
7885
savedData = data
7986
} else {
8087
throw "Bad patchfox.toml"
@@ -95,6 +102,8 @@ const getPref = (key, defaultValue, namespace = "Preferences") => {
95102
// by the first-time setup.
96103
if (preferencesFileExists()) {
97104
savedData = TOML.parse(fs.readFileSync(prefsFile))
105+
} else {
106+
initialisePreferencesFileIfNeeded()
98107
}
99108
}
100109

ui/core/platforms/nodejs-db1/ssb.js

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -154,23 +154,21 @@ class NodeJsDB1 {
154154
}
155155

156156
async public(opts) {
157-
console.time("ssb.public")
158157
opts = opts || {}
159158
opts.reverse = opts.reverse || true
160159

161160
const pipeline = pipelines.thread.get()
162161
const filter = opts.filter
163162
let selectedFilter
164-
console.time("Getting friends graph")
163+
// console.time("Getting friends graph")
165164
let friends = await friendship.friendsAsArray(sbot.id)
166-
console.timeEnd("Getting friends graph")
167-
console.time("Getting following graph")
165+
// console.timeEnd("Getting friends graph")
166+
// console.time("Getting following graph")
168167
let following = await friendship.followingAsArray(sbot.id)
169-
console.timeEnd("Getting following graph")
168+
// console.timeEnd("Getting following graph")
170169

171-
// console.log("friends", friends)
172-
// console.log("following", following)
173-
170+
// console.log("friends", friends)
171+
// console.log("following", following)
174172

175173
// so you don't filter yourself out.
176174
friends.push(sbot.id)
@@ -204,8 +202,6 @@ class NodeJsDB1 {
204202
// })
205203
// }, 5),
206204
pull.collect((err, msgs) => {
207-
console.timeEnd("ssb.public")
208-
209205
if (err) {
210206
reject(err)
211207
}
@@ -623,25 +619,24 @@ class NodeJsDB1 {
623619
function replaceFeedID(match, id, offset, string) {
624620
let eid = encodeURIComponent(`@${id}`)
625621
return (
626-
// eslint-disable-next-line quotes
627-
'<a class="link link-accent profile-link" href="?pkg=contacts&view=profile&feed=' + eid + identity
622+
`<a class="link link-accent profile-link" href="?pkg=contacts&view=profile&feed=` + eid + identity
628623
)
629624
}
630625

631626
function replaceImageLinks(match, id, offset, string) {
632-
return `<a class="link link-accent image-link" target="_blank" href="${patchfox.httpUrl("/blobs/get/&")}` + encodeURIComponent(id)
627+
return `<a class="link link-accent image-link" target="_blank" href="${patchfox.httpUrl("/blobs/get/&")}` + id
633628
}
634629

635630
function replaceImages(match, id, offset, string) {
636-
return `<img class="is-image-from-blob" src="${patchfox.httpUrl("/blobs/get/&")}` + encodeURIComponent(id)
631+
return `<img class="is-image-from-blob" src="${patchfox.httpUrl("/blobs/get/&")}` + id
637632
}
638633

639634
function replaceVideos(match, id, offset, string) {
640-
return `<video controls class="is-video-from-blob" src="${patchfox.httpUrl("/blobs/get/&")}` + encodeURIComponent(id)
635+
return `<video controls class="is-video-from-blob" src="${patchfox.httpUrl("/blobs/get/&")}` + id
641636
}
642637

643638
function replaceAudios(match, id, offset, string) {
644-
return `<audio controls class="is-audio-from-blob" src="${patchfox.httpUrl("/blobs/get/&")}` + encodeURIComponent(id)
639+
return `<audio controls class="is-audio-from-blob" src="${patchfox.httpUrl("/blobs/get/&")}` + id
645640
}
646641

647642
let opts = {
@@ -657,8 +652,8 @@ class NodeJsDB1 {
657652
.replace(/target="_blank"/gi, "")
658653
.replace(/<a href="%([^"]*)/gi, replaceMsgID)
659654
.replace(/<img src="&([^"]*)/gi, replaceImages)
660-
.replace(/<video controls src="&([^"]*)/gi, replaceVideos)
661-
.replace(/<audio controls src="&([^"]*)/gi, replaceAudios)
655+
.replace(/<video src="&([^"]*)/gi, replaceVideos)
656+
.replace(/<audio src="&([^"]*)/gi, replaceAudios)
662657
.replace(/<a href="&([^"]*)/gi, replaceImageLinks)
663658
.replace(/<a href="([^"]*)/gi, replaceLinks)
664659

ui/packages/firstTimeSetup/FirstTimeSetupView.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ const CustomKeys = {
5757
view: vnode => {
5858
let enabled = vnode.state.remote.length > 0 && vnode.state.keys
5959

60-
console.log("disabled", enabled)
6160
const selectedFile = ev => {
6261
const secretFile = ev.target.files[0]
6362
const reader = new FileReader()

ui/packages/hub/Public.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const PublicView = {
3636
.public(opts)
3737
.then(ms => {
3838
console.timeEnd("public timeline")
39-
console.log(ms)
39+
// console.log(ms)
4040
vnode.state.msgs = ms
4141
window.scrollTo(0, 0)
4242
vnode.state.loadingPhase = "loaded"

ui/packages/hub/Thread.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@ const ThreadView = {
1414
let el = document.querySelector(`[data-key='${thread}']`)
1515

1616
if (el && !vnode.state.scrolledIntoView) {
17-
console.log("scrolling")
1817
el.scrollIntoView({behavior: "smooth", block: "end", inline: "nearest"})
1918
vnode.state.scrolledIntoView = true
20-
} else {
21-
console.log("not", el)
2219
}
2320

2421
},
@@ -33,17 +30,16 @@ const ThreadView = {
3330

3431
patchfox.title(thread)
3532

33+
vnode.state.shouldLoadMessages = false
3634
ssb
3735
.thread(thread)
3836
.then((ms) => {
3937
vnode.state.msgs = ms
40-
vnode.state.shouldLoadMessages = false
4138
m.redraw()
4239
})
4340
.catch((n) => {
4441
console.dir(n)
4542
vnode.state.error = n.message
46-
vnode.state.shouldLoadMessages = false
4743
if (n.message.indexOf("stream is closed") !== -1) {
4844
location.reload()
4945
}

ui/packages/post/PostCompose.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,17 @@ const PostCompose = {
309309
if (vnode.state.showPreview) {
310310
return m("div", [
311311
m("h2.uppercase.font-medium.text-md", "Post Preview"),
312-
m(".prose", [when(vnode.state.channel, m("p.text-md", `Channel: ${vnode.state.channel.startsWith("#") ? vnode.state.channel.slice(1) : vnode.state.channel}`)), when(vnode.state.root, m("p.text-md", `Root: ${vnode.state.root}`)), when(vnode.state.branch, m("p.text-md", `In Reply To: ${vnode.state.branch}`)), when(vnode.state.contentWarning.length > 0, m("p.text-md", `Content Warning: ${vnode.state.contentWarning}`))]),
313-
m.trust(ssb.markdown(vnode.state.content)),
312+
m(".prose", [
313+
when(vnode.state.channel,
314+
m("p.text-md", `Channel: ${vnode.state.channel.startsWith("#") ? vnode.state.channel.slice(1) : vnode.state.channel}`)),
315+
when(vnode.state.root,
316+
m("p.text-md", `Root: ${vnode.state.root}`)),
317+
when(vnode.state.branch,
318+
m("p.text-md", `In Reply To: ${vnode.state.branch}`)),
319+
when(vnode.state.contentWarning.length > 0,
320+
m("p.text-md", `Content Warning: ${vnode.state.contentWarning}`))
321+
]),
322+
m(".prose", m.trust(ssb.markdown(vnode.state.content))),
314323
m(".divider"),
315324
m(".alert.alert-warning", [
316325
m(".flex-1", m("label", "This message will be public and can't be edited or deleted")),

ui/packages/statusBar/statusBarView.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ const checkVersion = async () => {
3131
let releases = await (await fetch("https://api.github.com/repos/soapdog/patchfox/releases")).json()
3232
let latestRelease = releases[0]
3333

34-
console.log("latestRelease", latestRelease)
35-
console.log("localVersion", localVersion)
34+
// console.log("latestRelease", latestRelease)
35+
// console.log("localVersion", localVersion)
3636

3737
if (latestRelease.name !== localVersion) {
3838
document.getElementById("version").innerHTML = `v${localVersion} (update available: <a class="underline" target="_blank" href="${latestRelease.html_url}">${latestRelease.name}</a>)`
@@ -74,7 +74,7 @@ const StatusBarView = {
7474
vnode.state.peers = []
7575
setInterval(() => checkIndexing(vnode), 300)
7676
setInterval(() => countPeers(vnode), 300)
77-
checkVersion()
77+
// checkVersion()
7878
},
7979

8080
view: vnode => {

0 commit comments

Comments
 (0)