Skip to content
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

Can savemedia be hacked to use 'files' instead of 'media' ? #94

Open
Marxsal opened this issue Jan 24, 2022 · 19 comments
Open

Can savemedia be hacked to use 'files' instead of 'media' ? #94

Marxsal opened this issue Jan 24, 2022 · 19 comments

Comments

@Marxsal
Copy link

Marxsal commented Jan 24, 2022

'Files' is used by the node.js server, and by (I think) Bob.

@buggyj
Copy link
Owner

buggyj commented Jan 24, 2022

The savemedia mechanism is through browser download, and uses 'media' as a subdir to the location of the tiddlywiki in use, therefore it is not possible to use the save with nodejs.

@Marxsal
Copy link
Author

Marxsal commented Jan 25, 2022

You misunderstand my intent. I know you can't use it with node.js. But node.js and Bob use "files". So you could download your files using media save and then later, in another session, use it with node.js or Bob. It would just work better if everyone used the same subdir for external files.

@buggyj
Copy link
Owner

buggyj commented Jan 25, 2022

Ok I now understand.

The subdir is hardcoded in the csaver macro in tiddler
/home/buggyj/Documents/dev/js/TiddlyWiki5/plugins/bj/tiddlyclip-plugin/tw5/csaver.js
i.e.
var subdir = "media";

the most obvious change would be to have a configuration file e.g

var subdir = $tw.wiki.getTiddlerText("$:/plugin/bj/tiddlyclip-plugin/tw5/media-sub-directory").trim();

however not all characters are allowed in a directory name and this varies with system. We could restrict the subdirectory to be
alphanumeric with spaces:

subdir=(subdir.match(/^[0-9 a-z]+$/))?subdir:"media";

what do you think?

@buggyj
Copy link
Owner

buggyj commented Jan 25, 2022

To be clear tiddlyclip can be used with nodejs or any other file server, it is just local saving of clips that is different.

@buggyj
Copy link
Owner

buggyj commented Jan 25, 2022

the config would better be
var subdir = $tw.wiki.getTiddlerText("$:/plugin/bj/savemedia/tw5/media-sub-directory").trim();

@buggyj
Copy link
Owner

buggyj commented Jan 25, 2022

is it 'Files' or 'files'?

@Marxsal
Copy link
Author

Marxsal commented Mar 24, 2022

Having a configuration for it would be the best. Perhaps there could be a warning about what language sets can be used.
But if that's not possible, or too inconvenient, then just being able to set it to "files" would make it cross-compatible with the other node.js products.

@buggyj buggyj transferred this issue from buggyj/savemedia Mar 24, 2022
@buggyj
Copy link
Owner

buggyj commented Mar 25, 2022

At present I am not going to handle different languages.

There needs to be a global setting of the subdir, which will be the setting for all tiddlywikis, but this should be overridden by a setting in individual tiddlywikis. Therefore there need to be a config here in the tiddlyclip plugin (local setting) and a config page created in the savemedia download (global setting). In both places the only options will be 'files' or 'media'.

@arunnbabu81
Copy link

Therefore there need to be a config here in the tiddlyclip plugin (local setting) and a config page created in the savemedia download (global setting). In both places the only options will be 'files' or 'media'.

Can this config option be added to the tiddlyclip plug in and savemedia add on

@buggyj
Copy link
Owner

buggyj commented Nov 25, 2022

I plan to implement this, but, as I am not planning to use this new feature, it is not high on my list of things to do.

@arunnbabu81
Copy link

It's for compatibility with the file upload plug in which might get into the core in the future

@arunnbabu81
Copy link

I would like this feature to be added along with the save media addon configuration option (for download location or the saving folder). This is mainly for compatibility when wiki is used in node.js mode and if files upload plug in is also used along with it. Again this is important to me since I am using relative path for displaying images within my wiki.

@buggyj
Copy link
Owner

buggyj commented Jul 16, 2023

I have added a config tiddler to enable 'files' or 'media' to be selected.

@arunnbabu81
Copy link

arunnbabu81 commented Oct 12, 2023

I have added a config tiddler to enable 'files' or 'media' to be selected.

Where is this config tiddler ?

This one right ?

image

@buggyj
Copy link
Owner

buggyj commented Oct 12, 2023

I replaced this with the savetofiles macro

@arunnbabu81
Copy link

I have added a config tiddler to enable 'files' or 'media' to be selected.

Where is this config tiddler ?

This one right ?

image

This was also working.

How to use the savetofiles macro

@buggyj
Copy link
Owner

buggyj commented Oct 13, 2023

$:/plugin/bj/savemedia/useFilesDir is available in the latest pre-release.

savetofiles macro is the same as csaver macro.

@arunnbabu81
Copy link

$:/plugin/bj/savemedia/useFilesDir

What's the use of this config tiddler. I can see that in my wiki. How to make use of it?

I guess I know how to use the savetofile macro..I will do some testing with it.

@buggyj
Copy link
Owner

buggyj commented Oct 13, 2023

if $:/plugin/bj/savemedia/useFilesDir contains 'yes' then csaver puts clips into 'files' subdir, otherwise it puts them into 'media' subdir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants