Commit Graph

31 Commits

Author SHA1 Message Date
Joshua Fontany 5f74f4c2fa
Fix bug 7878: Save command (#8140)
* first pass at fixing bug 7878, needs testing

* clarify default behaviour in comment

* fix property typo, tested and works as intended

* remove debugger
2024-04-11 21:54:46 +01:00
jeremy@jermolene.com 3da3318396 Node.js: Prefer .tid format when a _canonical_uri field present
Fixes #7238
2023-02-03 19:22:43 +00:00
jeremy@jermolene.com 8ef6d78bef Filesystemadaptor: Use json format for tiddlers with fieldnames containing hash
Fixes #7144
2023-01-19 21:16:46 +00:00
Jeremy Ruston a5894946de
Extend encodeuricomponent to process additional characters (#7128)
* First commit

* Fix version number in docs

* Add code comment
2023-01-19 17:45:54 +00:00
jeremy@jermolene.com 338b7c92a2 Ensure tiddlers with fieldnames containing colons don't get saved in .tid file format
Prompted by discussion over at https://github.com/Jermolene/TiddlyWiki5/pull/5708#issuecomment-862399985
2021-06-27 21:27:57 +01:00
Joe Bordes 82ec63e711
style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
Joshua Fontany 3d608892bd
targeted fix for 5366 (#5416) 2021-03-26 08:42:31 +00:00
Joshua Fontany a2e7cc51b5
Fix 5483 & 3483 (#5504) 2021-03-26 08:39:32 +00:00
Joshua Fontany bfa062f23d
Fix filesystem (#5465) 2021-02-04 16:11:07 +00:00
Joshua Fontany 03626bc142
always test ext in tiddler title and remove it (#5329)
* always test ext in tiddler title and remove it

* patch custom ext length vulernability
2021-01-03 11:50:14 +00:00
Joshua Fontany d50f6b406e
filesystem cleaup around hook (#5276) 2020-12-14 09:50:53 +00:00
jed c1a1e272cc
Add a hook to allow modifying the the behaviour creating tiddler paths (#5267)
* Add a hook to allow modifying the the behaviour creating tiddler paths

This is needed for Bob to use the core to generate tiddler fileInfo 

I don't know if this is the best way to make the hook, but it works for what I need

* update th-make-tiddler-path arguments

the value is the current path, the parameter passed in is the original unmodified path so it is available to subsequent hooks
2020-12-13 23:24:23 +00:00
Joshua Fontany c3e34b469c
typo (#5221) 2020-12-06 22:59:48 +00:00
Joshua Fontany b0f6d50b60
fix filesystem bugs (#5213) 2020-12-06 09:41:03 +00:00
Joshua Fontany c6bb783308
Fix filesystem regression (#5176)
* $:/config/OriginalTiddlerPaths if no filters match

* fixed & docs updated

* tested with tiddlywiki.files & tw.com edition

* typos

* originalpath to options, propigate isEditableFile

* syntax cleanup
2020-12-02 09:47:51 +00:00
Joshua Fontany dde4182830
Fix filesystem adaptor (#5113)
* ignore .env

testing new implementation

almost there

closer

bug, desyncing

fixed

final testing

final testing

cleanup

cleanup

* isEditableFile flow fixed

* removed `basepath` logic

* callback to delete title from $tw.boot.files

* comment fix

* have syncer delete from boot.files

* syntax

* bugfix: error on missing directory

* bugifx

* remove !draft check

* fix relative filepaths

* cleanup

* cleanup !draft

* catch undefined filepaths in deleteTiddlerFile()

* typo

* whitelist wiki dir, encodeURIComponent otherwise

* test for wikiPath, not wikiPath/tiddlers

* don't need to .normailze()

* whitelist wiki directory, move cleanup to util

* use cleanup util & fail EPERM & EACCESS gracefully

* comments

* final bugs fixed

* improved sync error
2020-11-30 22:31:48 +00:00
jeremy@jermolene.com 13b8281f6b $tw.utils.copyDirectory: Ensure directories don't overlap 2020-04-27 15:00:06 +01:00
jeremy@jermolene.com d6ee700bca Fix $tw.utils.getSubdirectories() 2020-04-21 21:21:38 +01:00
jeremy@jermolene.com 678e25f510 makelibrary command should skip non-directories
Fixes #4583
2020-04-20 11:47:54 +01:00
Jeremy Ruston 86286c6fce Don't generate filenames starting with a period 2019-07-09 12:22:52 +01:00
jed c202ef4201
include wiki in options sent to generateTiddlerFilePath
This adds options.wiki to the object sent to the generateTiddlerFilePath

The function generateTiddlerFilePath can take a wiki in the options object, but generateTiddlerFileInfo doesn't pass the wiki to it.
2019-07-03 12:11:10 +02:00
Jeremy Ruston ac1d5b828d Fix regression in 7fcd2f132
Previously we saved tiddlers as .tid files using this template that explicitly excludes the "bag" field:

https://github.com/Jermolene/TiddlyWiki5/blob/master/core/templates/tid-tiddler.tid

Now we generate both .tid and .json files programmatically, and so we have to explicitly exclude the bag field
2019-06-10 17:52:26 +01:00
Jermolene 373afd72c8 Add savewikifolder command
Makes it much easier to convert a TiddlyWiki HTML file into a full wiki folder.
2019-04-14 12:04:00 +01:00
Jermolene 7fcd2f132e Filesystemadaptor: Improve handling of JSON files
Fixes #3875

* Use .json files (instead of .tid) for any tiddler whose fields contain values that can't be stored as a .tid file
* Save application/json tiddlers as .json files
* Refactor most of the file handling as re-usable utilities
2019-04-13 14:59:44 +01:00
Jermolene bacf500d50 Avoid deprecated new Buffer() usage
See https://alexatnet.com/node-js-10-important-changes/#buffer-1

> Uses of new Buffer() and Buffer() outside of the node_modules directory will now emit a runtime deprecation warning.

More details: https://nodejs.org/api/buffer.html#buffer_buffer_from_buffer_alloc_and_buffer_allocunsafe
2018-06-13 11:22:17 +01:00
nome 1ae428e323 Make tiddler file paths configurable (#2379)
When saving new tiddlers on node.js, allow the user to override the path of the
generated .tid file. This is done by creating a tiddler
$:/config/FileSystemPaths which contains one or more filter expressions, one
per line. These filters are applied in turn to the tiddler to be saved, and
the first output produced is taken as a logical path relative to the wiki's
tiddlers directory. Any occurences of "/" in the logical path are replaced with
the platform's path separator, the extension ".tid" is appended, illegal
characters are replaced by "_" and the path is disambiguated (if necessary) in
order to arrive at the final tiddler file path. If none of the filters matches,
or the configuration tiddler does not exist, fall back to the previous file
naming scheme (i.e. replacing "/" by "_").

This implies we will now, for tiddlers matching the user-specified filters,
create directory trees below the tiddlers directory. In order to avoid
cluttering it with empty directory trees when renaming or removing tiddlers, any
directories that become empty by deleting a tiddler file are removed
(recursively).

Benefits of this configuration option include the ability to organize git
repositories of TiddlyWikis running on node.js, ability to replace characters
that cause trouble with particular operating systems or workflows (e.g. '$' on
unix) and the ability to replicate tiddler "paths" in the filesystem (by
including a filter like "[!has[draft.of]]") without forcing such a (potentially
problematic) change on all users.
2016-04-25 08:36:32 +01:00
Jermolene 2abc5dee78 Improve buffer allocation for copying files in utils/filesystem.js 2014-12-18 21:08:14 +00:00
Jermolene 51db48acc9 Fix checking for non-empty folders in initcommand 2014-12-10 22:14:27 +00:00
Jermolene 3a67fdb768 Obeisance to JSHint for core modules
There are still some warnings about making functions in a loop, but
I’ll fix those as a separate pull request because the fixes are more
than typographic errors.
2014-08-30 20:44:26 +01:00
Jermolene f7e50e0950 Add `--build` command
First pass at the build system described in #356.

To test it, move to a new, empty directory and try `tiddlywiki
editions/tw5.com --verbose --build`
2014-04-25 22:41:59 +01:00
Jermolene f3930ad69c Add init command to initialise a wiki folder
Fixes #362
2014-02-23 22:58:17 +00:00