-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add global header and fotter script support. (#685)
* feat: console支持加载全局头片断和尾部片断代码。 * feat: add SettingService for get setting vo. * docs: update changelog md
- Loading branch information
Showing
10 changed files
with
205 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,10 @@ | |
|
||
# 0.15.11 | ||
|
||
## 新特性 | ||
|
||
- Console支持管理和加载全局header和footer配置 | ||
|
||
## 插件支持 | ||
|
||
- 添加`MetaOperate`以支持插件调用三方元数据插件条目查寻 | ||
|
11 changes: 11 additions & 0 deletions
11
api/src/main/java/run/ikaros/api/core/setting/vo/BasicSetting.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package run.ikaros.api.core.setting.vo; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class BasicSetting { | ||
private String siteTitle; | ||
private String siteSubhead; | ||
private String logo; | ||
private String favicon; | ||
} |
9 changes: 9 additions & 0 deletions
9
api/src/main/java/run/ikaros/api/core/setting/vo/GlobalSetting.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package run.ikaros.api.core.setting.vo; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class GlobalSetting { | ||
private String header; | ||
private String footer; | ||
} |
6 changes: 6 additions & 0 deletions
6
api/src/main/java/run/ikaros/api/core/setting/vo/MailProtocol.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package run.ikaros.api.core.setting.vo; | ||
|
||
|
||
public enum MailProtocol { | ||
SMTP | ||
} |
15 changes: 15 additions & 0 deletions
15
api/src/main/java/run/ikaros/api/core/setting/vo/MailSetting.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package run.ikaros.api.core.setting.vo; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class MailSetting { | ||
private Boolean enable; | ||
private MailProtocol protocol; | ||
private String smtpHost; | ||
private String smtpPort; | ||
private String smtpAccount; | ||
private String smtpPassword; | ||
private String smtpAccountAlias; | ||
private String smtpReceiveAddress; | ||
} |
9 changes: 9 additions & 0 deletions
9
api/src/main/java/run/ikaros/api/core/setting/vo/UserSetting.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package run.ikaros.api.core.setting.vo; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class UserSetting { | ||
private Boolean allowRegister; | ||
private String defaultRole; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
server/src/main/java/run/ikaros/server/core/setting/DefaultSettingService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package run.ikaros.server.core.setting; | ||
|
||
import java.util.Map; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Service; | ||
import reactor.core.publisher.Mono; | ||
import run.ikaros.api.core.setting.ConfigMap; | ||
import run.ikaros.api.core.setting.vo.GlobalSetting; | ||
import run.ikaros.api.custom.ReactiveCustomClient; | ||
|
||
@Slf4j | ||
@Service | ||
public class DefaultSettingService implements SettingService { | ||
|
||
private final ReactiveCustomClient reactiveCustomClient; | ||
private static final String configMapName = "setting.server.ikaros.run"; | ||
|
||
public DefaultSettingService(ReactiveCustomClient reactiveCustomClient) { | ||
this.reactiveCustomClient = reactiveCustomClient; | ||
} | ||
|
||
@Override | ||
public Mono<GlobalSetting> getGlobalSetting() { | ||
return reactiveCustomClient.findOne(ConfigMap.class, configMapName) | ||
.map(configMap -> { | ||
Map<String, String> data = configMap.getData(); | ||
GlobalSetting globalSetting = new GlobalSetting(); | ||
globalSetting.setHeader(data.get("GLOBAL_HEADER")); | ||
globalSetting.setFooter(data.get("GLOBAL_FOOTER")); | ||
return globalSetting; | ||
}); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
server/src/main/java/run/ikaros/server/core/setting/SettingService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package run.ikaros.server.core.setting; | ||
|
||
import reactor.core.publisher.Mono; | ||
import run.ikaros.api.core.setting.vo.GlobalSetting; | ||
|
||
public interface SettingService { | ||
Mono<GlobalSetting> getGlobalSetting(); | ||
} |