Skip to content

Commit

Permalink
style: with prettier (#1459)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] authored Aug 10, 2024
1 parent 6bc9960 commit 095b60b
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions src/hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,11 @@ hook.request.before = (ctx) => {
const netease = {};
netease.pad = (body.match(/%0+$/) || [''])[0];
if (url.path === '/api/linux/forward') {
netease.crypto = 'linuxapi'
}
else if (url.path.startsWith('/eapi/')) {
netease.crypto = 'eapi'
}
else if (url.path.startsWith('/api/')) {
netease.crypto = 'api'
netease.crypto = 'linuxapi';
} else if (url.path.startsWith('/eapi/')) {
netease.crypto = 'eapi';
} else if (url.path.startsWith('/api/')) {
netease.crypto = 'api';
}
let data;
switch (netease.crypto) {
Expand Down Expand Up @@ -222,12 +220,14 @@ hook.request.before = (ctx) => {
break;
case 'api':
data = {};
decodeURIComponent(body).split('&').forEach((pair) => {
let [key, value] = pair.split('=');
data[key] = value
});
netease.path = url.path
netease.param = data
decodeURIComponent(body)
.split('&')
.forEach((pair) => {
let [key, value] = pair.split('=');
data[key] = value;
});
netease.path = url.path;
netease.param = data;
break;
default:
// unsupported crypto
Expand Down Expand Up @@ -333,8 +333,7 @@ hook.request.after = (ctx) => {
netease.jsonBody = JSON.parse(
patch(crypto.eapi.decrypt(buffer).toString())
);
}
else {
} else {
netease.jsonBody = JSON.parse(patch(buffer.toString()));
}

Expand Down

0 comments on commit 095b60b

Please sign in to comment.