comty.js 0.60.3 → 0.60.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/helpers/handleAfterRequest.js +0 -0
- package/dist/helpers/handleBeforeRequest.js +0 -0
- package/dist/helpers/withSettings.js +0 -0
- package/dist/helpers/withStorage.js +0 -0
- package/dist/hooks/useRequest/index.js +0 -0
- package/dist/index.js +0 -0
- package/dist/models/api/index.js +78 -0
- package/dist/models/auth/index.js +0 -0
- package/dist/models/feed/index.js +0 -0
- package/dist/models/follows/index.js +0 -0
- package/dist/models/index.js +0 -0
- package/dist/models/music/index.js +35 -310
- package/dist/models/music/setters/deleteRelease.js +11 -0
- package/dist/models/music/setters/index.js +36 -0
- package/dist/models/music/setters/putRelease.js +12 -0
- package/dist/models/music/setters/putTrack.js +12 -0
- package/dist/models/nfc/index.js +16 -3
- package/dist/models/payments/index.js +17 -0
- package/dist/models/post/index.js +11 -3
- package/dist/models/search/index.js +0 -0
- package/dist/models/session/index.js +9 -7
- package/dist/models/spectrum/index.js +96 -0
- package/dist/models/sync/index.js +0 -0
- package/dist/models/sync/services/spotify.js +0 -0
- package/dist/models/sync/services/tidal.js +0 -0
- package/dist/models/user/index.js +0 -0
- package/dist/remote.js +5 -1
- package/package.json +2 -2
- package/dist/handlers/measurePing.js +0 -58
- package/dist/handlers/request.js +0 -51
- package/dist/helpers/handleRegenerationEvent.js +0 -43
- package/dist/models/livestream/index.js +0 -84
- package/dist/models/playlists/index.js +0 -124
- package/dist/models/sync/cores/spotifyCore.js +0 -87
- package/dist/models/sync/services/vrc.js +0 -121
- package/dist/models/widget/index.js +0 -18
- package/dist/remotes.js +0 -20
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _request = require('../../../handlers/request'); var _request2 = _interopRequireDefault(_request);
|
|
2
|
-
|
|
3
|
-
class VRCService {
|
|
4
|
-
static __initStatic() {this.base_api_hostname = "https://api.vrchat.cloud/api/1"}
|
|
5
|
-
|
|
6
|
-
static get sync_interface() {
|
|
7
|
-
return globalThis.__comty_shared_state.instances["sync"]
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
static get vrc_interface() {
|
|
11
|
-
return globalThis.__comty_shared_state.instances["vrc"]
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Retrieves the current session data if it exists.
|
|
16
|
-
*
|
|
17
|
-
* @return {Promise<Object>} The session data.
|
|
18
|
-
*/
|
|
19
|
-
static async get_session() {
|
|
20
|
-
const response = await _request2.default.call(void 0, {
|
|
21
|
-
instance: VRCService.sync_interface,
|
|
22
|
-
method: "GET",
|
|
23
|
-
url: "/services/vrc/session",
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
return response.data
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Authenticates the user with the provided username and password.
|
|
31
|
-
* This will store the session data in the server.
|
|
32
|
-
*
|
|
33
|
-
* @param {string} username - The username of the user.
|
|
34
|
-
* @param {string} password - The password of the user.
|
|
35
|
-
* @return {Promise<Object>} A promise that resolves to the data returned by the authentication API.
|
|
36
|
-
*/
|
|
37
|
-
static async auth(username, password, onOtpRequired) {
|
|
38
|
-
let response = null
|
|
39
|
-
|
|
40
|
-
const makeRequest = async () => {
|
|
41
|
-
response = await _request2.default.call(void 0, {
|
|
42
|
-
instance: VRCService.sync_interface,
|
|
43
|
-
method: "POST",
|
|
44
|
-
url: "/services/vrc/auth",
|
|
45
|
-
data: {
|
|
46
|
-
username,
|
|
47
|
-
password,
|
|
48
|
-
},
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
if (response.data.requiresTwoFactorAuth) {
|
|
52
|
-
if (typeof onOtpRequired !== "function") {
|
|
53
|
-
throw new Error("2FA is required, but no (onOtpRequired) was provided")
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
console.log(`2FA Required, invoking onOtpRequired`)
|
|
57
|
-
|
|
58
|
-
return await makeOTPRequest()
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return response.data
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const makeOTPRequest = async () => {
|
|
65
|
-
const otpType = response.data.requiresTwoFactorAuth[0]
|
|
66
|
-
|
|
67
|
-
const otpInput = await onOtpRequired(otpType)
|
|
68
|
-
|
|
69
|
-
console.log(`OTP Result = ${otpInput}`)
|
|
70
|
-
|
|
71
|
-
if (!otpInput) {
|
|
72
|
-
console.error("OTP input was empty, requesting again")
|
|
73
|
-
|
|
74
|
-
return await makeOTPRequest()
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const otpResponse = await _request2.default.call(void 0, {
|
|
78
|
-
instance: VRCService.sync_interface,
|
|
79
|
-
method: "POST",
|
|
80
|
-
url: "/services/vrc/otp",
|
|
81
|
-
data: {
|
|
82
|
-
type: otpType,
|
|
83
|
-
code: otpInput,
|
|
84
|
-
},
|
|
85
|
-
}).catch((err) => {
|
|
86
|
-
console.error(err)
|
|
87
|
-
|
|
88
|
-
return {
|
|
89
|
-
verified: false,
|
|
90
|
-
}
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
console.log(`OTP Response >`, otpResponse.data)
|
|
94
|
-
|
|
95
|
-
if (otpResponse.data.verified) {
|
|
96
|
-
console.log("OTP Verified")
|
|
97
|
-
return await makeRequest()
|
|
98
|
-
} else {
|
|
99
|
-
console.log("OTP Failed")
|
|
100
|
-
return await makeOTPRequest()
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return await makeRequest()
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Logout the current stored session from the server.
|
|
109
|
-
*
|
|
110
|
-
* @return {Promise<Object>} A Promise that resolves to the response data from the logout request.
|
|
111
|
-
*/
|
|
112
|
-
static async logout() {
|
|
113
|
-
const response = await _request2.default.call(void 0, {
|
|
114
|
-
instance: VRCService.sync_interface,
|
|
115
|
-
method: "POST",
|
|
116
|
-
url: "/services/vrc/logout",
|
|
117
|
-
})
|
|
118
|
-
|
|
119
|
-
return response.data
|
|
120
|
-
}
|
|
121
|
-
} VRCService.__initStatic(); exports.default = VRCService;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _request = require('../../handlers/request'); var _request2 = _interopRequireDefault(_request);
|
|
2
|
-
|
|
3
|
-
class WidgetModel {
|
|
4
|
-
static __initStatic() {this.browse = async ({ limit, offset, keywords } = {}) => {
|
|
5
|
-
const response = await _request2.default.call(void 0, {
|
|
6
|
-
instance: globalThis.__comty_shared_state.instances["marketplace"],
|
|
7
|
-
method: "GET",
|
|
8
|
-
url: "/widgets",
|
|
9
|
-
params: {
|
|
10
|
-
limit,
|
|
11
|
-
offset,
|
|
12
|
-
keywords: JSON.stringify(keywords),
|
|
13
|
-
},
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
return response.data
|
|
17
|
-
}}
|
|
18
|
-
} WidgetModel.__initStatic(); exports.default = WidgetModel;
|
package/dist/remotes.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }function getCurrentHostname() {
|
|
2
|
-
if (typeof window === "undefined") {
|
|
3
|
-
return "localhost"
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
return _nullishCoalesce(_optionalChain([window, 'optionalAccess', _ => _.location, 'optionalAccess', _2 => _2.hostname]), () => ( "localhost"))
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const envOrigins = {
|
|
10
|
-
"development": `http://${getCurrentHostname()}:9000`,
|
|
11
|
-
"indev": "https://indev_api.comty.app",
|
|
12
|
-
"production": "https://api.comty.app",
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
exports. default = {
|
|
16
|
-
default: {
|
|
17
|
-
origin: envOrigins[_nullishCoalesce(process.env.NODE_ENV, () => ( "production"))],
|
|
18
|
-
hasWebsocket: false,
|
|
19
|
-
}
|
|
20
|
-
}
|