This commit is contained in:
gedoor 2021-10-10 00:22:48 +08:00
parent fcf3d949f8
commit 3be6838d3d
3 changed files with 34 additions and 14 deletions

View File

@ -13,8 +13,17 @@
"id": -29,
"name": "3.阿里云语音",
"url": "https://nls-gateway.cn-shanghai.aliyuncs.com/stream/v1/tts,{\"method\": \"POST\",\"body\", {\"appkey\":\"31f932fb\",\"text\":\"{{speakText}}\",\"format\":\"mp3\"}}",
"loginUrl": "",
"loginUi": "",
"loginUrl": "var query = 'AccessKeyId=' + source.loginInfoMap().get('AccessKeyId') + '&Action=CreateToken&Version=2019-02-28&Format=JSON&RegionId=cn-shanghai&SignatureMethod=HMAC-SHA1&SignatureVersion=1.0&SignatureNonce=' + java.UUID",
"loginUi": [
{
"name": "AccessKeyId",
"type": "text"
},
{
"name": "AccessKeySecret",
"type": "text"
}
],
"loginCheckJs": ""
}
]

View File

@ -473,6 +473,13 @@ interface JsExtensions {
return msg
}
/**
* 生成UUID
*/
fun randomUUID(): String {
return UUID.randomUUID().toString()
}
/**
* AES 解码为 ByteArray
* @param str 传入的AES加密的数据

View File

@ -27,11 +27,11 @@ import kotlin.collections.HashMap
* Created by GKF on 2018/1/24.
* 搜索URL规则解析
*/
@Suppress("unused")
@Suppress("unused", "MemberVisibilityCanBePrivate")
@Keep
@SuppressLint("DefaultLocale")
class AnalyzeUrl(
var ruleUrl: String,
val mUrl: String,
val key: String? = null,
val page: Int? = null,
val speakText: String? = null,
@ -48,13 +48,15 @@ class AnalyzeUrl(
private val accessTime = hashMapOf<String, FetchRecord>()
}
val headerMap = HashMap<String, String>()
var ruleUrl = ""
private set
var url: String = ""
private set
var body: String? = null
private set
var type: String? = null
private set
val headerMap = HashMap<String, String>()
private var urlNoQuery: String = ""
private var queryStr: String? = null
private val fieldMap = LinkedHashMap<String, String>()
@ -75,12 +77,20 @@ class AnalyzeUrl(
headerMap.remove("proxy")
}
}
initUrl()
}
/**
* 处理url
*/
fun initUrl() {
ruleUrl = mUrl
//执行@js,<js></js>
analyzeJs()
//替换参数
replaceKeyPageJs()
//处理URL
initUrl()
analyzeUrl()
}
/**
@ -142,9 +152,9 @@ class AnalyzeUrl(
}
/**
* 处理URL
* 解析Url
*/
private fun initUrl() {
private fun analyzeUrl() {
//replaceKeyPageJs已经替换掉额外内容此处url是基础形式可以直接切首个,’之前字符串。
val urlMatcher = paramPattern.matcher(ruleUrl)
val urlNoOption =
@ -245,12 +255,6 @@ class AnalyzeUrl(
return SCRIPT_ENGINE.eval(jsStr, bindings)
}
fun upHeader() {
source?.getHeaderMap(true)?.let {
headerMap.putAll(it)
}
}
fun put(key: String, value: String): String {
chapter?.putVariable(key, value)
?: ruleData?.putVariable(key, value)