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
|
||||
}
|
||||
|
||||
export const base64Decode = (input: string) => {
|
||||
return Buffer.from(input, 'base64').toString('utf8')
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
import axios from 'axios'
|
||||
import { jsonResponse, parseResponse, splitGd } from '../../../lib/util'
|
||||
import {
|
||||
base64Decode,
|
||||
jsonResponse,
|
||||
parseResponse,
|
||||
splitGd
|
||||
} from '../../../lib/util'
|
||||
import { Context } from 'elysia'
|
||||
|
||||
export const handler = async (handler: Context) => {
|
||||
@@ -43,7 +48,7 @@ export const handler = async (handler: Context) => {
|
||||
date: commentInfo['9'] + ' ago'
|
||||
}
|
||||
try {
|
||||
data.content = atob(data.content)
|
||||
data.content = base64Decode(data.content)
|
||||
} catch {
|
||||
data.decodeFailed = true
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import axios from 'axios'
|
||||
import { jsonResponse, parseResponse } from '../../../../lib/util'
|
||||
import { base64Decode, jsonResponse, parseResponse } from '../../../../lib/util'
|
||||
import { Context } from 'elysia'
|
||||
|
||||
export const handler = async (handler: Context) => {
|
||||
@@ -66,7 +66,7 @@ export const handler = async (handler: Context) => {
|
||||
}
|
||||
}
|
||||
try {
|
||||
data.content = atob(data.content)
|
||||
data.content = base64Decode(data.content)
|
||||
} catch {
|
||||
data.decodeFailed = true
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import axios from 'axios'
|
||||
import { jsonResponse, parseResponse, splitGd } from '../../../lib/util'
|
||||
import {
|
||||
base64Decode,
|
||||
jsonResponse,
|
||||
parseResponse,
|
||||
splitGd
|
||||
} from '../../../lib/util'
|
||||
import { Context } from 'elysia'
|
||||
|
||||
export const handler = async (handler: Context) => {
|
||||
@@ -66,7 +71,7 @@ export const handler = async (handler: Context) => {
|
||||
}
|
||||
}
|
||||
try {
|
||||
data.content = atob(data.content)
|
||||
data.content = base64Decode(data.content)
|
||||
} catch {
|
||||
data.decodeFailed = true
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user