TiddlyWiki / TiddlyWiki5

A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
https://tiddlywiki.com/
Other
8.05k stars 1.19k forks source link

[BUG] Get more plugins window can not be opened #4570

Closed jeffrey4l closed 4 years ago

jeffrey4l commented 4 years ago

Describe the bug

After upgrade to 5.1.22, the Get more plugins window can not be opened/loaded.

I can not find clear error message in devtools and command line logs.

To Reproduce

Steps to reproduce the behavior:

  1. Go to ControlPanel
  2. Click on Plugins
  3. Click on Get more plugins
  4. See error

Expected behavior

Can open the plugins list page

Screenshots

138

Desktop (please complete the following information):

Start by

/usr/bin/tiddlywiki --listen port=8181 "root-tiddler=$:/core/save/lazy-images"

Tiddlywiki.info

{
    "plugins": [
        "tiddlywiki/blog",
        "tiddlywiki/codemirror",
        "tiddlywiki/codemirror-autocomplete",
        "tiddlywiki/codemirror-closebrackets",
        "tiddlywiki/codemirror-closetag",
        "tiddlywiki/codemirror-fullscreen-editing",
        "tiddlywiki/codemirror-keymap-vim",
        "tiddlywiki/codemirror-mode-css",
        "tiddlywiki/codemirror-search-replace",
        "tiddlywiki/d3",
        "tiddlywiki/filesystem",
        "tiddlywiki/highlight",
        "tiddlywiki/internals",
        "tiddlywiki/jszip",
        "tiddlywiki/katex",
        "tiddlywiki/markdown",
        "tiddlywiki/menubar",
        "tiddlywiki/pluginlibrary",
        "tiddlywiki/railroad",
        "tiddlywiki/tiddlyweb"
    ],
    "themes": [
        "tiddlywiki/vanilla",
        "tiddlywiki/snowwhite"
    ],
    "build": {
        "renderfull": [
            "--rendertiddler", "$:/core/save/all", "index_full.html", "text/plain"
        ],
        "render": [
            "--rendertiddler", "$:/core/save/lazy-images", "index_without_img.html", "text/plain"
        ],
        "index": [
            "--rendertiddler",
            "$:/core/save/all",
            "index.html",
            "text/plain"
        ],
        "empty": [
            "--rendertiddler",
            "$:/core/save/all",
            "empty.html",
            "text/plain",
            "--rendertiddler",
            "$:/core/save/all",
            "empty.hta",
            "text/plain"
        ],
        "externalimages": [
            "--savetiddlers",
            "[is[image]]",
            "images",
            "--setfield",
            "[is[image]]",
            "_canonical_uri",
            "$:/core/templates/canonical-uri-external-image",
            "text/plain",
            "--setfield",
            "[is[image]]",
            "text",
            "",
            "text/plain",
            "--rendertiddler",
            "$:/core/save/all",
            "externalimages.html",
            "text/plain"
        ],
        "static": [
            "--rendertiddler",
            "$:/core/templates/static.template.html",
            "static.html",
            "text/plain",
            "--rendertiddler",
            "$:/core/templates/alltiddlers.template.html",
            "alltiddlers.html",
            "text/plain",
            "--rendertiddlers",
            "[!is[system]]",
            "$:/core/templates/static.tiddler.html",
            "static",
            "text/plain",
            "--rendertiddler",
            "$:/core/templates/static.template.css",
            "static/static.css",
            "text/plain"
        ]
    },
    "config": {
        "retain-original-tiddler-path": true
    }
}
linonetwo commented 4 years ago

I had the same problem before, I have installed Kookma plugin library and main plugin library.

But after the upgrade, only the Kookma plugin library remains.

So I have to recreate the main plugin library by hand. You can do that too.

Just add a tiddler with title $:/config/OfficalPluginLibrary and tag $:/tags/PluginLibrary and a caption Offical Plugin Library and a url https://tiddlywiki.com/library/v5.1.22/index.html and text The official TiddlyWiki plugin library at tiddlywiki.com. Plugins, themes and language packs are maintained by the core team..

