Encode command

This commit is contained in:
Douglas Barone 2023-10-23 12:57:41 -04:00
parent 3957a13129
commit abecf095f2

View File

@ -5,9 +5,17 @@ export class PaFirewall {
async login(username: string, ip: string, domain: string) {
const command = this.createLoginCommand(username, ip, domain)
const url = `https://${this.ip}/api/?type=user-id&key=${this.key}&cmd=${command}`
const url = `https://${this.ip}/api/?type=user-id&key=${this.key}`
const response = await fetch(url, { method: 'POST' })
const formData = encodeURIComponent(command)
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
},
body: `cmd=${formData}`
})
const data = await response.text()