TiddlyLock - a simple multi-user TiddlyWiki

546 views
Skip to first unread message

weta

unread,
Apr 28, 2007, 1:54:44 PM4/28/07
to TiddlyWiki
Hi

I'm sure this has probably been done before, but I've only just
recently found TiddlyWiki and couldn't find a quick/easy answer to my
problem.

I wanted a TW with no server-side scripts or database, and share it on
a network drive but allow multi-user access with edit-locking.

So I made TiddlyLock.
TiddlyLock uses the small lock-file method of preventing updates by
other users. The lock file is created/updated when a user edits a
tiddler, and it's cleared when they save (or autosave). I the TW is
locked then the other user can still view the contents - they just
have to wait until it's unlocked.

And it seems to work quite nicely so far! ;)

I did it to satisfy a specific need - a small group of developers,
adding hints and tips to a common scrapbook as they discover them - so
it's not high usage and it doesn't require strong security (we're a
trusting bunch). Users are identified by a user/password combination,
but the password is not encrypted or obfuscated in any way. I'm sure
it wouldn't be too hard to do though, I just don't need to right now.

So, take a look at TiddlyLock and let me know what you think!
I have posted it at http://www.minormania.com/tiddlylock/tiddlylock.html

Cheers
Richard

pari...@gmail.com

unread,
Apr 28, 2007, 2:45:52 PM4/28/07
to TiddlyWiki
Hi,

It seems there is a problem: only part of the "raw" code appears in
the browser?
I am using Firefox
Cheers,
JCG

Simon Baird

unread,
Apr 28, 2007, 9:49:26 PM4/28/07
to Tiddl...@googlegroups.com
The url doesn't work for me either.
--
Simon Baird <simon...@gmail.com>

weta

unread,
Apr 30, 2007, 3:26:24 AM4/30/07
to TiddlyWiki
That's odd, it works fine for me from both work and at home, using
both IE6 and Firefox 2.0.
I just did a Save As on the link and compared the saved file against
my local original and it's exactly the same.
Does the link work for you just clicking it - i.e. does it work in
read-only mode on the web server?
Not sure what you mean by raw code - you mean the HTML?

Cheers
Richard


On Apr 29, 2:49 am, "Simon Baird" <simon.ba...@gmail.com> wrote:
> The url doesn't work for me either.
>

> On 4/29/07, weta <rhob...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi
>
> > I'm sure this has probably been done before, but I've only just
> > recently found TiddlyWiki and couldn't find a quick/easy answer to my
> > problem.
>
> > I wanted a TW with no server-side scripts or database, and share it on
> > a network drive but allow multi-user access with edit-locking.
>
> > So I made TiddlyLock.
> > TiddlyLock uses the small lock-file method of preventing updates by
> > other users. The lock file is created/updated when a user edits a
> > tiddler, and it's cleared when they save (or autosave). I the TW is
> > locked then the other user can still view the contents - they just
> > have to wait until it's unlocked.
>
> > And it seems to work quite nicely so far! ;)
>
> > I did it to satisfy a specific need - a small group of developers,
> > adding hints and tips to a common scrapbook as they discover them - so
> > it's not high usage and it doesn't require strong security (we're a
> > trusting bunch). Users are identified by a user/password combination,
> > but the password is not encrypted or obfuscated in any way. I'm sure
> > it wouldn't be too hard to do though, I just don't need to right now.
>
> > So, take a look at TiddlyLock and let me know what you think!

> > I have posted it athttp://www.minormania.com/tiddlylock/tiddlylock.html
>
> > Cheers
> > Richard
>
> --
> Simon Baird <simon.ba...@gmail.com>- Hide quoted text -
>
> - Show quoted text -

Simon Baird

unread,
Apr 30, 2007, 7:57:38 AM4/30/07
to Tiddl...@googlegroups.com, weta
It's weird. See attached. I did a view source in FF1.5 and it looks correct. I wonder if the -- in the following is causing FF to bork. The syntax highlighting seems to imply this. I'm going to upgrade to FF2.0 now anyway.


  -- all TiddlyLock objects are prefixed with "TL"


--
Simon Baird <simon...@gmail.com>
tl.GIF

weta

unread,
Apr 30, 2007, 9:44:23 AM4/30/07
to TiddlyWiki
Ahhhh OK, I see. Thanks for letting me know.

I must have added that comment after I last tested it with Firefox -
IE6 is (unfortunately) the corporate standard so I end up doing most
work in it. It looks like IE6 is ignoring the "--" at the start of the
line whilst Firefox appears to think it marks the end of the comment
section. I've removed the two dashes, re-uploaded and tested it in
Firefox and IE6. It's all good.

You might have to Shift-clik on the link to force a cache refresh and
load the new version

