97 custom arguments broken (#99)
* golang debug * handle template in playlist download * code refactoring, dropped goccy go json
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Observable, share } from 'rxjs'
|
||||
import { Observable } from 'rxjs'
|
||||
import type { DLMetadata, RPCRequest, RPCResponse, RPCResult } from '../types'
|
||||
|
||||
import { WebSocketSubject, webSocket } from 'rxjs/webSocket'
|
||||
@@ -29,6 +29,12 @@ export class RPCClient {
|
||||
})
|
||||
}
|
||||
|
||||
private argsSanitizer(args: string) {
|
||||
return args
|
||||
.split(' ')
|
||||
.map(a => a.trim().replaceAll("'", '').replaceAll('"', ''))
|
||||
}
|
||||
|
||||
private async sendHTTP<T>(req: RPCRequest) {
|
||||
const res = await fetch(this.httpEndpoint, {
|
||||
method: 'POST',
|
||||
@@ -57,16 +63,17 @@ export class RPCClient {
|
||||
method: 'Service.ExecPlaylist',
|
||||
params: [{
|
||||
URL: url,
|
||||
Params: args.split(" ").map(a => a.trim()),
|
||||
Params: this.argsSanitizer(args),
|
||||
Path: pathOverride,
|
||||
Rename: renameTo,
|
||||
}]
|
||||
})
|
||||
}
|
||||
this.sendHTTP({
|
||||
method: 'Service.Exec',
|
||||
params: [{
|
||||
URL: url.split("?list").at(0)!,
|
||||
Params: args.split(" ").map(a => a.trim()),
|
||||
URL: url.split('?list').at(0)!,
|
||||
Params: this.argsSanitizer(args),
|
||||
Path: pathOverride,
|
||||
Rename: renameTo,
|
||||
}]
|
||||
@@ -78,7 +85,7 @@ export class RPCClient {
|
||||
return this.sendHTTP<DLMetadata>({
|
||||
method: 'Service.Formats',
|
||||
params: [{
|
||||
URL: url.split("?list").at(0)!,
|
||||
URL: url.split('?list').at(0)!,
|
||||
}]
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user