Skip to content

Commit

Permalink
Merge PR #9 from dev (Release 1.7.5)
Browse files Browse the repository at this point in the history
  • Loading branch information
YakovL authored Jan 31, 2024
2 parents 52cd417 + 9450167 commit f49e59d
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 20 deletions.
2 changes: 1 addition & 1 deletion about.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html><html><head><title>MainTiddlyServer – A tool to enable saving of TiddlyWiki Classic and more</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link href="style.css" rel="stylesheet"></head><body><div class="wrapper"><header class="page-header"><div class="page-header__title">MainTiddlyServer</div><div class="page-header__subtitle">A tool to enable saving of TiddlyWiki Classic and more</div></header><nav class="navigation"><a class="navigation__link" href="index.html">what</a><a class="navigation__link" href="usage.html">how</a><a class="navigation__link navigation__link_currently-opened" href="about.html">context</a></nav><main><section><header id="help-feedback">Getting help and providing feedback</header><p>The best place to get in touch is <a href="https://groups.google.com/forum/#!forum/tiddlywikiclassic" target="_blank">the TiddlyWikiClassic google group</a>.
<!DOCTYPE html><html><head><title>MainTiddlyServer – A single script to enable saving of TiddlyWiki Classic and more</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link href="style.css" rel="stylesheet"></head><body><div class="wrapper"><header class="page-header"><div class="page-header__title">MainTiddlyServer</div><div class="page-header__subtitle">A single script to enable saving of TiddlyWiki Classic and more</div></header><nav class="navigation"><a class="navigation__link" href="index.html">what</a><a class="navigation__link" href="usage.html">how</a><a class="navigation__link navigation__link_currently-opened" href="about.html">context</a></nav><main><section><header id="help-feedback">Getting help and providing feedback</header><p>The best place to get in touch is <a href="https://groups.google.com/forum/#!forum/tiddlywikiclassic" target="_blank">the TiddlyWikiClassic google group</a>.
Bugs and feature requests should also become <a href="https://github.com/YakovL/MainTiddlyServer/issues" target="_blank">GH issues</a>
but usually it's better to write to the google group first.</p></section><section><header id="contributing">Contributing</header><p>Any contributions are greatly appreciated. What you can do for the project:<ul><li>help creating a minimal-efforts installer of a win/*nix bundle (server + MTS)</li><li>help creating better password protection: stronger, server- and OS-independent
(suggest a lib if you know a good one or help implement)</li><li>help implement saving for TiddlyWiki5</li><li>architecture and best practices suggestions are welcome;<br>
Expand Down
2 changes: 1 addition & 1 deletion donate.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html><html><head><title>MainTiddlyServer – A tool to enable saving of TiddlyWiki Classic and more</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link href="style.css" rel="stylesheet"></head><body><div class="wrapper"><header class="page-header"><div class="page-header__title">MainTiddlyServer</div><div class="page-header__subtitle">A tool to enable saving of TiddlyWiki Classic and more</div></header><nav class="navigation"><a class="navigation__link" href="index.html">what</a><a class="navigation__link" href="usage.html">how</a><a class="navigation__link" href="about.html">context</a></nav><main><section><header>Thank you for your support</header><p>It is always pleasant to know that software you develop brings some value to other users,
<!DOCTYPE html><html><head><title>MainTiddlyServer – A single script to enable saving of TiddlyWiki Classic and more</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link href="style.css" rel="stylesheet"></head><body><div class="wrapper"><header class="page-header"><div class="page-header__title">MainTiddlyServer</div><div class="page-header__subtitle">A single script to enable saving of TiddlyWiki Classic and more</div></header><nav class="navigation"><a class="navigation__link" href="index.html">what</a><a class="navigation__link" href="usage.html">how</a><a class="navigation__link" href="about.html">context</a></nav><main><section><header>Thank you for your support</header><p>It is always pleasant to know that software you develop brings some value to other users,
and that's the key for Open Source projects like TiddlyWiki and MainTiddlyServer.</p><p>Receiving a donation makes me know that I either saved someone's time,
relieved somebody experiencing a bug or may be even opened a new perspective for them, which is great!
If that's the case, here's a way for you to reward my efforts:
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html><html><head><title>MainTiddlyServer – A tool to enable saving of TiddlyWiki Classic and more</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link href="style.css" rel="stylesheet"></head><body><div class="wrapper"><header class="page-header"><div class="page-header__title">MainTiddlyServer</div><div class="page-header__subtitle">A tool to enable saving of TiddlyWiki Classic and more</div></header><nav class="navigation"><a class="navigation__link navigation__link_currently-opened" href="index.html">what</a><a class="navigation__link" href="usage.html">how</a><a class="navigation__link" href="about.html">context</a></nav><main><section><header>MainTiddlyServer is...</header><p>a server script that allows to save your <a href="https://classic.tiddlywiki.com/" target="_blank">TiddlyWiki Classic</a>.
<!DOCTYPE html><html><head><title>MainTiddlyServer – A single script to enable saving of TiddlyWiki Classic and more</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link href="style.css" rel="stylesheet"></head><body><div class="wrapper"><header class="page-header"><div class="page-header__title">MainTiddlyServer</div><div class="page-header__subtitle">A single script to enable saving of TiddlyWiki Classic and more</div></header><nav class="navigation"><a class="navigation__link navigation__link_currently-opened" href="index.html">what</a><a class="navigation__link" href="usage.html">how</a><a class="navigation__link" href="about.html">context</a></nav><main><section><header>MainTiddlyServer is...</header><p>a server script that allows to save your <a href="https://classic.tiddlywiki.com/" target="_blank">TiddlyWiki Classic</a>.
It is written in PHP so it can work on almost any OS (including Android) or hosting.
It won't stop working because of dropping FireFox addons support (like it is with TiddlyFox)
or any other browser security restrictions.
A minor downside is you have to setup a server for it (see the <a href="usage.html">how</a> section).</p><p>Currently versions 2.6.5-2.10.0 of TWc are supported but this range can be extended if needed.</p></section><section><header>It also...</header><ul><li>makes saving asynchronous: TW doesn't "hang" while saving;</li><li>makes saving incremental for TW v2.8.0+ which works 100+ times faster,
A minor downside is you have to setup a server for it (see the <a href="usage.html">how</a> section).</p><p>Currently versions 2.6.5-2.10.1 of TWc are supported but this range can be extended if needed.</p></section><section><header>It also...</header><ul><li>makes saving asynchronous: TW doesn't "hang" while saving;</li><li>makes saving incremental for TW v2.8.0+ which works 100+ times faster,
decreases traffic by a factor of 100+ (when used online);</li><li>allows to serve your TWs on one device (say, your phone)
and work with them on another one (say, your PC);</li><li>when served on Unix-like OS using Apache, allows to password-protect the folder with TW;</li><li>supports backups (timestamped names, same folder, controlled by TW's chkSaveBackups);</li><li>enables <a href="http://yakovl.bplaced.net/TW/STP/STP.html" target="_blank">including</a>, requests to web in some "difficult" cases;</li></ul><p>Summary of perspectives can be found <a href="about.html#perspectives">here</a>.</p></section></main><footer class="wrapper__footer">&copy; <a href="https://yakovlitvin.pro/TW/" target="_blank">Yakov Litvin</a>, 2018</footer></div></body></html>
41 changes: 29 additions & 12 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
// MainTiddlyServer
$version = '1.7.4';
$version = '1.7.5';
// MIT-licensed (see https://yakovl.github.io/MainTiddlyServer/license.html)
$debug_mode = false;

Expand Down Expand Up @@ -116,6 +116,9 @@
(forked from MTS v2.8.1.0, see https://groups.google.com/forum/#!topic/tiddlywiki/25LbvckJ3S8)
changes from the original version:
1.7.5
+ added support of TW 2.10.1 (not using new interfaces yet)
+ introduce skip_file_locking
1.7.4
+ added support of TW 2.10.0 (not using new interfaces yet)
+ support .htm, .hta files (treat the same as .html)
Expand Down Expand Up @@ -612,7 +615,9 @@ function lock_and_read_file($path) {
return $content;
}
function lock_and_write_file($path, $content) {
$saved = file_put_contents($path, $content, LOCK_EX);
$saved = Options::get('skip_file_locking') ?
file_put_contents($path, $content) :
file_put_contents($path, $content, LOCK_EX);
if(!$saved) return "MainTiddlyServer failed to save updated TiddlyWiki.\n".
"Please make sure the containing folder is accessible for writing and the TiddlyWiki can be (over)written.\n".
"Usually this requires that those have owner/group of \"www-data\" and access mode is 7** (e.g. 744) for folder and 6** for TW.".
Expand Down Expand Up @@ -711,7 +716,7 @@ function getTwVersion($wikiFileText) {
return $match;
}
define("EARLIEST_TESTED_VERSION", 20600);
define("LATEST_TESTED_VERSION", 21000);
define("LATEST_TESTED_VERSION", 21001);
function isSupportedTwVersion($versionParts) {

if(!$versionParts)
Expand Down Expand Up @@ -890,9 +895,9 @@ function showMtsPage($html, $title = '', $httpStatus = 200) {
echo '</div></body></html>';
}
function showOptionsPage() {

global $optionsLink;

$output = '<style>
.options-form__password-panel { padding: 0 1em; }
.no-password-warning { color: red; }
Expand All @@ -908,10 +913,15 @@ function togglePasswordSetting(isEnabled) {
passInputsArea.style.display = isEnabled ? "" : "none";
}
</script>';

$output .= '<form class="options-form" name="input" action="' . $optionsLink . '" method="post">' .
'<input type="hidden" name="options">';


function getOptionCheckbox($optionName, $labelHtml) {
return '<label><input type="checkbox" name="' . $optionName . '" ' .
(Options::get($optionName) ? 'checked ' : '') . '>' . $labelHtml . '</label>';
}

// workingFolder: list Options::get('dataFolders')'s names, send to further save Options 'workingFolderName'
/*$folders = Options::get('dataFolders');
$selected = Options::get('workingFolderName');
Expand All @@ -923,7 +933,7 @@ function togglePasswordSetting(isEnabled) {
//# add description: what is this location, where and how to add new ones
//# process in $_POST['options']
//# this should cause updating of the wikis dropdown.. or the latter should be removed from ?options

// wiki
$files = getListOfTwLikeHtmls(Options::getWorkingFolder());
if(is_null($files)) {
Expand All @@ -939,9 +949,9 @@ function togglePasswordSetting(isEnabled) {
}
$output .= '</select></p>';
}
$output .= '<p><label><input type="checkbox" '.(Options::get('single_wiki_mode') ? 'checked=checked' : '').
'name="single_wiki_mode">Single wiki mode (redirect from wikis to wiki page, no ?wiki=.. in URL required)</label></p>';
$output .= '<p>' . getOptionCheckbox('single_wiki_mode',
'Single wiki mode (redirect from wikis to wiki page, no ?wiki=.. in URL required)') . '</p>';

// login/password
$output .=
'<div class="options-form__password-panel">' .
Expand All @@ -962,13 +972,18 @@ function togglePasswordSetting(isEnabled) {
'</table></tbody>' .
'</div>'.
'</div>';

// memory limit
$output .= "<p>PHP memory limit: <input type='text' name='memory_limit' value='" . Options::get('memory_limit') .
"' class='memory-limit-input'>" .
" (increase if your TW is large and saving doesn't work, try values like 6 * the size of your TW;" .
" leave blank to restore the default value)</p>";

// file locking
$output .= '<p>' . getOptionCheckbox('skip_file_locking',
'Skip file locking (<a href="https://github.com/YakovL/MainTiddlyServer/issues/8">workaround</a> ' .
'for the "Exclusive locks are not supported" error)') . '</p>';

$output .= '<p><button type="submit">Save</button></p>';
$output .= '</form>';

Expand Down Expand Up @@ -1425,6 +1440,8 @@ function setOption($name, $unsetEmpty = false) {
if($_POST['memory_limit'] == $system_memory_limit)
Options::set('memory_limit', '', true);

setOption('skip_file_locking', true);

$error = Options::save();
$output = '<p>Active wiki set to ' . Options::get('wikiname') . '</p>';

Expand Down
2 changes: 1 addition & 1 deletion license.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html><html><head><title>MainTiddlyServer – A tool to enable saving of TiddlyWiki Classic and more</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link href="style.css" rel="stylesheet"></head><body><div class="wrapper"><header class="page-header"><div class="page-header__title">MainTiddlyServer</div><div class="page-header__subtitle">A tool to enable saving of TiddlyWiki Classic and more</div></header><nav class="navigation"><a class="navigation__link" href="index.html">what</a><a class="navigation__link" href="usage.html">how</a><a class="navigation__link" href="about.html">context</a></nav><main><section><header>The MIT License (MIT)</header></section><p>Copyright © 2018 Yakov Litvin</p><p>Permission is hereby granted, free of charge, to any person obtaining a copy
<!DOCTYPE html><html><head><title>MainTiddlyServer – A single script to enable saving of TiddlyWiki Classic and more</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link href="style.css" rel="stylesheet"></head><body><div class="wrapper"><header class="page-header"><div class="page-header__title">MainTiddlyServer</div><div class="page-header__subtitle">A single script to enable saving of TiddlyWiki Classic and more</div></header><nav class="navigation"><a class="navigation__link" href="index.html">what</a><a class="navigation__link" href="usage.html">how</a><a class="navigation__link" href="about.html">context</a></nav><main><section><header>The MIT License (MIT)</header></section><p>Copyright © 2018 Yakov Litvin</p><p>Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
Expand Down
5 changes: 2 additions & 3 deletions usage.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<!DOCTYPE html><html><head><title>MainTiddlyServer – A tool to enable saving of TiddlyWiki Classic and more</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link href="style.css" rel="stylesheet"></head><body><div class="wrapper"><header class="page-header"><div class="page-header__title">MainTiddlyServer</div><div class="page-header__subtitle">A tool to enable saving of TiddlyWiki Classic and more</div></header><nav class="navigation"><a class="navigation__link" href="index.html">what</a><a class="navigation__link navigation__link_currently-opened" href="usage.html">how</a><a class="navigation__link" href="about.html">context</a></nav><main><section><header>Installation []</header><ol><li><a href="index.php">download MTS</a></li><li>install a server to support PHP; Apache should be used to password-protect your TWs by means of MTS (.htaccess is used)<ul><li>on a local device, you can use: LAMP for Unix, WAMP/OpenServer for Windows,
AWebServer/Server for PHP/Palapa for Android and others</li><li>on hosting, unlikely that configuration will be needed since almost all of them support PHP
and most of them use Apache [how to check]</li><li>[troubleshoot forbidden access to write to disk, installing php modules – mostly for custom installations]</li></ul></li><li>put MTS and your TiddlyWikis into a server folder<ul><li>[how to find it]</li><li>[paranoic mode: password-protect first, add TWs afterwards]</li></ul></li><li>open MTS<ul><li>[how to figure the address]</li></ul></li><li>[either provide further instructions or put them inside MTS itself]</li></ol></section><section><header>Configuring []</header><p>[aside what's available in "?options": working folders, htaccess for restricting only MTS and auxiliary files]</p><p>If you develop or use a plugin which uses custom storage format (like some encryption plugins),
<!DOCTYPE html><html><head><title>MainTiddlyServer – A single script to enable saving of TiddlyWiki Classic and more</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link href="style.css" rel="stylesheet"></head><body><div class="wrapper"><header class="page-header"><div class="page-header__title">MainTiddlyServer</div><div class="page-header__subtitle">A single script to enable saving of TiddlyWiki Classic and more</div></header><nav class="navigation"><a class="navigation__link" href="index.html">what</a><a class="navigation__link navigation__link_currently-opened" href="usage.html">how</a><a class="navigation__link" href="about.html">context</a></nav><main><section><header>Installation</header><ol><li><a href="index.php">Download MTS</a>;</li><li>Install a server to support PHP; Apache should be used to password-protect your TWs by means of MTS (.htaccess is used).<ul><li>On a local device, you can use: LAMP for Unix, WAMP/OpenServer for Windows,
AWebServer/Server for PHP/Palapa for Android, and others;</li><li>On a hosting, it's likely that Apache and PHP are installed, which is enough.</li></ul></li><li>Put MTS and your TiddlyWikis into a server folder:<ul><li>the typical location of the server folder for Unix (Apache, Nginx) is /var/www/html (Nginx may also use /www or /html in /usr/local/nginx);</li><li>most servers allow you to configure which folder is the server folder (local servers like AWebServer do that in their interface);</li><li>for remote servers, it's recommended to open MTS and password-protect it first, and add TWs afterwards.</li></ul></li><li>Open MTS<ul><li>the URL address to open in your browser depends on the used server and its configuration, but here are some typical cases:</li><li>remote servers will usually use http(s)://your-server-ip-or-domain/;</li><li>local servers: http://localhost/, http://0.0.0.0:8080, or similar;</li><li>if you rename MTS to customName.php, add it to the address above (like http://localhost/customName.php).</li></ul></li><li>If you have questions, don't hesitate to ask (see <a href="./about.html">Getting help and ...</a>).</li></ol></section><section><header>Configuring []</header><p>[aside what's available in "?options": working folders, htaccess for restricting only MTS and auxiliary files]</p><p>If you develop or use a plugin which uses custom storage format (like some encryption plugins),
you may want to disable granulated saving to make them work properly.
This is done by either setting <code>config.options.chkAvoidGranulatedSaving = true;</code> in a plugin
or via backstage/tweak/Show unknown options interface.</p></section></main><footer class="wrapper__footer">&copy; <a href="https://yakovlitvin.pro/TW/" target="_blank">Yakov Litvin</a>, 2018</footer></div></body></html>

0 comments on commit f49e59d

Please sign in to comment.