poke/src/libpoketube/libpoketube-initsys.js

155 lines
2.8 KiB
JavaScript
Raw Normal View History

2022-10-28 16:46:35 +02:00
/*
PokeTube is a Free/Libre youtube front-end !
2023-04-02 18:53:59 +02:00
Copyright (C) 2021-2023 POKETUBE
2022-10-28 16:46:35 +02:00
This file is Licensed under LGPL-3.0-or-later. Poketube itself is GPL, Only this file is LGPL.
2023-06-04 16:11:41 +02:00
see a copy here: https://www.gnu.org/licenses/lgpl-3.0.txt
2022-10-28 16:46:35 +02:00
please dont remove this comment while sharing this code
2023-06-04 16:11:41 +02:00
*/
2022-10-28 16:46:35 +02:00
2023-09-09 18:55:15 +02:00
const fetcher = require("../libpoketube/libpoketube-dislikes.js");
2023-06-04 16:11:41 +02:00
const core = require("../libpoketube/libpoketube-core.js");
const musicInfo = require("music-info");
const wiki = require("wikipedia");
const fetch = require("node-fetch");
const toJson = require("xml2json").toJson;
const express = require("express");
const useragent = require("express-useragent");
const path = require("path");
const hash = require("js-sha512").sha384;
const moment = require("moment");
const getColors = require("get-image-colors");
/**
* Logs a message to the console with a specific prefix
*
* @param {string} args - The message to wood (get it log wood im so funny)
*/
function initlog(args) {
console.log("[LIBPT INTSYS] " + args);
2022-11-09 15:17:03 +01:00
}
2023-06-04 16:11:41 +02:00
/**
* Initializes the application and starts listening on the specified port or something idk aaaaa help me
*
* @param {object} app - The express application
* @param {string} [port="3000"] - The port to listen on
*/
function init(app, port) {
2023-11-07 05:11:19 +01:00
if (!port) port = "6003";
2022-11-09 15:17:03 +01:00
try {
2023-06-04 16:11:41 +02:00
app.listen(port, () => {
initlog("Loading Poketube: success!" + " on port " + port);
});
2022-11-09 15:17:03 +01:00
} catch (err) {
2023-06-04 16:11:41 +02:00
initlog("Loading Poketube: error", err);
}
2022-11-09 15:17:03 +01:00
}
2023-06-04 16:11:41 +02:00
module.exports = {
/**
* The fetcher module
* @type {object}
*/
fetcher,
/**
* The core module
* @type {object}
*/
core,
/**
* The musicInfo module
* @type {object}
*/
musicInfo,
/**
* The wiki module
* @type {object}
*/
wiki,
/**
* Logs a message to the console with a specific prefix
* @type {Function}
*/
2022-11-09 15:17:03 +01:00
initlog,
2023-06-04 16:11:41 +02:00
/**
* Initializes the application and starts listening on the specified port
* @type {Function}
*/
2022-11-09 15:17:03 +01:00
init,
2023-06-04 16:11:41 +02:00
/**
* The version of the LIB-PokeTube module
* @type {string}
*/
version: "libpoketube-3.1.1-git-aStfl",
/**
* The external modules used by PokeTube
* @type {object}
*/
modules: {
/**
* The fetch module
* @type {object}
*/
fetch,
/**
* The toJson module
* @type {Function}
*/
toJson,
/**
* The express module
* @type {object}
*/
express,
/**
* The useragent module
* @type {object}
*/
useragent,
/**
* The path module
* @type {object}
*/
path,
/**
* The hash module
* @type {Function}
*/
hash,
/**
* The moment module
* @type {object}
*/
moment,
/**
* The getColors module
* @type {Function}
*/
getColors,
2022-10-29 09:49:18 +02:00
}
2023-06-04 16:11:41 +02:00
};