Cheers
Richard

On Apr 30, 12:57 pm, "Simon Baird" <simon.ba...@gmail.com> wrote:
> It's weird. See attached. I did a view source in FF1.5 and it looks correct.
> I wonder if the -- in the following is causing FF to bork. The syntax
> highlighting seems to imply this. I'm going to upgrade to FF2.0 now anyway.
>

> -- all TiddlyLock objects are prefixed with "TL"
>

> Simon Baird <simon.ba...@gmail.com>
>
> tl.GIF
> 72KViewDownload- Hide quoted text -

sean...@gmail.com

unread,
Apr 30, 2007, 11:23:16 AM4/30/07
to TiddlyWiki
Looks cool.. .but why didn't you make it a plugin instead of hard-
wiring it into the tiddlywiki?

weta

unread,
Apr 30, 2007, 11:40:23 AM4/30/07
to TiddlyWiki
Good point.
The main reason is because I haven't got my head around plugins yet!
I'm very new to the whole TiddlyWiki thing and didn't stop to learn
about plugins and macros before attacking the JavaScript :)
I'll take a look at plugins and see if I can transfer the code. It
would definitely be a lot nicer if TiddlyLock was a plugin...

Cheers
Richard

> > > - Show quoted text -- Hide quoted text -

dawn ahukanna

unread,
Apr 30, 2007, 3:19:24 PM4/30/07
to Tiddl...@googlegroups.com

weta

unread,
May 1, 2007, 6:33:35 AM5/1/07
to TiddlyWiki
Wow, that was easy :D

I've converted my changes into a plugin and it can now be imported
into your own TiddlyWiki with ImportTiddlers.
Use the following link as the source http://www.minormania.com/tiddlylock/tiddlylock.html

TiddlyLockPlugin is completely self-contained, adding a Password
option to the OptionsPanel. Simply enter a password and locking and
unlocking is done automatically as required.

If another user has locked the TiddlyWiki for editing, you will be
notified of the name of the user. Once they have finished theire
edits, simply reload the TiddlyWiki to see the changes they have made
and enable edits again.

Please let me know if you find any issues with it!

Cheers
Richard

Simon Baird

unread,
May 1, 2007, 6:18:38 PM5/1/07
to Tiddl...@googlegroups.com
Sometimes I accidentally have the same TW open in two browser tabs or windows. Can TiddlyLock help prevent me from overwriting my file in that case? If not then it would be worth considering that case also.
--
Simon Baird <simon...@gmail.com>

weta

unread,
May 2, 2007, 2:49:48 AM5/2/07
to TiddlyWiki
Hi

Yes, TiddlyLock can help, but not 100%. The problem is that the
options for username and password are stored in cookies so if you have
two IE browser windows open on the same TiddlyWiki then the locking
won't work. If the TiddlyWiki is open in two different browsers, or
browsers that store cookies in their own sessions, then TiddlyLock
will work fine.

Cheers
Richard

On May 1, 11:18 pm, "Simon Baird" <simon.ba...@gmail.com> wrote:
> Sometimes I accidentally have the same TW open in two browser tabs or
> windows. Can TiddlyLock help prevent me from overwriting my file in that
> case? If not then it would be worth considering that case also.
>

> On 5/1/07, weta <rhob...@gmail.com> wrote:
>
>
>
>
>
> > Wow, that was easy :D
>
> > I've converted my changes into a plugin and it can now be imported
> > into your own TiddlyWiki with ImportTiddlers.
> > Use the following link as the source
> >http://www.minormania.com/tiddlylock/tiddlylock.html
>
> > TiddlyLockPlugin is completely self-contained, adding a Password
> > option to the OptionsPanel. Simply enter a password and locking and
> > unlocking is done automatically as required.
>
> > If another user has locked the TiddlyWiki for editing, you will be
> > notified of the name of the user. Once they have finished theire
> > edits, simply reload the TiddlyWiki to see the changes they have made
> > and enable edits again.
>
> > Please let me know if you find any issues with it!
>
> > Cheers
> > Richard
>
> --

> Simon Baird <simon.ba...@gmail.com>

Martin Budden

unread,
May 7, 2007, 2:56:07 AM5/7/07
to Tiddl...@googlegroups.com
Richard,

great plugin, and something that quite a few people have asked for in the past.

I have some suggested improvements to the way you override functions:
instead of copying the body of the old function into the new function
you can, at runtime, create a copy of the old function and then call
it using the apply keyword. This has two advantages:

i) your code is more compact
ii) your code is more future-proof: it automatically reflects any
changes in the overridden functions

I'm particularly interested in (ii), since 2.2 is coming out soon, and
has made some changes in some of the areas you have overridden. A
couple of examples will clarify my meaning:

