chore: add api rtast key

This commit is contained in:
2024-10-11 11:08:18 +08:00
parent 68b7c60a4d
commit 7fda4dc333
5 files changed
+9 -3

No files matched your search

+2 -1
View File
@@ -78,7 +78,8 @@ val DEFAULT_CONFIG = Config(
cloudflareR2SecretKey = "222",
cloudflareR2BucketName = "fancybot",
cloudflareR2PublicUrl = "https://114514.com",
apiSpaceKey = "114514"
apiSpaceKey = "114514",
apiRtastKey = "114514"
)
val configManager = ConfigManager()
@@ -9,6 +9,7 @@ package cn.rtast.fancybot.commands.misc
import cn.rtast.fancybot.API_RTAST_URL
import cn.rtast.fancybot.annotations.CommandDescription
import cn.rtast.fancybot.configManager
import cn.rtast.fancybot.entity.shortlink.ShortLinkPayload
import cn.rtast.fancybot.entity.shortlink.ShortLinkResponse
import cn.rtast.fancybot.util.Http
@@ -26,7 +27,8 @@ class ShortLinkCommand : BaseCommand() {
fun String.makeShortLink(): String {
val shortLink = Http.post<ShortLinkResponse>(
"$API_RTAST_URL/api/sl",
ShortLinkPayload(this).toJson()
ShortLinkPayload(this).toJson(),
params = mapOf("key" to configManager.apiRtastKey)
)
return "$API_RTAST_URL/${shortLink.id}"
}
@@ -46,4 +46,5 @@ data class Config(
val cloudflareR2BucketName: String,
val cloudflareR2PublicUrl: String,
val apiSpaceKey: String,
val apiRtastKey: String
)
@@ -47,4 +47,5 @@ class ConfigManager : JsonFileHandler<Config>("config.json") {
val cloudflareR2BucketName = config.cloudflareR2BucketName
val cloudflareR2PublicUrl = config.cloudflareR2PublicUrl
val apiSpaceKey = config.apiSpaceKey
val apiRtastKey = config.apiRtastKey
}
+2 -1
View File
@@ -37,5 +37,6 @@
"cloudflareR2SecretKey": "222",
"cloudflareR2BucketName": "fancybot",
"cloudflareR2PublicUrl": "https://114514.com",
"apiSpaceKey": "114514"
"apiSpaceKey": "114514",
"apiRtastKey": "114514"
}