Github: external core setup? Also, best logged-in clue (for author mode vs readOnly)?

Dear all,

Just in case TiddlyHost glitches are not fixed within the next week (since I can’t require students to work with iframes that have high odds of timing out, or even high odds of very laggy load times), I’m trying to get poised to replicate a couple of my workhorse wikis on github. I do have a github account, and can manage to upload my wikis… but two challenges so far:

(1) External core? (I rely on external core to streamline repeated load times in LMS iframes) TiddlyHost has a super-easy radio-button config to activate external-core (and surely hosts that external core in a centralized way). With github, what’s the best way to get my (already saved as external-core) external-core wiki properly linked up? (I did upload tiddlywikicore-5.3.5.js within the same github directory, but that seems not to be enough…) I’m sure these details are somewhere spelled out in past posts, but my learning curve around both github and core tinkering is steep, so if someone’s willing to hold my hand through it, I’d be grateful.

[Documentation side-note: There’s some documentation on external Javascript at tw-com, but it wasn’t super-clear on how I get a server-hosted wiki to access the core elsewhere.]

(2) Detecting (likely) author status? I have relied on a startupAction checking for $:/status/IsLoggedIn:yes in at TiddlyHost. If I’m logged in, I see all the complex author console stuff. Otherwise, a streamlined readOnly mode is on. (So I never have to worry about manually invoking readOnly prior to saving). Is there anything remotely comparable that I can activate via github? I notice I can visually check whether my browser session has access to github password (<$password name="github"/> shows the string of dots if my OAUTH is available), but can I confirm/leverage the presence of that password in a startupAction? (I’m willing to drop concern for whether the password works — running the risk that some programmer student actually has a github password available to the browser. The main goal is to minimize visual clutter and confusion/distraction-rabbit-holes for naive users.)

[Very small documentation side-note: the PasswordWidget seems only to display stuff, not to pass anything along for further filter steps… the documentation has a missing link to TiddlyWiki5 PasswordVault — which stymied my attempt to dig deeper.]

Do your students need to save something too?

Nope. This is strictly “broadcast” of teaching materials, with frequent ongoing updates from me — though I do have a trick that helps each student see (through a complex hashtag passed by the LMS into the iframe) specific feedback and tips specific to the student, and/or any groups they participate in.

(I do populate the wiki with semi-anonymized student-writing submissions, ported over from the LMS using JSON export… But I have never been able to crack getting secure multi-author plug-and-play TiddlyWiki over the web… has anyone really done it, apart from the super-complex and understandably paid services of Federatial? Hubzilla comes close, but it’s too much fiddly setup for getting students — who are not signing up to learn about TiddlyWiki or any other tech stuff! — into collaborative authoring mode. For educational purposes, I need not to require students to generate any further IDs on any additional servers beyond the university’s own LMS authentication. So, even github based multi-author stuff is beyond what makes sense, alas.)

That should be enough. I do have a test-wiki, which I do use for experiments with external-core My TiddlyWiki — a non-linear personal web notebook

repo: GitHub - pmario/test: test tiddlywiki saver: https://pmario.github.io/test/

As you can see, it uses a super outdated version, but the mechanism in still the same.

So it should be enough if you have 1 “external-core” per version you want to support in that directory.

The default HTML file is index.html, which can link to many other files in the same or also in subdirectories.


The important part is: How did you create your “*.html” file?

</body>
<!--~~ Load external JS ~~-->
<script src="tiddlywikicore-5.2.1.js" onerror="alert('Error: Cannot load tiddlywikicore-5.2.1.js');"></script>
</html>

It shows the core version. If that’s the case, it should work with GitHub

GitHub has a possibility to check if a user needs authentication. eg:

But there is no functionality like this in the TW core atm. But the info is there


The authentication is done with so called GH-Tokens, which is needed by the TW GH-saver configuration in the ControlPanel


At GH: a token can be generated at: Sign in to GitHub · GitHub
I use the Classic Token atm

  • Once created, the token can be copied to "Password OAUTH token … " field in the ControlPanel.
  • That’s it
  • The token is saved in your browser only.
  • So for different devices, you’ll need different tokens, for the same repo. That’s no problem.

hope that helps

I have no trouble with making and using tokens. As noted above, I have used github for hosting TiddlyWiki projects before — just not with automatic detection of whether to show up in “author mode” vs “reader mode”. So the question is whether there’s any way a startupAction can check for the presence of a password. Sounds like there isn’t :frowning:


So — onward to the external core question...

UPDATE: I was getting tripped up by how long github takes to process changes through to publication (in contrast to pretty-much instant results on TiddlyHost). In fact specifying the full github url (https://springerspandrel.github.io/tw/tiddlywikicore-5.3.5.js) for the core did work, once github digested the change properly. Not sure why the same-directory shortcut filename didn’t work, but no matter now!

prior response

Yes, the bottom of my file shows:

<!--~~ Load external JavaScripts ~~-->
<script src="tiddlywikicore-5.3.5.js" onerror="alert('Error: Cannot load tiddlywikicore-5.3.5.js');"></script>
</body>
</html>

But the question is how to get it to find the core file, which is also at github. I have no doubt it should work once configured right, but I simply don’t understand what the steps are.

There’s the rub: TiddlyHost did it all for me (creating the external-core version of my site). I think I followed instructions to walk through the steps of making an external-core site way at the beginning once (that his, back when the external-core option was first announced). But again, the question is where/how the github version of my page “calls” the external core’s url. (I already have the latest “core-less” version of my wiki downloaded from TiddlyHost, but the pointer to the core needs to be updated somehow, and the obvious (trusting same directory, just specifying “tiddlywikicore-5.3.5.js” — and also the full url for the core, which does load properly at https://springerspandrel.github.io/tw/tiddlywikicore-5.3.5.js … Neither has been behaving right — in Safari I even get an RSOD.) This is all seamlessly managed by TiddlyHost, and now I’m a bit lost how to reconstruct it.

It should find it. The path is: <your-name>.github.io/<your-repo>
So for my test-wiki it’s https://pmario.github.io/test

If you did change the HTML file manually, with the next save it will be overwritten. But that’s no problem. It should find the external core with your configuration

Yes. GitHub pages, do some “post processing” if a “file” is changed. Since public repositories are free to use, they are probably processed on a lower priority. So, for me, it can need up to a minute and I need to SHIFT - reload, since the browser may be caching too.

1 Like

Not at the moment. I did have a look, if the GitHub saver can define the $:/status/IsLoggedIn at startup, or if the Auth-token changes.

It should be possible. But I’m not sure, if the saver is the right place for that.

You may raise a GH feature-request, so it won’t be forgotten.

1 Like

This custom filter can check whether a given password is saved in the browser’s local storage: tw5-docs-pr-maker/plugins/pr-assistant/filters/password-exists.js at main · saqimtiaz/tw5-docs-pr-maker · GitHub

Usage:

[password-exists[github]match[yes]then.....]

2 Likes