debug
This commit is contained in:
parent
559c49233b
commit
91a6cde261
1 changed files with 5 additions and 21 deletions
26
index.js
26
index.js
|
|
@ -1,8 +1,8 @@
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
|
|
||||||
const botBearerFile = process.env.BOT_BEARER_FILE;
|
const botBearerFile = process.env.BOT_BEARER_FILE || '/dev/null';
|
||||||
const userBearerFile = process.env.USER_BEARER_FILE;
|
const userBearerFile = process.env.USER_BEARER_FILE || '/dev/null';
|
||||||
const instance = process.env.INSTANCE || 'shigusegubu.club';
|
const instance = process.env.INSTANCE || 'shigusegubu.club';
|
||||||
const videoId = process.env.VIDEO_ID;
|
const videoId = process.env.VIDEO_ID;
|
||||||
|
|
||||||
|
|
@ -34,7 +34,7 @@ const app = await fetch(`https://${instance}/api/v1/apps`, {
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
client_name: 'HJ Stream Bot',
|
client_name: 'HJ Stream Bot',
|
||||||
redirect_uris: 'urn:ietf:wg:oauth:2.0:oob',
|
redirect_uris: 'urn:ietf:wg:oauth:2.0:oob',
|
||||||
scopes: 'write:scrobbles',
|
scopes: 'write write:scrobbles',
|
||||||
}),
|
}),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
mode: 'cors',
|
mode: 'cors',
|
||||||
|
|
@ -76,24 +76,7 @@ const dataString = Object.entries(data).reduce((acc, [k, v]) => {
|
||||||
}
|
}
|
||||||
}, '');
|
}, '');
|
||||||
|
|
||||||
console.log(`AUTH: ${instance}/oauth/authorize?${dataString}`);
|
console.log(`AUTH: https://${instance}/oauth/authorize?${dataString}`);
|
||||||
|
|
||||||
const auth = await fetch(`https://${instance}/oauth/authorize`, {
|
|
||||||
headers: {
|
|
||||||
accept: 'application/json',
|
|
||||||
'cache-control': 'no-cache',
|
|
||||||
'content-type': 'application/json',
|
|
||||||
pragma: 'no-cache',
|
|
||||||
},
|
|
||||||
body: JSON.stringify({
|
|
||||||
client_id,
|
|
||||||
response_type: 'code',
|
|
||||||
grant_type: 'client_credentials',
|
|
||||||
redirect_uris: 'urn:ietf:wg:oauth:2.0:oob',
|
|
||||||
}),
|
|
||||||
method: 'POST',
|
|
||||||
mode: 'cors',
|
|
||||||
});
|
|
||||||
/* */
|
/* */
|
||||||
|
|
||||||
const post = ({
|
const post = ({
|
||||||
|
|
@ -172,6 +155,7 @@ const loop = async () => {
|
||||||
external_link: `https://tube.ebin.club/w/${videoId}`,
|
external_link: `https://tube.ebin.club/w/${videoId}`,
|
||||||
});
|
});
|
||||||
console.info('scrobble: ' + scrobbleResult.status);
|
console.info('scrobble: ' + scrobbleResult.status);
|
||||||
|
console.info('scrobble: ' + await scrobbleResult.json());
|
||||||
} else {
|
} else {
|
||||||
console.info('Went offline...');
|
console.info('Went offline...');
|
||||||
await scrobble({
|
await scrobble({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue