Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem: wait for identity ready #43

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Simply edit index.html and replace `wss://mindmachine.688.org` with `ws://127.0.
If you are running the mindmachine on Windows using WSL2:

0. Change config.yaml. Set websocketaddr to `0.0.0.0:1031` (originally `127.0.0.1:1031`)
1. Run`ip a |grep "global eth0` and you will get `inet xxx.xxx.xxx.xxx/20 brd aaa.aaa.aaa.aaa scope global eth0`
1. Run`ip a |grep "global eth0` and you will get `inet xxx.xxx.xxx.xxx/20 brd aaa.aaa.aaa.aaa scope global eth0`
2. Edit index.html, replace `wss://mindmachine.688.org` with `ws://xxx.xxx.xxx.xxx:1031`
3. Open index.html
### Contributing
Expand Down
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,9 @@
case 641851:
kindReady = true
break;
case 640497:
identityReady = true
break;
}
}
}
Expand Down
19 changes: 16 additions & 3 deletions samizdat.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,29 @@ function waitForSamizdatReady(callback) {
}
}, 200);
}
let identityReady = false
function waitForIdentityReady(callback) {
var interval = setInterval(function() {
if (identityReady) {
clearInterval(interval);
callback();
}
}, 200);
}


function displaySamizdat() {
document.getElementById("maincontent").replaceChildren(prepWindow())
document.getElementById("heading").innerText = "Samizdatree"// spontaneously organising tree of self-published notes and other stuff
document.getElementById("heading").appendChild(spacer())
document.getElementById("content").replaceChildren(loadingSign())
waitForSamizdatReady(function () {
getMuhPubkey().then(pubkey => {
document.getElementById("heading").appendChild(helpButton("58b02c07e1971ad9178293e0c0d39509a715db35ba3a989ed97d25c6f8e9ad07", pubkey))
renderSamizdat(pubkey)
waitForIdentityReady(function () {
getMuhPubkey().then(pubkey => {
document.getElementById("heading").appendChild(helpButton("58b02c07e1971ad9178293e0c0d39509a715db35ba3a989ed97d25c6f8e9ad07", pubkey))
renderSamizdat(pubkey)
}
)
})
})
rewriteURL("samizdat")
Expand Down