From 62e36ef228aaa2dd6c4d06be72cbaba2d61b3cab Mon Sep 17 00:00:00 2001 From: MengYX Date: Sat, 18 Jul 2020 21:58:07 +0800 Subject: [PATCH] Change IXarea Api Endpoint --- src/App.vue | 3 ++- src/decrypt/qmc.js | 17 ++++++++++++----- src/decrypt/util.js | 1 + 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/App.vue b/src/App.vue index a1dcb85..b5fba53 100644 --- a/src/App.vue +++ b/src/App.vue @@ -62,6 +62,7 @@ import preview from "./component/preview" import {DownloadBlobMusic, RemoveBlobMusic} from "./component/util" import config from "../package" + import {IXAREA_API_ENDPOINT} from "./decrypt/util"; export default { name: 'app', @@ -91,7 +92,7 @@ if (!!mask) mask.remove(); let updateInfo; try { - const resp = await fetch("https://stats.ixarea.com/collect/music/app-version", { + const resp = await fetch(IXAREA_API_ENDPOINT + "/music/app-version", { method: "POST", headers: {"Content-Type": "application/json"}, body: JSON.stringify({"Version": this.version}) }); diff --git a/src/decrypt/qmc.js b/src/decrypt/qmc.js index 10b2171..d772e55 100644 --- a/src/decrypt/qmc.js +++ b/src/decrypt/qmc.js @@ -1,4 +1,12 @@ -import {AudioMimeType, DetectAudioExt, GetArrayBuffer, GetFileInfo, GetMetaCoverURL, GetWebImage} from "./util"; +import { + AudioMimeType, + DetectAudioExt, + GetArrayBuffer, + GetFileInfo, + GetMetaCoverURL, + GetWebImage, + IXAREA_API_ENDPOINT +} from "./util"; import {QmcMaskCreate58, QmcMaskDetectMflac, QmcMaskDetectMgg, QmcMaskGetDefault} from "./qmcMask"; import {fromByteArray as Base64Encode, toByteArray as Base64Decode} from 'base64-js' @@ -101,7 +109,7 @@ export async function Decrypt(file, raw_filename, raw_ext) { } function reportKeyUsage(keyData, maskData, artist, title, album, filename, format) { - fetch("https://stats.ixarea.com/collect/qmcmask/usage", { + fetch(IXAREA_API_ENDPOINT + "/qmcmask/usage", { method: "POST", headers: {"Content-Type": "application/json"}, body: JSON.stringify({ @@ -113,7 +121,7 @@ function reportKeyUsage(keyData, maskData, artist, title, album, filename, forma async function queryKeyInfo(keyData, filename, format) { try { - const resp = await fetch("https://stats.ixarea.com/collect/qmcmask/query", { + const resp = await fetch(IXAREA_API_ENDPOINT + "/qmcmask/query", { method: "POST", headers: {"Content-Type": "application/json"}, body: JSON.stringify({Format: format, Key: Base64Encode(keyData), Filename: filename, Type: 44}), @@ -126,8 +134,7 @@ async function queryKeyInfo(keyData, filename, format) { } async function queryAlbumCoverImage(artist, title, album) { - //https://stats.ixarea.com/collect - const song_query_url = "http://localhost:6580/music/qq-cover" + const song_query_url = IXAREA_API_ENDPOINT + "/music/qq-cover" try { const resp = await fetch(song_query_url, { method: "POST", diff --git a/src/decrypt/util.js b/src/decrypt/util.js index ffb5b9f..8139b68 100644 --- a/src/decrypt/util.js +++ b/src/decrypt/util.js @@ -16,6 +16,7 @@ export const AudioMimeType = { wma: "audio/x-ms-wma", wav: "audio/x-wav" }; +export const IXAREA_API_ENDPOINT = "https://stats.ixarea.com/apis" // Also a new draft API: blob.arrayBuffer() export async function GetArrayBuffer(blobObject) {