Then the problem will be solved.

linonetwo commented 4 years ago

But it is still weird that upgrading npm package tiddlywiki will remove the OfficalPluginLibrary

jeffrey4l commented 4 years ago

Your solution works, thanks a lot.

cba85 commented 4 years ago

Your solution works for me too, @linonetwo! Thanks!

I've fixed the bug by copying the /tiddlers/$__config_OfficalPluginLibrary.tid file of the official Tiddlywiki repository in my local Tiddlywiki project.

$__config_OfficalPluginLibrary.tid:

title: $:/config/OfficialPluginLibrary
tags: $:/tags/PluginLibrary
url: https://tiddlywiki.com/library/v5.1.22/index.html
caption: {{$:/language/OfficialPluginLibrary}}

{{$:/language/OfficialPluginLibrary/Hint}}
KendrickLamarck commented 4 years ago

This seems to be intentional, but communicated poorly. The present $:/config/OfficalPluginLibrary tiddler says

(This core tiddler is overridden by the tiddlyweb plugin to prevent users from installing official plugins via control panel. Instead they should be installed by editing tiddlywiki.info in the root of the wiki folder)

which I'm fine with, but upon clicking Get more plugins one should be presented with this message instead of a blank window.

linonetwo commented 4 years ago

@KendrickLamarck Oh, I didn't know that!

But I think clicking button to upgrade and install plugin is more comfortable for me, compare to manually download things, extract zip and put into the folder and edit config file...

KendrickLamarck commented 4 years ago

@linonetwo Are you talking about plugins from the official tiddlywiki/ plugin library? Because in that case, no downloading or unzipping is required. Simply edit the config file, start the server and the plugins will be there.

Jermolene commented 4 years ago

Thanks everyone, and sorry for the confusion. As @KendrickLamarck says, this is intentional. When using the client-server configuration plugins from the official plugin library should be installed in tiddlywiki.info. Using the browser-based plugin installer means that the plugin is installed as a regular tiddler, and won't be upgraded when the TW installation is upgraded.

I'll have a look at making a warning message visible.

linonetwo commented 1 year ago

Today another user get confused by this, he struggles with installing codemirror from the official library for 1.5 hours.

Normal users don't know about what JSON is, and editing fields in the .info file is a pain for them. Also editing this JSON file ask them to know about the plugin's id.

I hope we can re-enable this feature, so people using other editions can enjoy CPL style (or obsidian style) "click to enable plugin". (I have re-enable this feature in TidGi's default edition, so TidGi user usually won't have this problem. And I feel easier introducing TidGi instead of introducing TiddlyWiki itself to normal non-technical new users, this is one of the reasons.)

Jermolene commented 1 year ago

Hi @linonetwo the difficulty of finding and installing plugins under Node.js is definitely problematic.

It's not easy to fix it, though. The UI in control panel is entirely based around downloading tiddlers containing the plugins, and wouldn't be easy to adapt. On the backend, I think plugin installation needs to be somehow gated as an admin function. (If I'm running a Node.js wiki to which I have given a user write access I don't necessarily want them to be able to install new plugins on the server).

The direction I'd like to go is to add support for multiple wikis to the Node.js configuration. The current default wiki would be reclassified as the admin wiki, and would have the necessary powers to be able to configure the plugins loaded into a child wiki. Crucially, those plugins wouldn't be loaded on the server, avoiding the security issue.

linonetwo commented 1 year ago

That wouldn't be an urgent task, as I can import all core plugins into CPL, so TidGi users (who knows tiddlywiki stuff, but don't know nodejs and json) can use it.

And I'm starting multiple wiki in TidGi using worker thread, so multi wiki in a single thread wouldn't be much use for it. But if it can reduce CPU and memory usage, I will adapt it