File size: 2,123 Bytes
2a7394b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import axios from 'axios';

const api = axios.create({
  baseURL: '/api',
  timeout: 100000,
  headers: {
    'Content-Type': 'application/json',
  },
});


// 测试代理
export const testProxy = async (data: any) => {
  return api.post('/test_proxy', data);
};

// 初始化注册
export const initialize = async (data: any) => {
  return api.post('/initialize', data, {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  });
};

// 验证验证码
export const verifyCaptha = async (data:any) => {
  return api.post('/verify_captcha',data, {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  });
};

// 注册账号
export const register = async (data: any) => {
  return api.post('/register', data, {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  });
};

// 获取邮箱验证码
export const getEmailVerificationCode = async (data: any) => {
  return api.post('/get_email_verification_code', data);
};

// 激活账号
export const activateAccounts = async (key: string, names: string[], all: boolean=false) => {
  return api.post('/activate_account_with_names', { key, names, all });
};

// 获取账号列表
export const fetchAccounts = async () => {
  return api.get('/fetch_accounts');
};

// 删除账号
export const deleteAccount = async (filename: string) => {
  const formData = new FormData();
  formData.append('filename', filename);
  return api.post('/delete_account', formData, {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  });
};

// 批量删除账号
export const deleteAccounts = async (filenames: string[]) => {
  const formData = new FormData();
  
  // 将多个文件名添加到 FormData
  filenames.forEach(filename => {
    formData.append('filenames', filename);
  });
  
  return api.post('/delete_account', formData, {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  });
};

// 更新账号
export const updateAccount = async (filename: string, accountData: any) => {
  return api.post('/update_account', {
    filename,
    account_data: accountData,
  });
};

export default api;