TiddlyLock = {}; // TiddlyLock 'namespace'

//...

//
// OVERRIDE cancelTiddler()
//
TiddlyLock.cancelTiddler = cancelTiddler;
config.commands.cancelTiddler.handler = function(event,src,title)
{
var ret = TiddlyLock.cancelTiddler.apply(this,arguments);
TLUnlock();
return ret;
};

//
// OVERRIDE saveChanges()
//
TiddlyLock.saveChanges = saveChanges;
saveChanges = function(onlyIfDirty)
{
TLUnlock();
TiddlyLock.saveChanges.apply(this,arguments);
};

The above pattern can be applied to all your function overrides. (Note
the above code is untested.)

Martin

weta

unread,
May 8, 2007, 8:57:23 AM5/8/07
to TiddlyWiki
Thanks Martin, that's a much nicer solution. I didn't know about the
apply() method before.
I've changed TiddlyLock to use the apply() function as you
suggested :)
I only had to make a small change to your code make it work :
e.g. TiddlyLock.editTiddler = config.commands.editTiddler.handler;
The copy of the overridden method had to be at the handler level
rather than the parent.

In the meantime I have discovered a timing issue that needs to be
fixed - If two users load the TiddlyWiki at the same time and then
one edits it and saves all changes, then the other user edits it, the
second user will not be told of the changes and the TiddlyWiki will
not be locked. This means that changes by the first user will be lost
if the second user edits the same tiddler. I'm looking at fixing this
now and will post a new version soon.

Until then, please take a look at version 1.0.1 which is available
from the same link as before.

Cheers!
Richard

CFisch

unread,
May 9, 2007, 1:39:27 PM5/9/07
to TiddlyWiki
This is a great feature! Just what I need to implement a multi-user
shared TiddlyWiki amongst
members of a small group collaboration.

Thanks Richard, and to the rest of you guys as well!

cheers,
Charlie

weta

unread,
May 10, 2007, 10:59:26 AM5/10/07
to TiddlyWiki
I have now implemented a timestamp locking mechanism which makes
TiddlyLock MUCH BETTER!

Not only does it do away with the need for a 'password' to help
identify users but it also fixes the problem identified by Simon Baird
where multiple tabs/windows of the same browser could edit the same
TiddlyWiki at the same time.

So, I think TiddlyLock is ready for some serious use at last !8^D

I have tested it using both Firefox 2.0 and IE6 at the same time with
multiple windows and tabs all accessing the same TiddlyWiki - and the
locking mechanism works a treat.

Try it for yourself - import the TiddlyLockPlugn from here:-
http://www.minormania.com/tiddlylock/tiddlylock.html

Cheers
Richard Hobbis

FND

unread,
May 11, 2007, 2:31:37 AM5/11/07
to Tiddl...@googlegroups.com
> I have now implemented a timestamp locking mechanism which makes
> TiddlyLock MUCH BETTER!

Seems to work great - thanks a lot for this!!
(IMHO, it should be considered to include this in the core code, simply
to prevent the multiple tabs/windows issue.)


-- F.

jyorraku

unread,
Jun 7, 2007, 7:26:11 PM6/7/07
to TiddlyWiki
Thank you for this great plugin. I've implemented a TW on our network
drive, and it's working like a charm.

I did notice, however, that whenever I turn on AutoSave that people
get locked out, even if the same person is using it. It does that
SavesChanges notice but it doesn't say it's unlocked. Is that because
I have too many plugins or does the lock not work with AutoSave?

On May 10, 7:59 am, weta <rhob...@gmail.com> wrote:
> I have now implemented a timestamp locking mechanism which makesTiddlyLockMUCH BETTER!


>
> Not only does it do away with the need for a 'password' to help
> identify users but it also fixes the problem identified by Simon Baird
> where multiple tabs/windows of the same browser could edit the same
> TiddlyWiki at the same time.
>

> So, I thinkTiddlyLockis ready for some serious use at last !8^D


>
> I have tested it using both Firefox 2.0 and IE6 at the same time with
> multiple windows and tabs all accessing the same TiddlyWiki - and the
> locking mechanism works a treat.
>

> Try it for yourself - import the TiddlyLockPlugn from here:-http://www.minormania.com/tiddlylock/tiddlylock.html

jyorraku

unread,
Jun 12, 2007, 5:07:50 PM6/12/07
to TiddlyWiki
> In the meantime I have discovered a timing issue that needs to be
> fixed - If two users load the TiddlyWiki at the same time and then
> one edits it and saves all changes, then the other user edits it, the
> second user will not be told of the changes and the TiddlyWiki will
> not be locked. This means that changes by the first user will be lost
> if the second user edits the same tiddler. I'm looking at fixing this
> now and will post a new version soon.

