diff --git a/README.md b/README.md index 4581546e..5f6b6532 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,8 @@ ## 文档 * [新手指南](https://edge.teaos.cn/docs/QuickStart/Index.md) -* [文档](http://edge.teaos.cn/docs) +* [完整文档](https://edge.teaos.cn/docs) +* [开发者指南](https://edge.teaos.cn/docs/Developer/Build.md) ## 架构  diff --git a/internal/web/actions/default/servers/server/settings/access/createPopup.go b/internal/web/actions/default/servers/server/settings/access/createPopup.go new file mode 100644 index 00000000..4642a31a --- /dev/null +++ b/internal/web/actions/default/servers/server/settings/access/createPopup.go @@ -0,0 +1,27 @@ +// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved. + +package access + +import ( + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/iwind/TeaGo/actions" +) + +type CreatePopupAction struct { + actionutils.ParentAction +} + +func (this *CreatePopupAction) Init() { + this.Nav("", "", "") +} + +func (this *CreatePopupAction) RunGet(params struct{}) { + this.Show() +} + +func (this *CreatePopupAction) RunPost(params struct { + Must *actions.Must + CSRF *actionutils.CSRF +}) { + +} diff --git a/internal/web/actions/default/servers/server/settings/access/index.go b/internal/web/actions/default/servers/server/settings/access/index.go index 2e208ab7..568f4567 100644 --- a/internal/web/actions/default/servers/server/settings/access/index.go +++ b/internal/web/actions/default/servers/server/settings/access/index.go @@ -2,6 +2,7 @@ package access import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" ) type IndexAction struct { @@ -16,7 +17,14 @@ func (this *IndexAction) Init() { func (this *IndexAction) RunGet(params struct { ServerId int64 }) { - // TODO + webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId) + if err != nil { + this.ErrorPage(err) + return + } + + this.Data["webId"] = webConfig.Id + this.Data["authConfig"] = webConfig.Auth this.Show() } diff --git a/internal/web/actions/default/servers/server/settings/access/init.go b/internal/web/actions/default/servers/server/settings/access/init.go index 6c213793..2f51fe60 100644 --- a/internal/web/actions/default/servers/server/settings/access/init.go +++ b/internal/web/actions/default/servers/server/settings/access/init.go @@ -14,6 +14,8 @@ func init() { Helper(serverutils.NewServerHelper()). Prefix("/servers/server/settings/access"). Get("", new(IndexAction)). + GetPost("/createPopup", new(CreatePopupAction)). + GetPost("/updatePopup", new(UpdatePopupAction)). EndAll() }) } diff --git a/internal/web/actions/default/servers/server/settings/access/updatePopup.go b/internal/web/actions/default/servers/server/settings/access/updatePopup.go new file mode 100644 index 00000000..5dfbf14a --- /dev/null +++ b/internal/web/actions/default/servers/server/settings/access/updatePopup.go @@ -0,0 +1,17 @@ +// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved. + +package access + +import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + +type UpdatePopupAction struct { + actionutils.ParentAction +} + +func (this *UpdatePopupAction) Init() { + this.Nav("", "", "") +} + +func (this *UpdatePopupAction) RunGet(params struct{}) { + this.Show() +} diff --git a/internal/web/actions/default/setup/install.go b/internal/web/actions/default/setup/install.go index d48ae1a6..83f5bca5 100644 --- a/internal/web/actions/default/setup/install.go +++ b/internal/web/actions/default/setup/install.go @@ -191,7 +191,7 @@ func (this *InstallAction) RunPost(params struct { Username: adminMap.GetString("username"), Password: adminMap.GetString("password"), }) - // 这里我们尝试多次是为了当代API节点启动完毕 + // 这里我们尝试多次是为了等待API节点启动完毕 if err != nil { time.Sleep(1 * time.Second) } diff --git a/web/public/js/components/server/http-auth-config-box.js b/web/public/js/components/server/http-auth-config-box.js new file mode 100644 index 00000000..621a3606 --- /dev/null +++ b/web/public/js/components/server/http-auth-config-box.js @@ -0,0 +1,81 @@ +// 认证设置 +Vue.component("http-auth-config-box", { + props: ["v-auth-config", "v-is-location"], + data: function () { + let authConfig = this.vAuthConfig + if (authConfig == null) { + authConfig = { + isPrior: false, + isOn: false + } + } + if (authConfig.policyRefs == null) { + authConfig.policyRefs = [] + } + return { + authConfig: authConfig + } + }, + methods: { + isOn: function () { + return (!this.vIsLocation || this.authConfig.isPrior) && this.authConfig.isOn + }, + add: function () { + let that = this + teaweb.popup("/servers/server/settings/access/createPopup", { + callback: function (resp) { + that.authConfig.policyRefs.push(resp.data.policyRef) + } + }) + }, + update: function (index, policyId) { + let that = this + teaweb.popup("/servers/server/settings/access/updatePopup?policyId=" + policyId, { + callback: function (resp) { + Vue.set(that.authConfig.policyRefs, index, resp.data.policyRef) + } + }) + }, + delete: function (index) { + that.authConfig.policyRefs.$remove(index) + } + }, + template: `
| 启用认证 | +
+
+
+
+
+ |
+
| 认证方法 | +参数 | +状态 | +操作 | +
|---|---|---|---|
| + |