Skip to content

Commit

Permalink
Alsong escape 처리 (#6)
Browse files Browse the repository at this point in the history
* Alsong escape 처리

* chore: upgrade deps
  • Loading branch information
vbalien authored Aug 6, 2022
1 parent ef6d2b7 commit 8e21f3f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 12 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"react-dom": "^18.2.0",
"react-spring": "^9.5.2",
"recoil": "^0.7.4",
"sqlstring": "^2.3.3",
"tinycolor": "^0.0.1",
"ws": "^8.8.1"
},
Expand All @@ -97,6 +98,7 @@
"@types/react": "^18.0.15",
"@types/react-color": "^3.0.6",
"@types/react-dom": "^18.0.6",
"@types/sqlstring": "^2.3.0",
"@types/tinycolor2": "^1.4.3",
"@types/webpack": "^5.28.0",
"@types/webpack-node-externals": "^2.5.3",
Expand Down
10 changes: 8 additions & 2 deletions src/main/alsong.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import http from 'http';
import { XMLParser, XMLBuilder } from 'fast-xml-parser';
import SqlString from 'sqlstring';

export type LyricData = {
lyricID: number;
Expand Down Expand Up @@ -47,6 +48,11 @@ async function alsongRequest(action: string, body: Json) {
},
},
res => {
if (res.statusCode !== 200) {
reject(res.statusMessage);
return;
}

const chunks: Buffer[] = [];
res.on('data', data => {
chunks.push(data);
Expand Down Expand Up @@ -91,8 +97,8 @@ export async function getLyricList({
'8456ec35caba5c981e705b0c5d76e4593e020ae5e3d469c75d1c6714b6b1244c0732f1f19cc32ee5123ef7de574fc8bc6d3b6bd38dd3c097f5a4a1aa1b438fea0e413baf8136d2d7d02bfcdcb2da4990df2f28675a3bd621f8234afa84fb4ee9caa8f853a5b06f884ea086fd3ed3b4c6e14f1efac5a4edbf6f6cb475445390b0',
'ns1:pageNo': 1,
};
title && (body['ns1:title'] = title);
artist && (body['ns1:artist'] = artist);
title && (body['ns1:title'] = SqlString.escape(title));
artist && (body['ns1:artist'] = SqlString.escape(artist));
const json = await alsongRequest('GetResembleLyricList2', body);
if (
typeof json.result !== 'object' ||
Expand Down
30 changes: 20 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1643,6 +1643,11 @@
dependencies:
"@types/node" "*"

"@types/sqlstring@^2.3.0":
version "2.3.0"
resolved "https://registry.yarnpkg.com/@types/sqlstring/-/sqlstring-2.3.0.tgz#5960ade0166cfaaa4673fc74ec8157a08d06c89e"
integrity sha512-kMFecDYYFk/f5fljO0UFrSPwU1JxY4mIjX6ic7MHv5nD6sEd3NYLoWcOV/3s6Drs7RHdCwTQdD5NdgVl0I2zzg==

"@types/tinycolor2@^1.4.3":
version "1.4.3"
resolved "https://registry.yarnpkg.com/@types/tinycolor2/-/tinycolor2-1.4.3.tgz#ed4a0901f954b126e6a914b4839c77462d56e706"
Expand Down Expand Up @@ -4352,7 +4357,7 @@ has-property-descriptors@^1.0.0:
dependencies:
get-intrinsic "^1.1.1"

has-symbols@^1.0.1, has-symbols@^1.0.2, has-symbols@^1.0.3:
has-symbols@^1.0.2, has-symbols@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8"
integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==
Expand Down Expand Up @@ -5481,13 +5486,13 @@ object-keys@^1.1.1:
integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==

object.assign@^4.1.0, object.assign@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.2.tgz#0ed54a342eceb37b38ff76eb831a0e788cb63940"
integrity sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==
version "4.1.3"
resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.3.tgz#d36b7700ddf0019abb6b1df1bb13f6445f79051f"
integrity sha512-ZFJnX3zltyjcYJL0RoCJuzb+11zWGyaDbjgxZbdV7rFEcHQuYxrZqhow67aA7xpes6LhojyFDaBKAFfogQrikA==
dependencies:
call-bind "^1.0.0"
define-properties "^1.1.3"
has-symbols "^1.0.1"
call-bind "^1.0.2"
define-properties "^1.1.4"
has-symbols "^1.0.3"
object-keys "^1.1.1"

object.entries@^1.1.5:
Expand Down Expand Up @@ -6090,9 +6095,9 @@ postcss-value-parser@^4.0.0, postcss-value-parser@^4.1.0, postcss-value-parser@^
integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==

postcss@^8.4.13, postcss@^8.4.14, postcss@^8.4.7:
version "8.4.14"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.14.tgz#ee9274d5622b4858c1007a74d76e42e56fd21caf"
integrity sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==
version "8.4.16"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.16.tgz#33a1d675fac39941f5f445db0de4db2b6e01d43c"
integrity sha512-ipHE1XBvKzm5xI7hiHCZJCSugxvsdq2mPnsq5+UF+VHCjiBvtDrlxJfMBToWaP9D5XlgNmcFGqoHmUn0EYEaRQ==
dependencies:
nanoid "^3.3.4"
picocolors "^1.0.0"
Expand Down Expand Up @@ -6902,6 +6907,11 @@ sprintf-js@^1.1.2:
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.1.2.tgz#da1765262bf8c0f571749f2ad6c26300207ae673"
integrity sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==

sqlstring@^2.3.3:
version "2.3.3"
resolved "https://registry.yarnpkg.com/sqlstring/-/sqlstring-2.3.3.tgz#2ddc21f03bce2c387ed60680e739922c65751d0c"
integrity sha512-qC9iz2FlN7DQl3+wjwn3802RTyjCx7sDvfQEXchwa6CWOx07/WVfh91gBmQ9fahw8snwGEWU3xGzOt4tFyHLxg==

stable@^0.1.8:
version "0.1.8"
resolved "https://registry.yarnpkg.com/stable/-/stable-0.1.8.tgz#836eb3c8382fe2936feaf544631017ce7d47a3cf"
Expand Down

0 comments on commit 8e21f3f

Please sign in to comment.