refactor: Download API

Now the download APIs are moved into a new file
This commit is contained in:
Peng-YM
2022-06-30 12:19:43 +08:00
parent 9653b09844
commit bb87a6c41e
14 changed files with 231 additions and 220 deletions

15
backend/src/utils/flow.js Normal file
View File

@@ -0,0 +1,15 @@
import { HTTP } from '@/vendor/open-api';
export async function getFlowHeaders(url) {
const http = HTTP();
const { headers } = await http.get({
url,
headers: {
'User-Agent': 'Quantumult%20X/1.0.30 (iPhone14,2; iOS 15.6)',
},
});
const subkey = Object.keys(headers).filter((k) =>
/SUBSCRIPTION-USERINFO/i.test(k),
)[0];
return headers[subkey];
}