Was this fixed in 1.0.2? I'm still getting the hang of the code, but
I thought I saw a 'reload' in there somewhere. It didn't appear to
work when I installed it, but then I have a gazillion plugins so I
don't know if it's my TW.

weta

unread,
Jun 19, 2007, 10:19:07 AM6/19/07
to TiddlyWiki
On Jun 7, 11:26 pm, jyorraku <jyorr...@gmail.com> wrote:
> Thank you for this great plugin. I've implemented a TW on our network
> drive, and it's working like a charm.

Pleased to hear it :D

> I did notice, however, that whenever I turn on AutoSave that people
> get locked out, even if the same person is using it. It does that
> SavesChanges notice but it doesn't say it's unlocked. Is that because
> I have too many plugins or does the lock not work with AutoSave?

I have noticed a lock-out problem on occasion too although I haven't
tracked down exactly what's happening. I THINK a condition is
occurring where the TW is being closed before the lock file is updated
to remove the Locked By name. I'll take a closer look soon. In the
meantime the workaround is to simply delete the lock file manually.

Cheers
Richard

weta

unread,
Jun 19, 2007, 10:27:13 AM6/19/07
to TiddlyWiki

Yes this issue was fixed in 1.0.2 when I implemented timestamp/name
locking instead of using name/password.

I'm not sure what you're referring to by reload but if the TW is open
in two browsers and one person edits & saves it then the other tries
to edit it, the second user will get a message saying they have to
reload the TW before editing.

If any of your plugins add extra functions that bypass or also modify
the standard functions (such as a save&close toolbar button) then
there may be problems. TiddlyLock was coded without any other 'extra
functionality' type plugins installed so I can't guarantee that it'll
play nicely with everything. Please let me know if you find a specific
plugin that conflicts with TiddlyLock and I'll try to make it play
nice.

Cheers
Richard


Kashgarinn

unread,
Jun 20, 2007, 7:25:06 AM6/20/07
to TiddlyWiki
The thing works nicely.. it's a wonderful plugin, thank you :)

K.

On Jun 19, 2:27 pm, weta <rhob...@gmail.com> wrote:
> On Jun 12, 9:07 pm, jyorraku <jyorr...@gmail.com> wrote:
>
> > > In the meantime I have discovered a timing issue that needs to be
> > > fixed - If two users load the TiddlyWiki at the same time and then
> > > one edits it and saves all changes, then the other user edits it, the
> > > second user will not be told of the changes and the TiddlyWiki will
> > > not be locked. This means that changes by the first user will be lost
> > > if the second user edits the same tiddler. I'm looking at fixing this
> > > now and will post a new version soon.
>
> > Was this fixed in 1.0.2? I'm still getting the hang of the code, but
> > I thought I saw a 'reload' in there somewhere. It didn't appear to
> > work when I installed it, but then I have a gazillion plugins so I
> > don't know if it's my TW.
>
> Yes this issue was fixed in 1.0.2 when I implemented timestamp/name
> locking instead of using name/password.
>
> I'm not sure what you're referring to by reload but if the TW is open
> in two browsers and one person edits & saves it then the other tries
> to edit it, the second user will get a message saying they have to
> reload the TW before editing.
>
> If any of your plugins add extra functions that bypass or also modify
> the standard functions (such as a save&close toolbar button) then

> there may be problems.TiddlyLockwas coded without any other 'extra


> functionality' type plugins installed so I can't guarantee that it'll
> play nicely with everything. Please let me know if you find a specific

> plugin that conflicts withTiddlyLockand I'll try to make it play
> nice.
>
> Cheers
> Richard

weta

unread,
Jun 20, 2007, 5:07:23 PM6/20/07
to TiddlyWiki
Hi all

I have just updated TiddlyLock to version 1.0.3
This fixes a locking problem that occured when a user navigated away
from the TW or closed the browser whilst changes were outstanding.
This was keeping the TW locked, which is I think the cause of the
problem reported by jyorraku above.

Download the whole TW or import TiddlyLockPlugin from the usual
location, i.e.
http://www.minormania.com/tiddlylock/tiddlylock.html

NOTE: This file now uses the latest version (2.2.4) of the TW core
code

Cheers :D
Richard

weta

unread,
Jul 2, 2007, 4:44:45 PM7/2/07
to TiddlyWiki
Hi there

Sorry, my website has been offline for a few days (the DNS settings
got screwed up) and the file was unavailable.

It's fixed now and I've updated TiddlyLock to version 1.0.4 and it is
now compatible with the MPTW double functions of Done/Close and Cancel/
Close.

Please let me know if you find any issues!

Cheers
Richard

Reply all
Reply to author
Forward
0 new messages