chore: add api rtast key
This commit is contained in:
5 files changed
+9
-3
No files matched your search
@@ -78,7 +78,8 @@ val DEFAULT_CONFIG = Config(
|
|||||||
cloudflareR2SecretKey = "222",
|
cloudflareR2SecretKey = "222",
|
||||||
cloudflareR2BucketName = "fancybot",
|
cloudflareR2BucketName = "fancybot",
|
||||||
cloudflareR2PublicUrl = "https://114514.com",
|
cloudflareR2PublicUrl = "https://114514.com",
|
||||||
apiSpaceKey = "114514"
|
apiSpaceKey = "114514",
|
||||||
|
apiRtastKey = "114514"
|
||||||
)
|
)
|
||||||
|
|
||||||
val configManager = ConfigManager()
|
val configManager = ConfigManager()
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ package cn.rtast.fancybot.commands.misc
|
|||||||
|
|
||||||
import cn.rtast.fancybot.API_RTAST_URL
|
import cn.rtast.fancybot.API_RTAST_URL
|
||||||
import cn.rtast.fancybot.annotations.CommandDescription
|
import cn.rtast.fancybot.annotations.CommandDescription
|
||||||
|
import cn.rtast.fancybot.configManager
|
||||||
import cn.rtast.fancybot.entity.shortlink.ShortLinkPayload
|
import cn.rtast.fancybot.entity.shortlink.ShortLinkPayload
|
||||||
import cn.rtast.fancybot.entity.shortlink.ShortLinkResponse
|
import cn.rtast.fancybot.entity.shortlink.ShortLinkResponse
|
||||||
import cn.rtast.fancybot.util.Http
|
import cn.rtast.fancybot.util.Http
|
||||||
@@ -26,7 +27,8 @@ class ShortLinkCommand : BaseCommand() {
|
|||||||
fun String.makeShortLink(): String {
|
fun String.makeShortLink(): String {
|
||||||
val shortLink = Http.post<ShortLinkResponse>(
|
val shortLink = Http.post<ShortLinkResponse>(
|
||||||
"$API_RTAST_URL/api/sl",
|
"$API_RTAST_URL/api/sl",
|
||||||
ShortLinkPayload(this).toJson()
|
ShortLinkPayload(this).toJson(),
|
||||||
|
params = mapOf("key" to configManager.apiRtastKey)
|
||||||
)
|
)
|
||||||
return "$API_RTAST_URL/${shortLink.id}"
|
return "$API_RTAST_URL/${shortLink.id}"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,4 +46,5 @@ data class Config(
|
|||||||
val cloudflareR2BucketName: String,
|
val cloudflareR2BucketName: String,
|
||||||
val cloudflareR2PublicUrl: String,
|
val cloudflareR2PublicUrl: String,
|
||||||
val apiSpaceKey: String,
|
val apiSpaceKey: String,
|
||||||
|
val apiRtastKey: String
|
||||||
)
|
)
|
||||||
@@ -47,4 +47,5 @@ class ConfigManager : JsonFileHandler<Config>("config.json") {
|
|||||||
val cloudflareR2BucketName = config.cloudflareR2BucketName
|
val cloudflareR2BucketName = config.cloudflareR2BucketName
|
||||||
val cloudflareR2PublicUrl = config.cloudflareR2PublicUrl
|
val cloudflareR2PublicUrl = config.cloudflareR2PublicUrl
|
||||||
val apiSpaceKey = config.apiSpaceKey
|
val apiSpaceKey = config.apiSpaceKey
|
||||||
|
val apiRtastKey = config.apiRtastKey
|
||||||
}
|
}
|
||||||
@@ -37,5 +37,6 @@
|
|||||||
"cloudflareR2SecretKey": "222",
|
"cloudflareR2SecretKey": "222",
|
||||||
"cloudflareR2BucketName": "fancybot",
|
"cloudflareR2BucketName": "fancybot",
|
||||||
"cloudflareR2PublicUrl": "https://114514.com",
|
"cloudflareR2PublicUrl": "https://114514.com",
|
||||||
"apiSpaceKey": "114514"
|
"apiSpaceKey": "114514",
|
||||||
|
"apiRtastKey": "114514"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user