[TW5] using TiddlyWiki as a website and read-only mode

3,371 views
Skip to first unread message

Tobias Beer

unread,
Dec 10, 2014, 7:52:01 AM12/10/14
to tiddl...@googlegroups.com
I wanted to use this thread to explore ways of using TiddlyWiki as a website, i.e. a website without editing and authoring controls, allowing visitors to focus on content and presentation.

Albeit worthy of consideration and comparison, this thread is not about using a static site — which pursues an entirely different approach, yet requiring that node.js build process.

At the moment I am inclined to think that the best way to achieve a website-view of a TiddlyWiki is to...
  1. create a read-only theme
  2. easily switch between authoring and viewing mode
    • allowing (to create) a simple bookmark to access the right tab in the control-panel
    • access to the control-panel, of course, by default being hidden from visitors in read-only mode
This theme should not only change styles but also includes modified shadow tiddlers of system tiddlers, i.e. ui components, so as to completely hide toolbar buttons or tabs.

So the first step will be to test if that is even possible, to have the shadows of a "theme plugin" overwrite a core shadow.

I'll be playing around here and post back on updates:


First problem encountered... having drag & dropped the readonly theme and then selecting it, doesn't seem to affect the display at all. It even looks like it doesn't have any components. Could be that "themes" is one topic that needs plenty documentation on TiddlyWiki.com... as to internals, as well as installing them.

Best wishes, Tobias.

Ton Gerner

unread,
Dec 10, 2014, 7:57:22 AM12/10/14
to tiddl...@googlegroups.com
Hi Tobias,

Did you see my rough workaround [1]?

Cheers,

Ton

[1] http://tw5readonly.tiddlyspot.com/

Tobias Beer

unread,
Dec 10, 2014, 7:57:59 AM12/10/14
to tiddl...@googlegroups.com
Mhhh, now the readonly theme seems to work.

Is it possible that, to import any theme, you first need to switch to it?

Or, can on only use drag and drop from the Plugins tab in the ControlPanel but not from Appearance / Theme?

One thing that is a bit awkward is that when you switch to readonly... how do you save?

...I know how to get to that save button, but I presume it also needs to be in the Saving tab in the ControlPanel so as to be able to use it when on read-only mode... since I will not be wanting a "Tools" tab on a website.

Another alternative would be, to be able to go to Appearance / Toolbars / PageToolbar and hit the button from there... but right now only the icons are shown, not the functional buttons... I think it should be the actual buttons just as in the Tools tab in the sidebar.

Best wishes, Tobias.

Tobias Beer

unread,
Dec 10, 2014, 7:58:59 AM12/10/14
to tiddl...@googlegroups.com
Hi Ton,
 

Nope, haven't yet (consciously) looked at it, will do & reference yours... thanks.

Best wishes, Tobias.

RichShumaker

unread,
Dec 10, 2014, 10:06:57 AM12/10/14
to tiddl...@googlegroups.com
Is it possible to make a Tiddler that is[[Admin Function Set to On]] for things you need to save and edit?
Then you password protect the [[Admin Function Set to On]] Tiddler.
Then when you are done with updates you just reload and it goes back to read only default.

Rich Shumaker

Tobias Beer

unread,
Dec 10, 2014, 10:57:58 AM12/10/14
to tiddl...@googlegroups.com
Hi Rich,

Is it possible to make a Tiddler that is[[Admin Function Set to On]] for things you need to save and edit?
Then you password protect the [[Admin Function Set to On]] Tiddler.
Then when you are done with updates you just reload and it goes back to read only default.

Yes, it is. There is...


or rather...


Although, turning the "admin function set to on" is most likely something anyone with the right skills could hack, if they wanted to... but for most visitors, they would never reach, say, $:/ControlPanel, if you encrypted it. And if you managed to prevent edit-mode, then they would have a hard time creating a ControlPanel themselves, i.e. by copy-&pasting it from tiddlywiki.com into a new tiddler on your site.

Best wishes, Tobias.

RichShumaker

unread,
Dec 10, 2014, 12:33:08 PM12/10/14
to tiddl...@googlegroups.com
My previous post
I was discussing a Tiddler that was actually a macro / view template that turned on and turned off your "Administration Stuff"
That Tiddler was encrypted with a password to keep people from getting to the "Administration Stuff"
I like the idea of Password protecting the control panel, until I lose the password or write it down incorrectly, d'oh!!!

