title: $:/plugins/Gk0Wk/CPL-Repo/templates/modals/install-plugin-request
code-body: yes
created: 20231010044719404
modified: 20231010075107804
subtitle: <$text text={{{ [[$:/language]get[text]removeprefix[$:/languages/]else[en-GB]search[zh]then[请确认安装]else[Please Confirm to Install]] }}} />
tags: 
type: text/vnd.tiddlywiki

\import $:/plugins/Gk0Wk/CPL-Repo/views/plugins/size

\define dependents-tree(json,checked-title,versions,sizes,is-batch)
<$list filter="[<__json__>jsonindexes[]]" variable="plugin">
<div style="margin-left:1.25em;" class="cpl-plugin-install-request-dependents-tree">
    <$let install-field={{{ [[cpl-plugin#install#]addsuffix<plugin>] }}} version-field={{{ [[cpl-plugin#version#]addsuffix<plugin>] }}}>
    <div style="padding:6px 8px 6px 0;display:flex;align-items:center;justify-content:space-between;">
        <span style="flex-grow:1;padding-left:1em">
            ''<$text text=<<plugin>>/>''&nbsp;
            <$let v={{{ [<__checked-title__>get<version-field>] }}}>
            <$macrocall $name="plugin-size" size={{{ [<__sizes__>jsonget<plugin>,<v>else[0]] }}} />
            </$let>
        </span>
        <span>
            <$checkbox tiddler=<<__checked-title__>> field=<<install-field>> checked="yes" unchecked="no" default="no">
                <$text text={{{ [<__checked-title__>get<install-field>match[yes]] :then[<chinese>match[yes]then[即将安装:]else[Will be installed:]] :else[<chinese>match[yes]then[不会安装]else[Will not be installed]] }}} />
            </$checkbox>
            <$list filter="[<__is-batch__>!match[yes]]" variable="t">
            <$list filter="[<__checked-title__>get<install-field>match[yes]]" variable="t">
            &nbsp;
            <$select tiddler=<<__checked-title__>> field=<<version-field>>>
                <$list filter="[<__versions__>jsonget<plugin>]" variable="version">
                <option value=<<version>>><$text text=<<version>>/></option>
                </$list>
                <option value="latest"><$text text="latest"/></option>
            </$select>
            </$list>
            </$list>
        </span>
    </div>
    <$macrocall $name="dependents-tree" json={{{ [<__json__>jsonextract<plugin>] }}} checked-title=<<__checked-title__>> versions=<<__versions__>> sizes=<<__sizes__>> is-batch=<<__is-batch__>> />
    </$let>
</div>
</$list>
\end

<$list filter="[[$:/language]get[text]removeprefix[$:/languages/]else[en-GB]search[zh]then[yes]else[no]]" variable="chinese">
<$let json={{{ [<requestTiddler>get[text]] }}}>

<<<
<$let title={{{ [<json>jsonget[title]] }}} isBatch={{{ [<json>jsonget[isBatch]else[no]] }}} version-field={{{ [[cpl-plugin#version#]addsuffix<title>] }}}>
<$list filter="[<isBatch>match[yes]]" variable="t">
''<$text text={{{ [<chinese>match[yes]then[即将批量安装以下插件:]else[The following plugins will be installed in batch:]] }}}/>''
</$list>
<$list filter="[<isBatch>!match[yes]]" variable="t">
''<$text text={{{ [<chinese>match[yes]then[即将安装:]else[To be installed:]] }}}/>''
<$text text=<<title>>/>&nbsp;&nbsp;&nbsp;
''<$text text={{{ [<chinese>match[yes]then[选择版本:]else[Select version:]] }}}/>''
<$select tiddler=<<requestTiddler>> field=<<version-field>>>
<$list filter="[<json>jsonget[versions],<title>]" variable="version">
<option value=<<version>>><$text text=<<version>>/></option>
</$list>
<option value="latest"><$text text="latest"/></option>
</$select>
&nbsp;
<$let v={{{ [<requestTiddler>get<version-field>] }}}>
<$macrocall $name="plugin-size" size={{{ [<json>jsonget[sizes],<title>,<v>else[0]] }}} />
</$let>
</$list>
</$let>
<<<

<!-- 依赖树 -->
<$let isBatch={{{ [<json>jsonget[isBatch]else[no]] }}}>
<$list filter="[<json>jsonextract[tree]jsonindexes[]count[]compare:integer:gt[0]]" variable="t">
<$list filter="[<chinese>match[yes]] [<isBatch>match[yes]] +[count[]compare:integer:eq[2]]" variable="t">

以下插件将被批量安装，包括它们的依赖项。如果依赖项安装失败，将会回滚所有安装动作。

你可以自行选择安装哪些插件。插件列表如下：

</$list>
<$list filter="[<chinese>match[yes]] [<isBatch>!match[yes]] +[count[]compare:integer:eq[2]]" variable="t">

这个插件有一些依赖项，在安装插件之前，将会递归地安装这些插件，如果这些插件没有被成功安装，将会回滚所有安装动作。

你可以自行选择安装哪些插件并选择其版本。插件依赖树如下：

</$list>
<$list filter="[<chinese>!match[yes]] [<isBatch>match[yes]] +[count[]compare:integer:eq[2]]" variable="t">

The following plugins will be installed in batch, including their dependencies. If any dependency fails to install, all installation actions will be rolled back.

You can choose which plugins to install. The plugin list is as follows:

</$list>
<$list filter="[<chinese>!match[yes]] [<isBatch>!match[yes]] +[count[]compare:integer:eq[2]]" variable="t">

This plugin has some dependencies that will be installed recursively before installing the plugin, and if these plugins are not installed successfully, all installation actions will be rolled back.

It is up to you to choose which plugins to install and select their versions. The plugin dependency tree is as follows:

</$list>
</$list>
<div style="margin-left:-1em;margin-right:6px;">
    <$macrocall
        $name="dependents-tree"
        json={{{ [<json>jsonextract[tree]] }}}
        checked-title=<<requestTiddler>>
        versions={{{ [<json>jsonextract[versions]] }}}
        sizes={{{ [<json>jsonextract[sizes]] }}}
        is-batch=<<isBatch>>
    />
</div>
</$let>
<hr/>

<$list filter="[<chinese>match[yes]]" variable="t">

注意：虽然 CPL 对安装失败有一定的回滚措施，但是无法避免因插件自身以及插件间相互作用所产生的潜在风险，包括但不限于

* 浏览器崩溃；
* Wiki 系统受损或数据丢失;
* 插件内含恶意脚本的执行造成隐私泄露或系统损坏；

CPL [[接受恶意插件举报|https://github.com/tiddly-gittly/TiddlyWiki-CPL/issues]]并将下架这类插件，但 CPL 不能保证其中收录的所有插件均安全可用。如您在安装后出现任何问题造成损失，CPL 无法负责。

<div class="cpl-modal-warning-callout"><em>因此，在安装任何插件前，请备份您的Wiki！</em></div>

即便如此，您依然要安装吗？

</$list>

<$list filter="[<chinese>!match[yes]]" variable="t">

Note: Although the CPL has some rollback measures for failed installations, it is not immune to the potential risks arising from the plugins themselves and from interactions between plugins, including but not limited to

* Browser crashes;
* Damage to the Wiki system or loss of data;
* Privacy leakage or system damage caused by the execution of malicious scripts contained in the plugin;

CPL [[accepts reports of malicious plugins|https://github.com/tiddly-gittly/TiddlyWiki-CPL/issues]] and will take down such plugins, but CPL cannot guarantee that all plugins included are safe and available. However, CPL cannot guarantee that all plugins are safe and available. CPL cannot be held responsible for any damage caused by any problem that occurs after you have installed the plugin.

<div class="cpl-modal-warning-callout"><em>Therefore, please back up your wiki before installing any plugins!</em></div>

Even so, do you still want to install it?

</$list>

<$button class="tc-btn-big-green tc-primary-btn">
<$action-sendmessage $message="cpl-install-plugin-confirm" response=<<requestTiddler>> />
{{$:/core/images/done-button}}
&#32;
<$text text={{{ [<chinese>match[yes]then[确认安装]else[Confirm to Install]] }}} />
</$button>

</$let>
</$list>
