-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Hide "save to tiddlyhost" button if user is not logged in for Classic #328
Conversation
Nice! I only don't understand why adding an extra |
Yeah, you might be right. Will give that a try. |
Using a tiddler provides a nice way for the server to communicate the status to the TW javascript, and it also matches the was it works for TW5. |
Hi @simonbaird, any blockers here? Can I help somehow? |
Sorry for the wait. I'm intending to get back to this soon. |
3225c84
to
66003ba
Compare
I made some changes here. I realized that we can't force window.readOnly to false because then it breaks being able to edit a downloaded tiddler. I also remembered that there's a cookie setting called Anyway, this new version respects the |
It occurred to me that we could maybe remove the ThostUploadPlugin entirely when user is downloading the site for local use. I probably won't explore that idea further right now, but maybe it's worthwhile considering in future. |
@YakovL FYI. I'm happy to merge and deploy this, but interested in your thoughts on the respecting the FWIW, the old Tiddlyspot used to ignore that and always set window.readonly to false. |
Another idea is to let the site owner choose if they want to respect the user's (i.e. the site reader's) |
Hello Simon, thanks for the update. Here's what I think (looking at the thost_upload_plugin.js.erb):
|
I think it makes sense to me. I'm putting I want to double check the downloaded classic files don't have TiddlyHostIsLoggedIn set. I think tested that previously, but it was a while ago. I'll probably merge and deploy this soon. We can always tweak it later if it's not quite right. Thanks for the thoughtful reviews, and sorry for the long wait. |
48262b4
to
72f7d74
Compare
If you're viewing a TiddlyWiki Classic site isn't your own, or is your own but you're not logged in, previously the edit buttons would be shown regardless of the value of the chkHttpReadOnly "advanced options" cookie. Now, the chkHttpReadOnly value will be respected, unless the site owner is currently logged in. The way it works is to inject a shadow tiddler with content set to either 'yes' or 'no', then read the value of that tiddler in the upload plugin. This is similar to the TiddlyWiki5 method, except in TiddlyWiki5 the tiddler used is '$:/status/IsLoggedIn'. Closes issue #326.
There are some pros and cons to this, e.g. with this change, a user with an expired login session might be confused about why they can no longer save. On the other hand showing the "save to tiddlyhost" button when a save is not possible is also potentially confusing. Anyway, let's try it this way and see how we like it. Closely related to the changes in the previous commit for issue #326.
I realized this doesn't actually hide the edit buttons for not logged in users, unless the person viewing the site has manually set their chkHttpReadOnly to true. Do you think we should override that behavior? It would be the same result as making the default value for chkHttpReadOnly true instead of false. |
Let's merge this anyhow - we can discuss changing the default chkHttpReadOnly later. |
72f7d74
to
58aa414
Compare
Hello Simon, I'm afraid we now have a major issure here: I've just logged in tiddlyhost.com, opened responsive.tiddlyhost.com and it's not editable. Console shows that
Why? PS Ok, the issue not so major, I guess. I only have it with https://responsive.tiddlyhost.com/, but not with any other TW (public or private). |
My mistake, I thought it was false by default.
I can't reproduce this. It's possible your browser is caching the site. Ensure you're logged in and try a Shift+Reload which ought to force the browser to not use the cache. |
Yeah, you're right, it was cache. Haven't thought about that as I was testing in another browser (but the page got cached when I opened it initially, before logging in). Shouldn't Tiddlyhost provide the no cache headers though? Especially when one is logged in. In MainTiddlyServer, I'm using Should I create a new issue maybe? |
Yeah, figuring out some smarter caching directives seems like a good idea. It could also check the updated timestamp and give a "304 not modified" if there are really no changes. This way browsers can still cache when/if it makes sense to. |
Right, if you point where the current headers are set, I'll be able to suggest some improvements, I guess |
This rolls back the behavior change from #328, but provides a way to bring it back if you prefer it, by setting up a window.bidix object in another tiddler tagged with "systemConfig". As mentioned in the comments, the motivation for doing this is that hiding the "upload to tiddlyhost" button causes usability problems for TW classic users.
This rolls back the behavior change from #328, but provides a way to bring it back if you prefer it, by setting up a window.bidix object in another tiddler tagged with "systemConfig". As mentioned in the comments, the motivation for doing this is that hiding the "upload to tiddlyhost" button causes usability problems for TW classic users.
Inject a shadow tiddler with content set to either 'yes' or 'no', then look for that shadow tiddler in the upload plugin.
WIP, but it's generally working.
This is for #326 fyi @YakovL .