Simple php/sqlite3 adaptor

231 views
Skip to first unread message

Anjar

unread,
Apr 25, 2021, 10:24:26 AM4/25/21
to TiddlyWiki
Hi,

I've started on a very simple php/sqlite3 backbone for tiddlywiki: https://github.com/andjar/TW-sqlite3/tree/main

The main feature is perhaps that revisions are kept in the database (deleted tiddlers and edits). The tiddlers are saved to the sqlite file in three tables; tiddlers, tiddlertext, and fields. The tiddlers are assigned a UUID at first save. If the tiddler is deleted, the tiddler table will set the tiddler status to DELETED. If the text or any field is changed, the new value is added as a new row and the former version set to OUTDATED (or DELETED if the field is deleted)

Best,
Anders

Mark S.

unread,
Apr 25, 2021, 10:34:33 AM4/25/21
to TiddlyWiki
That looks interesting. Is the server in your local browser or remote? 

Added to tiddlywikilinks .

Anjar

unread,
Apr 25, 2021, 12:37:44 PM4/25/21
to TiddlyWiki
I guess both local and remote will work, but I use apache2 locally on a Chromebook. I'm not competent enough to implement robust security features, so one should take care if used with a remote server:)

Great, thanks!

TW Tones

unread,
Apr 25, 2021, 9:01:53 PM4/25/21
to TiddlyWiki
Anjar,

This is something I have wanted for ages, I am keen to get in on my cpanel hosting platform.

One thought is to use a wordpress site and use this to control the authentication etc... but write to the maria/sql db, perhaps adding user to the database.

Even if we only allowed one user at a time, wordpress could allow checkout, from within its security model. Thus permitting serial (not parallel) editing. It could be very easy to host tiddlywikis inside wordpress/php sites. This would allow team collaboration and more on a per-wiki basis without node.js solutions on the internet/intranet.

Regards
Tones

Anjar

unread,
Apr 26, 2021, 4:21:24 PM4/26/21
to TiddlyWiki
Interesting thoughts, Tones! Authentication and security are important topics, but also daunting and a bit scary

I guess you can do many of the same things with node.js as with PHP, but it seems like an interesting space to explore; for example using imap functionality to sync to email, using get to build specific tiddlywikis depending on parameters or having the tiddlers as separate files similar to node.js

Best,
Anders

TW Tones

unread,
Apr 26, 2021, 9:03:38 PM4/26/21
to TiddlyWiki
Anjar,

I have felt that WordPress could stop simultaneous editing of a tiddlywiki (with TW-receiver) on the same site, perhaps even a new post type for whole tiddlywiki's.

However if the tiddlers can be moved into a database then additional post types could be actual tiddlers, allowing multiple-editors on a per tiddler basis. 

Then one views a whole wiki in the browser which can then be downloaded and made your own. 

Regards
Tones

Mohammad Rahmani

unread,
Apr 26, 2021, 11:55:13 PM4/26/21
to tiddl...@googlegroups.com
Andres,
 Does this need the same configuration as tw-receiver?
 Is there any need to set a password also for sqlit3?

I could not find the installation? 


Best wishes
Mohammad


--
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 view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/bb2c6b4c-e3fb-4a81-8bea-cd429d7bd142n%40googlegroups.com.

Anjar

unread,
Apr 27, 2021, 10:26:46 AM4/27/21
to TiddlyWiki
@Mohammad currently, I haven't copied that part of the tw-receiver script yet because having to edit a PHP is not very user friendly, it seems much better to have the password saved in the database so that you can actually set it and change it directly from the tiddlywiki. 

It's probably also better to collect everything in a single PHP-file that can both load and save the tiddlywiki; eg. if there is no sqlite files already existing -> download and load an empty tiddlywiki with a customized tw-receiver tiddler; if a single sqlite file exist, load it; if multiple sqlite files exist, show a menu.

Best,
Anders

Mohammad Rahmani

unread,
Apr 27, 2021, 12:10:29 PM4/27/21
to tiddl...@googlegroups.com
On Tue, Apr 27, 2021 at 6:57 PM Anjar <ajar...@gmail.com> wrote:
@Mohammad currently, I haven't copied that part of the tw-receiver script yet because having to edit a PHP is not very user friendly, it seems much better to have the password saved in the database so that you can actually set it and change it directly from the tiddlywiki. 

Hi Anders,
Many thanks for clarification!

 
It's probably also better to collect everything in a single PHP-file that can both load and save the tiddlywiki; eg. if there is no sqlite files already existing -> download and load an empty tiddlywiki with a customized tw-receiver tiddler; if a single sqlite file exist, load it; if multiple sqlite files exist, show a menu.

Yes, that is correct. I tested on a Windows machine using usbwebserver and it works!

Thank you!

 

Best,
Anders

tirsdag 27. april 2021 kl. 05:55:13 UTC+2 skrev Mohammad:
Andres,
 Does this need the same configuration as tw-receiver?
 Is there any need to set a password also for sqlit3?

I could not find the installation? 


Best wishes
Mohammad


On Sun, Apr 25, 2021 at 6:54 PM Anjar <ajar...@gmail.com> wrote:
Hi,

I've started on a very simple php/sqlite3 backbone for tiddlywiki: https://github.com/andjar/TW-sqlite3/tree/main

The main feature is perhaps that revisions are kept in the database (deleted tiddlers and edits). The tiddlers are saved to the sqlite file in three tables; tiddlers, tiddlertext, and fields. The tiddlers are assigned a UUID at first save. If the tiddler is deleted, the tiddler table will set the tiddler status to DELETED. If the text or any field is changed, the new value is added as a new row and the former version set to OUTDATED (or DELETED if the field is deleted)

Best,
Anders

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/bb2c6b4c-e3fb-4a81-8bea-cd429d7bd142n%40googlegroups.com.

--
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.

Anjar

unread,
May 8, 2021, 6:07:18 PM5/8/21
to TiddlyWiki
Hi,

The scripts at https://github.com/andjar/TW-sqlite3 are now updated to also support URL parameters; eg. adding ?test=Hi to the URL will create a tiddler $:/url/test with text "Hi". A special parameter is "user". If a tiddler has field "user" containing "username", the tiddler will only be available if ?user=username

The user feature is working but further refinement. We can imagine having some sort of varying tiddler privileges; one user being the owner, some users having access to edit, others to edit only specified fields, others only to read. Another problem may then be possible title collisions across users


Best,
Anders

Reply all
Reply to author
Forward
0 new messages