Decode properly

This commit is contained in:
Lncvrt committed 2026-02-21 13:04:52 -07:00
1 parent 8083037242
commit 81a8ea81e5
4 files changed
+20 -6

No files matched your search

+4
View File
@@ -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')
}
+7 -2
View File
@@ -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
} }
+2 -2
View File
@@ -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
} }
+7 -2
View File
@@ -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
} }