Decode properly
This commit is contained in:
4 files changed
+20
-6
No files matched your search
@@ -72,3 +72,7 @@ export const parseResponse = (responseBody: string, splitter = ':') => {
|
|||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const base64Decode = (input: string) => {
|
||||||
|
return Buffer.from(input, 'base64').toString('utf8')
|
||||||
|
}
|
||||||
@@ -1,5 +1,10 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { jsonResponse, parseResponse, splitGd } from '../../../lib/util'
|
import {
|
||||||
|
base64Decode,
|
||||||
|
jsonResponse,
|
||||||
|
parseResponse,
|
||||||
|
splitGd
|
||||||
|
} from '../../../lib/util'
|
||||||
import { Context } from 'elysia'
|
import { Context } from 'elysia'
|
||||||
|
|
||||||
export const handler = async (handler: Context) => {
|
export const handler = async (handler: Context) => {
|
||||||
@@ -43,7 +48,7 @@ export const handler = async (handler: Context) => {
|
|||||||
date: commentInfo['9'] + ' ago'
|
date: commentInfo['9'] + ' ago'
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
data.content = atob(data.content)
|
data.content = base64Decode(data.content)
|
||||||
} catch {
|
} catch {
|
||||||
data.decodeFailed = true
|
data.decodeFailed = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { jsonResponse, parseResponse } from '../../../../lib/util'
|
import { base64Decode, jsonResponse, parseResponse } from '../../../../lib/util'
|
||||||
import { Context } from 'elysia'
|
import { Context } from 'elysia'
|
||||||
|
|
||||||
export const handler = async (handler: Context) => {
|
export const handler = async (handler: Context) => {
|
||||||
@@ -66,7 +66,7 @@ export const handler = async (handler: Context) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
data.content = atob(data.content)
|
data.content = base64Decode(data.content)
|
||||||
} catch {
|
} catch {
|
||||||
data.decodeFailed = true
|
data.decodeFailed = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { jsonResponse, parseResponse, splitGd } from '../../../lib/util'
|
import {
|
||||||
|
base64Decode,
|
||||||
|
jsonResponse,
|
||||||
|
parseResponse,
|
||||||
|
splitGd
|
||||||
|
} from '../../../lib/util'
|
||||||
import { Context } from 'elysia'
|
import { Context } from 'elysia'
|
||||||
|
|
||||||
export const handler = async (handler: Context) => {
|
export const handler = async (handler: Context) => {
|
||||||
@@ -66,7 +71,7 @@ export const handler = async (handler: Context) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
data.content = atob(data.content)
|
data.content = base64Decode(data.content)
|
||||||
} catch {
|
} catch {
|
||||||
data.decodeFailed = true
|
data.decodeFailed = true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user