mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
Fixed backwards compatibility
This commit is contained in:
@ -5,6 +5,13 @@ const axios = require('axios');
|
|||||||
const { setOptions } = require('../../config/plugins');
|
const { setOptions } = require('../../config/plugins');
|
||||||
const getSongInfo = require('../../providers/song-info');
|
const getSongInfo = require('../../providers/song-info');
|
||||||
|
|
||||||
|
const defaultSettings = {
|
||||||
|
enabled: true,
|
||||||
|
api_root: "http://ws.audioscrobbler.com/2.0/",
|
||||||
|
api_key: "04d76faaac8726e60988e14c105d421a", // api key registered by @semvis123
|
||||||
|
secret: "a5d2a36fdf64819290f6982481eaffa2",
|
||||||
|
}
|
||||||
|
|
||||||
const createFormData = (params) => {
|
const createFormData = (params) => {
|
||||||
// creates the body for in the post request
|
// creates the body for in the post request
|
||||||
let formData = new URLSearchParams();
|
let formData = new URLSearchParams();
|
||||||
@ -138,7 +145,13 @@ let scrobbleTimer = undefined;
|
|||||||
|
|
||||||
const lastfm = async (win, config) => {
|
const lastfm = async (win, config) => {
|
||||||
const registerCallback = getSongInfo(win);
|
const registerCallback = getSongInfo(win);
|
||||||
|
|
||||||
|
if (!config.api_root){
|
||||||
|
// settings are not present, creating them with the default values
|
||||||
|
config = defaultSettings;
|
||||||
|
setOptions('last-fm', config);
|
||||||
|
}
|
||||||
|
|
||||||
if (!config.session_key) {
|
if (!config.session_key) {
|
||||||
// not authenticated
|
// not authenticated
|
||||||
config = await getAndSetSessionKey(config);
|
config = await getAndSetSessionKey(config);
|
||||||
|
|||||||
Reference in New Issue
Block a user