2021-04-03 17:46:54 +00:00
|
|
|
"use strict";
|
|
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
|
|
};
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
const express_1 = __importDefault(require("express"));
|
2021-05-23 20:42:02 +00:00
|
|
|
// @ts-expect-error
|
|
|
|
const deezer_js_1 = require("deezer-js");
|
|
|
|
const main_1 = require("../main");
|
2021-04-03 17:46:54 +00:00
|
|
|
const router = express_1.default.Router();
|
|
|
|
/**
|
|
|
|
* GET home page
|
|
|
|
*
|
|
|
|
* @since 0.0.0
|
|
|
|
*/
|
|
|
|
router.get('/', (_, res) => {
|
2021-05-23 20:42:02 +00:00
|
|
|
res.render('index', { title: 'deemix' });
|
|
|
|
});
|
|
|
|
router.get('/connect', (req, res) => {
|
|
|
|
if (!main_1.sessionDZ[req.session.id])
|
|
|
|
main_1.sessionDZ[req.session.id] = new deezer_js_1.Deezer();
|
|
|
|
const dz = main_1.sessionDZ[req.session.id];
|
|
|
|
const result = {
|
|
|
|
update: {
|
|
|
|
currentCommit: 'testing',
|
|
|
|
latestCommit: 'testing',
|
|
|
|
updateAvailable: false,
|
|
|
|
deemixVersion: '3.0_beta'
|
|
|
|
},
|
|
|
|
autologin: !dz.logged_in,
|
|
|
|
currentUser: dz.current_user,
|
|
|
|
deezerNotAvailable: false
|
|
|
|
};
|
2021-06-05 11:58:50 +00:00
|
|
|
const queue = main_1.getQueue();
|
|
|
|
if (Object.keys(queue.queue).length > 0) {
|
|
|
|
result.queue = queue;
|
2021-05-23 20:42:02 +00:00
|
|
|
}
|
|
|
|
res.send(result);
|
2021-04-03 17:46:54 +00:00
|
|
|
});
|
|
|
|
exports.default = router;
|