I thought of another usage method and this one seems harder then simply encrypting a tiddler.
Is there a way to create an "Admin Mode" like "Safe Mode" - Instead of #:safe you would put #:admin and that would allow you to make changes?
Or maybe reverse that and have a view only mode #:viewonly?
Not sure how you keep it from being hacked though.

Right now I am working locally and then uploading so for me it is a bit easier to implement a "View Only" version, even though I haven't done that yet.
I am sure I would save it and then lose the save feature and get frustrated for a bit till I found the link listed above.

Rich Shumaker

Tobias Beer

unread,
Dec 10, 2014, 12:43:36 PM12/10/14
to tiddl...@googlegroups.com
Hey Rich,
 
Instead of #:safe you would put #:admin

That's a very neat idea. Perhaps it is even possible right now to run TiddlyWiki with a given template set on startup. Probably not, because saving would probably set it for everyone... unless that #:admin mode would prevent that "admin theme" from being persisted as anything but the "admin theme".
 
Or maybe reverse that and have a view only mode #:viewonly?

That seems to make little sense, unless you wanted to show someone: "this is what it could look like without the admin stuff"... which should be the default view, no?
 
Not sure how you keep it from being hacked though.

In TiddlyWiki, most all is hackable ...except for your password, unless you put it in a tiddler, in plain text. But why would you ever do that.

Best wishes, Tobias.

Jeremy Ruston

unread,
Dec 10, 2014, 2:50:14 PM12/10/14
to TiddlyWiki
I agree that we need a better implementation of read-only mode. I've created a ticket here:

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.



--
Jeremy Ruston
mailto:jeremy...@gmail.com

RichShumaker

unread,
Dec 10, 2014, 4:08:41 PM12/10/14
to tiddl...@googlegroups.com, jeremy...@gmail.com
Thanks Jeremy and as always Thanks Tobias.

Most PHP/MySQL type software I use has a separate 'Admin' log in address.
I tried not to exclude options as sometimes reversing the idea will work better in this case #:viewonly is probably silly talk.

I need to read up on TW dev to answer this myself but can you deactivate the Admin sections easily?
I know this is a ticket at GitHub so I will read up on TW design and add over there.

Ideally the Admin Section could easily be password protected so maybe it links to a tiddler that once you enter the password 'Activates' stuff.
This might allow for more fancy permissions too, so you have different views like #:User #:Admin #:Noob #heheh(that is laughter and not a view mode).

Is there a JavaScript User Permissions Module that is small and good and could be added to TW?
I know this beyond the scope of this post but this concept goes into a Content Management System.

Rich Shumaker

Tobias Beer

unread,
Dec 10, 2014, 5:34:00 PM12/10/14
to tiddl...@googlegroups.com, jeremy...@gmail.com
Hi Rich,
 
Is there a JavaScript User Permissions Module that is small and good and could be added to TW?
I know this beyond the scope of this post but this concept goes into a Content Management System.

Personally I would say, yes, this is beyond the scope of what I was aiming at. Because with a multi-user cms, you surely invite a whole different set of problems. Essentially you simply need per-tiddler-sync and pretty decent conflict handling, otherwise the workflow is just going to not work out smoothly.

That's an entirely different level I wasn't even addressing. For TWc there was TiddlyLock which would lock TWc for individual users during editing, so others could only view but not write. But then, it would still leave doors open to overwrite what others have worked on, as you had in your tabs for days. Without being able to try and sync to that file you're trying to overwrite, I don't see how that multi-user-workflow can be meaningfully done in a multi-user/-editors environment.

So, CMS, yes, if we're talking one-man-band. Multi-user => node.js (?!?) or other server-side magick à la TiddlySpace... maybe Tank.

Best wishes, Tobias.

RichShumaker

unread,
Dec 10, 2014, 8:33:30 PM12/10/14
to tiddl...@googlegroups.com, jeremy...@gmail.com
d'oh!!!
Forgot we can all play in the pond at the same time.

Thanks for the explanation Tobias.

Rich Shumaker

Dave Redford

unread,
Oct 5, 2015, 7:10:43 AM10/5/15
to TiddlyWiki, jeremy...@gmail.com
Hi all,

Realise that this post has been quiet for a while but I thought I'd add my thoughts as I needed to create a Read Only tiddly.

