From 59ff55fd4b22654b3adef5bb704550e20629408d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=8E=AB=E5=94=90=E5=B0=BC?= Date: Tue, 2 Jul 2024 18:04:56 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E3=80=81=E8=B0=83=E6=95=B4=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/pro/uhalo/uni/UniHaloPlugin.java | 9 ++- .../java/pro/uhalo/uni/UniHaloRouter.java | 38 ------------ .../java/pro/uhalo/uni/extension/AuthApp.java | 62 ------------------- .../resources/extensions/role-anonymous.yaml | 2 +- src/main/resources/extensions/setting.yaml | 45 ++++++++++---- 5 files changed, 38 insertions(+), 118 deletions(-) delete mode 100644 src/main/java/pro/uhalo/uni/UniHaloRouter.java delete mode 100644 src/main/java/pro/uhalo/uni/extension/AuthApp.java diff --git a/src/main/java/pro/uhalo/uni/UniHaloPlugin.java b/src/main/java/pro/uhalo/uni/UniHaloPlugin.java index ff0941e..7574739 100644 --- a/src/main/java/pro/uhalo/uni/UniHaloPlugin.java +++ b/src/main/java/pro/uhalo/uni/UniHaloPlugin.java @@ -1,6 +1,5 @@ package pro.uhalo.uni; -import pro.uhalo.uni.extension.AuthApp; import org.springframework.stereotype.Component; import run.halo.app.extension.SchemeManager; import run.halo.app.plugin.BasePlugin; @@ -22,8 +21,8 @@ public UniHaloPlugin(PluginContext pluginContext, SchemeManager schemeManager) { @Override public void start() { - // 插件启动时注册自定义模型 - schemeManager.register(AuthApp.class); + // todo:插件启动时注册自定义模型 + // schemeManager.unregister(schemeManager.get(XXX.class)); System.out.println("logs : [ Plugin Start ],插件启动成功!"); } @@ -31,8 +30,8 @@ public void start() { @Override public void stop() { - // 插件停用时取消注册自定义模型 - schemeManager.unregister(schemeManager.get(AuthApp.class)); + // todo:插件停用时取消注册自定义模型 + // schemeManager.unregister(schemeManager.get(XXX.class)); System.out.println("logs : [ Plugin Stop ],插件停止!"); } diff --git a/src/main/java/pro/uhalo/uni/UniHaloRouter.java b/src/main/java/pro/uhalo/uni/UniHaloRouter.java deleted file mode 100644 index 078ac40..0000000 --- a/src/main/java/pro/uhalo/uni/UniHaloRouter.java +++ /dev/null @@ -1,38 +0,0 @@ -package pro.uhalo.uni; - -import static org.springframework.web.reactive.function.server.RequestPredicates.GET; -import static org.springframework.web.reactive.function.server.RouterFunctions.route; -import static pro.uhalo.uni.constants.Constants.BASIC_DOMAIN_API_NAME; - -import lombok.RequiredArgsConstructor; -import org.springframework.context.annotation.Bean; -import org.springframework.http.MediaType; -import org.springframework.stereotype.Component; -import org.springframework.web.reactive.function.server.HandlerFunction; -import org.springframework.web.reactive.function.server.RouterFunction; -import org.springframework.web.reactive.function.server.ServerResponse; -import run.halo.app.plugin.ReactiveSettingFetcher; - - -/** - * @author 小莫唐尼 - * @since 1.0.0 - */ -@Component -@RequiredArgsConstructor -public class UniHaloRouter { - private final ReactiveSettingFetcher settingFetcher; - - @Bean - RouterFunction uHaloOptionsRouter() { - return route(GET("/apis/" + BASIC_DOMAIN_API_NAME + "/xxxxs"), handlerFunction()); - } - - private HandlerFunction handlerFunction() { - return request -> settingFetcher.getValues() - .flatMap(result -> ServerResponse.ok() - .contentType(MediaType.APPLICATION_JSON) - .bodyValue(result) - ); - } -} \ No newline at end of file diff --git a/src/main/java/pro/uhalo/uni/extension/AuthApp.java b/src/main/java/pro/uhalo/uni/extension/AuthApp.java deleted file mode 100644 index 1c4c0d1..0000000 --- a/src/main/java/pro/uhalo/uni/extension/AuthApp.java +++ /dev/null @@ -1,62 +0,0 @@ -package pro.uhalo.uni.extension; - - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; -import pro.uhalo.uni.constants.Constants; -import run.halo.app.extension.AbstractExtension; -import run.halo.app.extension.GVK; - -import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; - -/** - * 应用管理 - * - * @author 小莫唐尼 - * @since 1.0.0 - */ -@GVK(kind = "AuthApp", group = "auth-app." + Constants.BASIC_DOMAIN_NAME, - version = "v1alpha1", singular = "authApp", plural = "authApps") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class AuthApp extends AbstractExtension { - - public static final String REQUIRE_SYNC_ON_STARTUP_INDEX_NAME = "requireSyncOnStartup"; - - @Schema(requiredMode = REQUIRED) - private AuthAppSpec spec; - - - @Data - public static class AuthAppSpec { - - @Schema(description = "应用ID", requiredMode = REQUIRED) - private String appId; - - @Schema(description = "应用名称", requiredMode = REQUIRED) - private String appName; - - @Schema(description = "应用图标", requiredMode = REQUIRED) - private String appLogo; - - @Schema(description = "应用介绍", requiredMode = REQUIRED) - private String appDesc; - - @Schema(description = "应用状态", requiredMode = REQUIRED) - private String status; - - @Schema(description = "应用作者", requiredMode = REQUIRED) - private String author; - - @Schema(description = "应用版本", requiredMode = REQUIRED) - private String version; - - @Schema(description = "应用官网", requiredMode = REQUIRED) - private String officialWebsite; - - } - -} diff --git a/src/main/resources/extensions/role-anonymous.yaml b/src/main/resources/extensions/role-anonymous.yaml index e479ba8..4138ce1 100644 --- a/src/main/resources/extensions/role-anonymous.yaml +++ b/src/main/resources/extensions/role-anonymous.yaml @@ -12,5 +12,5 @@ metadata: ["plugin:plugin-uni-halo:config:view"] rules: - apiGroups: [ "api.uni.uhalo.pro" ] - resources: [ "plugins/*" ,"plugins/getConfigs","plugins/getConfigs/*","plugins/getUserInfoByName","plugins/getUserInfoByName/*" ] + resources: [ "plugins/*" ,"plugins/getConfigs","plugins/getConfigs/*"] verbs: [ "get", "list" ] diff --git a/src/main/resources/extensions/setting.yaml b/src/main/resources/extensions/setting.yaml index 499b255..9a7ac50 100644 --- a/src/main/resources/extensions/setting.yaml +++ b/src/main/resources/extensions/setting.yaml @@ -240,12 +240,13 @@ spec: - $formkit: text validation: required name: description - label: 签名 + label: 简介 value: "" - $formkit: group name: social label: 社交信息 value: + enabled: true qq: "" wechat: "" weibo: "" @@ -255,48 +256,69 @@ spec: gitee: "" github: "" csdn: "" + help: 我的社交信息页面显示的内容 children: + - $formkit: select + name: enabled + id: socialEnabled + label: 是否启用 + value: true + options: + - label: 是 + value: true + - label: 否 + value: false + help: 是否启用社交信息页面 - $formkit: text + if: "$get(socialEnabled).value === true" name: qq label: QQ号 value: "" - $formkit: text + if: "$get(socialEnabled).value === true" name: wechat label: 微信号 value: "" - $formkit: text + if: "$get(socialEnabled).value === true" name: weibo label: 微博地址 value: "" - $formkit: text + if: "$get(socialEnabled).value === true" name: email label: 邮箱 value: "" - $formkit: text + if: "$get(socialEnabled).value === true" name: blog label: 博客 value: "" - $formkit: text + if: "$get(socialEnabled).value === true" name: bilibili label: B站 value: "" - $formkit: text + if: "$get(socialEnabled).value === true" name: juejin label: 掘金B站 value: "" - $formkit: text + if: "$get(socialEnabled).value === true" name: csdn label: CSDN value: "" - $formkit: text + if: "$get(socialEnabled).value === true" name: gitee label: Gitee value: "" - $formkit: text + if: "$get(socialEnabled).value === true" name: github label: Github value: "" - help: 我的社交信息页面显示的内容 - group: imagesConfig label: 图片配置 formSchema: @@ -612,6 +634,7 @@ spec: enabled: false pluginId: "" Authorization: "" + rewardedVideoAdId: "" help: 说明:来自【作者:柳意无情】的工具箱插件,用于开启支持文章加密访问。 children: - $formkit: select @@ -639,6 +662,13 @@ spec: value: "" validation: required help: Tools工具箱插件设置的认证token + - $formkit: text + if: "$get(toolsPluginEnabled).value === true" + name: rewardedVideoAdId + label: 视频广告ID + value: "" + validation: required + help: 广告ID,请在 UniApp 广告管理中获取。 - group: shareConfig label: 分享配置 formSchema: @@ -668,13 +698,4 @@ spec: label: 复制链接 value: "/pages/index/index" validation: required - help: 复制链接,如:/pages/index/index(一般默认就行) - - group: adConfig - label: 广告配置 - formSchema: - - $formkit: text - name: rewardedVideoAdId - label: 视频广告ID - value: "" - validation: required - help: 激励视频广告ID,请在 uniapp 广告管理中获取 + help: 复制链接,如:/pages/index/index(一般默认就行) \ No newline at end of file