Skip to content

Commit

Permalink
fix: iife
Browse files Browse the repository at this point in the history
  • Loading branch information
crashmax-dev committed May 17, 2024
1 parent ae167ac commit db5192b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 29 deletions.
54 changes: 26 additions & 28 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,40 +38,38 @@ import { BASE_URL, DATA, DEVICE, HOST } from './strings'
import { http, logger, qs, readSettings } from './utils'
import type { ISessionCheck } from './interfaces/SessionCheck'

;(() => {
if (qs('#main_wrap')) {
try {
/**
* ! Для работы Spaces+ необходима авторизация
* * 00000 - Авторизированы
* * 01001 - Требуется авторизация
*/
http<ISessionCheck>('POST', `${BASE_URL}/api/session/check`, false).then(
(e) => {
const response = e.parsedBody
if (qs('#main_wrap')) {
try {
/**
* ! Для работы Spaces+ необходима авторизация
* * 00000 - Авторизированы
* * 01001 - Требуется авторизация
*/
http<ISessionCheck>('POST', `${BASE_URL}/api/session/check`, false).then(
(e) => {
const response = e.parsedBody

if (response && userStatus(response.code)) {
// Временно храним ник
DATA.USERNAME = response.attributes.name
if (response && userStatus(response.code)) {
// Временно храним ник
DATA.USERNAME = response.attributes.name

// Временно храним CK
DATA.CK = response.attributes.CK
// Временно храним CK
DATA.CK = response.attributes.CK

// Временно храним SID
DATA.SID = response?.attributes.sid
// Временно храним SID
DATA.SID = response?.attributes.sid

// Инициализируем работу
init()
}

logger.info('Проверка сессии', e)
// Инициализируем работу
init()
}
)
} catch (e) {
logger.error('main.ts', e)
}

logger.info('Проверка сессии', e)
}
)
} catch (e) {
logger.error('main.ts', e)
}
})()
}

const init = () => {
// Script error.
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default defineConfig((config) => {
require: `${basePath}libs/colorpicker.js`,
match: DOMAINS.map((domain) => `https://${domain}/*`),
updateURL: `${pkg.homepage}${pkg.name}.meta.js`,
downloadURL: `${pkg.homepage}${pkg.name}.user.js`,
downloadURL: `${pkg.homepage}${pkg.name}.user.js`
},
server: {
port: 3000
Expand Down

1 comment on commit db5192b

@Azq2
Copy link

@Azq2 Azq2 commented on db5192b May 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this? Code for Elon Musk's SpaceX?

Please sign in to comment.