Skip to content

Commit

Permalink
Replace buffer with atob()
Browse files Browse the repository at this point in the history
  • Loading branch information
isAdrisal authored and willswire committed Apr 20, 2024
1 parent 8f4fca3 commit 4319a35
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 72 deletions.
64 changes: 0 additions & 64 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@
"scripts": {
"start": "wrangler dev",
"deploy": "wrangler deploy"
},
"dependencies": {
"buffer": "^6.0.3"
}
}
4 changes: 1 addition & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { Buffer } from 'node:buffer';

class BadRequestException extends Error {
constructor(reason) {
super(reason);
Expand Down Expand Up @@ -82,7 +80,7 @@ function parseBasicAuth(request) {
if (!authorization) return {};

const [, data] = authorization?.split(" ");
const decoded = Buffer.from(data, 'base64').toString('ascii');
const decoded = atob(data);
const index = decoded.indexOf(":");

if (index === -1 || /[\0-\x1F\x7F]/.test(decoded)) {
Expand Down
2 changes: 0 additions & 2 deletions wrangler.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
name = "unifi-cloudflare-ddns"
main = "src/index.js"
compatibility_date = "2023-04-23"
compatibility_flags = [ "nodejs_compat" ]

0 comments on commit 4319a35

Please sign in to comment.