0
Fork 0
mirror of https://github.com/dani-garcia/vaultwarden.git synced 2025-04-01 02:42:49 -05:00

Update settings.hbs

优化中文
This commit is contained in:
JinkaiNiu 2025-02-02 19:37:59 +08:00 committed by GitHub
parent 66cc0f6b40
commit be52601a10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,18 +1,17 @@
<main class="container-xl">
<div id="admin_token_warning" class="alert alert-warning alert-dismissible fade show d-none">
<button type="button" class="btn-close" data-bs-target="admin_token_warning" data-bs-dismiss="alert"
aria-label="Close"></button>
<button type="button" class="btn-close" data-bs-target="admin_token_warning" data-bs-dismiss="alert" aria-label="Close"></button>
您正在使用纯文本 `ADMIN_TOKEN`,这是不安全的。<br>
请使用 `vaultwarden hash` 或 `argon2` 生成一个安全的 Argon2 PHC 字符串。<br>
请使用 `vaultwarden hash` 或 `argon2` 生成安全的 Argon2 PHC 字符串。<br>
参见:<a href="https://github.com/dani-garcia/vaultwarden/wiki/Enabling-admin-page#secure-the-admin_token"
target="_blank" rel="noopener noreferrer">启用管理页面 - 安全的 `ADMIN_TOKEN`</a>
target="_blank" rel="noopener noreferrer">启用管理页面 - 保护 `ADMIN_TOKEN`</a>
</div>
<div id="config-block" class="align-items-center p-3 mb-3 bg-secondary rounded shadow">
<div>
<h6 class="text-white mb-3">配置</h6>
<div class="small text-white mb-3">
<span class="font-weight-bolder">注意:</span> 此处的设置会覆盖环境变量。保存后,建议停止通过环境变量设置以避免混淆。<br>
这不适用于只读部分,该部分只能通过环境变量设置。<br>
<span class="font-weight-bolder">注意:</span> 这里的设置会覆盖环境变量。保存后,建议停止设置它们以避免混淆。<br>
这不适用于只读部分,只能通过环境变量设置。<br>
被覆盖的设置会显示为 <span class="is-overridden-true alert-row px-1">黄色背景</span>。
</div>
@ -20,10 +19,7 @@
{{#each page_data.config}}
{{#if groupdoc}}
<div class="card mb-3">
<button id="b_{{group}}" type="button"
class="card-header text-start btn btn-link text-decoration-none" aria-expanded="false"
aria-controls="g_{{group}}" data-bs-toggle="collapse"
data-bs-target="#g_{{group}}">{{groupdoc}}</button>
<button id="b_{{group}}" type="button" class="card-header text-start btn btn-link text-decoration-none" aria-expanded="false" aria-controls="g_{{group}}" data-bs-toggle="collapse" data-bs-target="#g_{{group}}">{{groupdoc}}</button>
<div id="g_{{group}}" class="card-body collapse">
{{#each elements}}
{{#if editable}}
@ -34,11 +30,9 @@
<div class="col-sm-8">
<div class="input-group">
<input class="form-control conf-{{type}}" id="input_{{name}}" type="{{type}}"
name="{{name}}" value="{{value}}" {{#if default}} placeholder="默认值: {{default}}"
{{/if}}>
{{#case type "password"}}
<button class="btn btn-outline-secondary input-group-text" type="button"
data-vw-pw-toggle="input_{{name}}">显示/隐藏</button>
name="{{name}}" value="{{value}}" {{#if default}} placeholder="Default: {{default}}"{{/if}}>
{{#case type "password"}}
<button class="btn btn-outline-secondary input-group-text" type="button" data-vw-pw-toggle="input_{{name}}">Show/hide</button>
{{/case}}
</div>
</div>
@ -50,7 +44,7 @@
<input class="form-check-input conf-{{type}}" type="checkbox" id="input_{{name}}"
name="{{name}}" {{#if value}} checked {{/if}}>
<label class="form-check-label" for="input_{{name}}"> 默认值: {{default}} </label>
<label class="form-check-label" for="input_{{name}}"> Default: {{default}} </label>
</div>
</div>
{{/case}}
@ -58,13 +52,11 @@
{{/if}}
{{/each}}
{{#case group "smtp"}}
<div class="row my-2 align-items-center pt-3 border-top" title="向指定电子邮件地址发送测试邮件">
<div class="row my-2 align-items-center pt-3 border-top" title="发送测试电子邮件到指定地址">
<label for="smtp-test-email" class="col-sm-3 col-form-label">测试 SMTP</label>
<div class="col-sm-8 input-group">
<input class="form-control" id="smtp-test-email" type="email" placeholder="输入测试邮箱"
required spellcheck="false">
<button type="button" class="btn btn-outline-primary input-group-text"
id="smtpTest">发送测试邮件</button>
<input class="form-control" id="smtp-test-email" type="email" placeholder="输入测试电子邮件" required spellcheck="false">
<button type="button" class="btn btn-outline-primary input-group-text" id="smtpTest">发送测试电子邮件</button>
<div class="invalid-tooltip">请输入有效的电子邮件地址</div>
</div>
</div>
@ -75,12 +67,11 @@
{{/each}}
<div class="card mb-3">
<button id="b_readonly" type="button"
class="card-header text-start btn btn-link text-decoration-none" aria-expanded="false"
aria-controls="g_readonly" data-bs-toggle="collapse" data-bs-target="#g_readonly">只读配置</button>
<button id="b_readonly" type="button" class="card-header text-start btn btn-link text-decoration-none" aria-expanded="false" aria-controls="g_readonly"
data-bs-toggle="collapse" data-bs-target="#g_readonly">Read-Only Config</button>
<div id="g_readonly" class="card-body collapse">
<div class="small mb-3">
注意:这些选项不能在此编辑器中修改,因为这需要重启服务器。要修改它们,需要在启动服务器时设置正确的环境变量。您可以在每个选项的工具提示中查变量名称。
注意:这些选项不能在此编辑器中修改,因为这需要重启服务器。要修改它们,需要在启动服务器时设置正确的环境变量。您可以在每个选项的工具提示中查变量名称。
</div>
{{#each page_data.config}}
@ -98,17 +89,12 @@
And sometimes this is more useful for providing support than just 3 asterisk.
--}}
{{#if (eq name "database_url")}}
<input readonly class="form-control" id="input_{{name}}" type="password"
value="{{value}}" {{#if default}} placeholder="默认值: {{default}}" {{/if}}>
<button class="btn btn-outline-secondary" type="button"
data-vw-pw-toggle="input_{{name}}">显示/隐藏</button>
<input readonly class="form-control" id="input_{{name}}" type="password" value="{{value}}" {{#if default}} placeholder="Default: {{default}}" {{/if}}>
<button class="btn btn-outline-secondary" type="button" data-vw-pw-toggle="input_{{name}}">Show/hide</button>
{{else}}
<input readonly class="form-control" id="input_{{name}}" type="{{type}}"
value="{{value}}" {{#if default}} placeholder="默认值: {{default}}" {{/if}}
spellcheck="false">
<input readonly class="form-control" id="input_{{name}}" type="{{type}}" value="{{value}}" {{#if default}} placeholder="Default: {{default}}" {{/if}} spellcheck="false">
{{#case type "password"}}
<button class="btn btn-outline-secondary" type="button"
data-vw-pw-toggle="input_{{name}}">显示/隐藏</button>
<button class="btn btn-outline-secondary" type="button" data-vw-pw-toggle="input_{{name}}">Show/hide</button>
{{/case}}
{{/if}}
</div>
@ -118,10 +104,10 @@
<div class="col-sm-3 col-form-label">{{doc.name}}</div>
<div class="col-sm-8">
<div class="form-check align-middle">
<input disabled class="form-check-input" type="checkbox" id="input_{{name}}" {{#if
value}} checked {{/if}}>
<input disabled class="form-check-input" type="checkbox" id="input_{{name}}"
{{#if value}} checked {{/if}}>
<label class="form-check-label" for="input_{{name}}"> 默认值: {{default}} </label>
<label class="form-check-label" for="input_{{name}}"> Default: {{default}} </label>
</div>
</div>
{{/case}}
@ -133,187 +119,38 @@
</div>
</div>
<main class="container-xl">
<div id="admin_token_warning" class="alert alert-warning alert-dismissible fade show d-none">
<button type="button" class="btn-close" data-bs-target="admin_token_warning"
data-bs-dismiss="alert" aria-label="Close"></button>
您正在使用纯文本 `ADMIN_TOKEN`,这是不安全的。<br>
请使用 `vaultwarden hash` 或 `argon2` 生成一个安全的 Argon2 PHC 字符串。<br>
参见:<a
href="https://github.com/dani-garcia/vaultwarden/wiki/Enabling-admin-page#secure-the-admin_token"
target="_blank" rel="noopener noreferrer">启用管理页面 - 安全的 `ADMIN_TOKEN`</a>
</div>
<div id="config-block" class="align-items-center p-3 mb-3 bg-secondary rounded shadow">
<div>
<h6 class="text-white mb-3">配置</h6>
<div class="small text-white mb-3">
<span class="font-weight-bolder">注意:</span> 此处的设置会覆盖环境变量。保存后,建议停止通过环境变量设置以避免混淆。<br>
这不适用于只读部分,该部分只能通过环境变量设置。<br>
被覆盖的设置会显示为 <span class="is-overridden-true alert-row px-1">黄色背景</span>。
</div>
<form class="form needs-validation" id="config-form" novalidate>
{{#each page_data.config}}
{{#if groupdoc}}
<div class="card mb-3">
<button id="b_{{group}}" type="button"
class="card-header text-start btn btn-link text-decoration-none"
aria-expanded="false" aria-controls="g_{{group}}" data-bs-toggle="collapse"
data-bs-target="#g_{{group}}">{{groupdoc}}</button>
<div id="g_{{group}}" class="card-body collapse">
{{#each elements}}
{{#if editable}}
<div class="row my-2 align-items-center is-overridden-{{overridden}} alert-row"
title="[{{name}}] {{doc.description}}">
{{#case type "text" "number" "password"}}
<label for="input_{{name}}"
class="col-sm-3 col-form-label">{{doc.name}}</label>
<div class="col-sm-8">
<div class="input-group">
<input class="form-control conf-{{type}}" id="input_{{name}}"
type="{{type}}" name="{{name}}" value="{{value}}" {{#if
default}} placeholder="默认值: {{default}}" {{/if}}>
{{#case type "password"}}
<button class="btn btn-outline-secondary input-group-text"
type="button" data-vw-pw-toggle="input_{{name}}">显示/隐藏</button>
{{/case}}
</div>
</div>
{{/case}}
{{#case type "checkbox"}}
<div class="col-sm-3 col-form-label">{{doc.name}}</div>
<div class="col-sm-8">
<div class="form-check">
<input class="form-check-input conf-{{type}}" type="checkbox"
id="input_{{name}}" name="{{name}}" {{#if value}} checked
{{/if}}>
<label class="form-check-label" for="input_{{name}}"> 默认值:
{{default}} </label>
</div>
</div>
{{/case}}
</div>
{{/if}}
{{/each}}
{{#case group "smtp"}}
<div class="row my-2 align-items-center pt-3 border-top"
title="向指定电子邮件地址发送测试邮件">
<label for="smtp-test-email" class="col-sm-3 col-form-label">测试 SMTP</label>
<div class="col-sm-8 input-group">
<input class="form-control" id="smtp-test-email" type="email"
placeholder="输入测试邮箱" required spellcheck="false">
<button type="button" class="btn btn-outline-primary input-group-text"
id="smtpTest">发送测试邮件</button>
<div class="invalid-tooltip">请输入有效的电子邮件地址</div>
</div>
</div>
{{/case}}
</div>
</div>
{{/if}}
{{/each}}
<div class="card mb-3">
<button id="b_readonly" type="button"
class="card-header text-start btn btn-link text-decoration-none"
aria-expanded="false" aria-controls="g_readonly" data-bs-toggle="collapse"
data-bs-target="#g_readonly">只读配置</button>
<div id="g_readonly" class="card-body collapse">
<div class="small mb-3">
注意:这些选项不能在此编辑器中修改,因为这需要重启服务器。要修改它们,您需要在启动服务器时设置正确的环境变量。您可以在每个选项的工具提示中检查变量名称。
</div>
{{#each page_data.config}}
{{#each elements}}
{{#unless editable}}
<div class="row my-2 align-items-center alert-row"
title="[{{name}}] {{doc.description}}">
{{#case type "text" "number" "password"}}
<label for="input_{{name}}"
class="col-sm-3 col-form-label">{{doc.name}}</label>
<div class="col-sm-8">
<div class="input-group">
{{!--
Also set the database_url input as password here.
If we would set it to password in config.rs it will not be character
masked for the support string.
And sometimes this is more useful for providing support than just 3
asterisk.
--}}
{{#if (eq name "database_url")}}
<input readonly class="form-control" id="input_{{name}}"
type="password" value="{{value}}" {{#if default}}
placeholder="默认值: {{default}}" {{/if}}>
<button class="btn btn-outline-secondary" type="button"
data-vw-pw-toggle="input_{{name}}">显示/隐藏</button>
{{else}}
<input readonly class="form-control" id="input_{{name}}"
type="{{type}}" value="{{value}}" {{#if default}}
placeholder="默认值: {{default}}" {{/if}} spellcheck="false">
{{#case type "password"}}
<button class="btn btn-outline-secondary" type="button"
data-vw-pw-toggle="input_{{name}}">显示/隐藏</button>
{{/case}}
{{/if}}
</div>
</div>
{{/case}}
{{#case type "checkbox"}}
<div class="col-sm-3 col-form-label">{{doc.name}}</div>
<div class="col-sm-8">
<div class="form-check align-middle">
<input disabled class="form-check-input" type="checkbox"
id="input_{{name}}" {{#if value}} checked {{/if}}>
<label class="form-check-label" for="input_{{name}}"> 默认值:
{{default}} </label>
</div>
</div>
{{/case}}
</div>
{{/unless}}
{{/each}}
{{/each}}
</div>
</div>
{{#if page_data.can_backup}}
<div class="card mb-3">
<button id="b_database" type="button"
class="card-header text-start btn btn-link text-decoration-none"
aria-expanded="false" aria-controls="g_database" data-bs-toggle="collapse"
data-bs-target="#g_database">备份数据库</button>
<div id="g_database" class="card-body collapse">
<div class="small mb-3">
警告:此功能仅创建 SQLite 数据库的备份副本。
这不包括可能还需要恢复 vaultwarden 实例的任何配置或文件附件数据。
有关如何执行完整备份的详细信息,请参阅 wiki 页面上的
<a href="https://github.com/dani-garcia/vaultwarden/wiki/Backing-up-your-vault"
target="_blank" rel="noopener noreferrer">备份</a>。
</div>
<button type="button" class="btn btn-primary" id="backupDatabase">备份数据库</button>
</div>
</div>
{{/if}}
<button type="submit" class="btn btn-primary">保存</button>
<button type="button" class="btn btn-danger float-end" id="deleteConf">重置默认值</button>
</form>
{{#if page_data.can_backup}}
<div class="card mb-3">
<button id="b_database" type="button" class="card-header text-start btn btn-link text-decoration-none" aria-expanded="false" aria-controls="g_database"
data-bs-toggle="collapse" data-bs-target="#g_database">Backup Database</button>
<div id="g_database" class="card-body collapse">
<div class="small mb-3">
警告:此功能仅创建 SQLite 数据库的备份副本。
这不包括可能还需要的任何配置或文件附件数据以完全恢复 vaultwarden 实例。有关如何执行完整备份的详细信息,请参阅<a
href="https://github.com/dani-garcia/vaultwarden/wiki/Backing-up-your-vault"
target="_blank" rel="noopener noreferrer">备份</a> wiki 页面。
</div>
<button type="button" class="btn btn-primary" id="backupDatabase">Backup Database</button>
</div>
</main>
<style>
#config-block ::placeholder {
/* Most modern browsers support this now. */
color: orangered;
}
</div>
{{/if}}
.is-overridden-true {
--bs-alert-color: #664d03;
--bs-alert-bg: #fff3cd;
--bs-alert-border-color: #ffecb5;
}
</style>
<script src="{{urlpath}}/vw_static/admin_settings.js"></script>
<button type="submit" class="btn btn-primary">Save</button>
<button type="button" class="btn btn-danger float-end" id="deleteConf">Reset defaults</button>
</form>
</div>
</div>
</main>
<style>
#config-block ::placeholder {
/* 大多数现代浏览器现在都支持这个。 */
color: orangered;
}
.is-overridden-true {
--bs-alert-color: #664d03;
--bs-alert-bg: #fff3cd;
--bs-alert-border-color: #ffecb5;
}
</style>
<script src="{{urlpath}}/vw_static/admin_settings.js"></script>