I downloaded the "empty.html" and made a copy, made my changes to remove all the "edit" buttons and then used MELD (http://meldmerge.org/) to compare the two html files.

From there I wrote a script in Autoit (but any language would do) to do a simple find and replace on the text in the html to reflect the differences I saw in MELD.

To test it you will need to install Autoit - https://www.autoitscript.com/site/autoit/downloads/
And download the tiddlywiki - http://tiddlywiki.com/#Download

Once downloaded then copy and rename the file to "empty_RW.html" as that is what the script looks for (the "_RW" is for Read Write and helps you keep track of what you are up to)

Then copy and paste the script below into Autoit, save it then press F5 to run it, point it at "empty_RW.html" and you will find another file created called "empty_RO.html" which will have all the edit features removed.

I haven't given this the full "hack" test and I am sure that with a little effort a hardcore user would be able to get to the missing system tiddlers but for most purposes this will work.

Enjoy :-)

Dave

Here is the code for Autoit -

;***** CODE STARTS
;Open Tiddly
$File = FileOpenDialog("Please select Tiddlywiki", @DesktopDir & "\", "HTML (*.html;*.htm)", 1 + 2)

If @error Then
    MsgBox(4096, "", "No File chosen")
    Exit
Else
    If StringInStr($File, "_RW.html") Then
        $ReadOnly = StringReplace($File, "_RW.html", "_RO.html")
    Else
        $ReadOnly = StringReplace($File, "_RW.htm", "_RO.htm")
    EndIf

    $FileCreate = FileOpen($ReadOnly, 2)
    $FileRead = FileOpen($File, 0)
    While 1
        $FileLine = FileReadLine($FileRead)
        If @error = -1 Then ExitLoop

        ;Remove Sidebar - $:/core/ui/SideBarLists
        If StringInStr($FileLine, "<$macrocall $name=\"tabs\" tabsList=\"[all[shadows+tiddlers]tag[$:/tags/SideBar]!has[draft.of]]\" default={{$:/config/DefaultSidebarTab}} state=\"$:/state/tab/sidebar\" />") Then
            $FileLine = StringReplace($FileLine, "&lt;$macrocall $name=\&quot;tabs\&quot; tabsList=\&quot;[all[shadows+tiddlers]tag[$:/tags/SideBar]!has[draft.of]]\&quot; default={{$:/config/DefaultSidebarTab}} state=\&quot;$:/state/tab/sidebar\&quot; /&gt;", "<!-- Deleted Sidebar -->")
        EndIf

        If StringInStr($FileLine, '<div id="storeArea" style="display:none;">') Then
            ;Hide these buttons
            FileWriteLine($FileCreate, $FileLine)
            FileWriteLine($FileCreate, '<div modified="20151005100728309" title="$:/config/EditToolbarButtons/Visibility/$:/core/ui/Buttons/cancel"><pre>hide</pre></div>')
            FileWriteLine($FileCreate, '<div modified="20151005100727113" title="$:/config/EditToolbarButtons/Visibility/$:/core/ui/Buttons/delete"><pre>hide</pre></div>')
            FileWriteLine($FileCreate, '<div modified="20151005100728309" title="$:/config/EditToolbarButtons/Visibility/$:/core/ui/Buttons/save"><pre>hide</pre></div>')
            FileWriteLine($FileCreate, '<div modified="20151005100728309" title="$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/control-panel"><pre>hide</pre></div>')
            FileWriteLine($FileCreate, '<div modified="20151005100728309" title="$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/new-tiddler"><pre>hide</pre></div>')
            FileWriteLine($FileCreate, '<div modified="20151005100728309" title="$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/save-wiki"><pre>hide</pre></div>')
            FileWriteLine($FileCreate, '<div modified="20151005100728309" title="$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/edit"><pre>hide</pre></div>')
            FileWriteLine($FileCreate, '<div modified="20151005100728309" title="$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/more-tiddler-actions"><pre>hide</pre></div>')
            ;Show these buttons
            FileWriteLine($FileCreate, '<div modified="20151005100728309" title="$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/home"><pre>show</pre></div>')
            FileWriteLine($FileCreate, '<div modified="20151005100728309" title="$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/close-all"><pre>show</pre></div>')
            FileWriteLine($FileCreate, '<div modified="20151005100728309" title="$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/close-others"><pre>show</pre></div>')
            $FileLine = FileReadLine($FileRead)
        EndIf
        FileWriteLine($FileCreate, $FileLine)
    WEnd
    FileClose($FileCreate)
    FileClose($FileRead)

    MsgBox(0, "Done", "File - " & $ReadOnly & " Created Successfully")
EndIf
;**** CODE ENDS
Reply all
Reply to author
Forward
0 new messages