chore(cli): only load url from globals data
This commit is contained in:
parent
3d20361355
commit
fdd556df83
6 changed files with 25 additions and 23 deletions
|
@ -4,8 +4,8 @@ import { program } from 'commander';
|
|||
import chalk from 'chalk';
|
||||
import figlet from 'figlet';
|
||||
import { loadConfig } from '../lib/config.js';
|
||||
import { runRootScript } from '../lib/runScript.js';
|
||||
import { handleExitError } from '../lib/handlers.js';
|
||||
import { runRootScript } from '../lib/runScript.js';
|
||||
import { runJobsMenu } from '../lib/jobs.js';
|
||||
import { runTasksMenu } from '../lib/tasks/index.js';
|
||||
|
||||
|
|
|
@ -136,7 +136,9 @@ export const initConfig = async () => {
|
|||
config.directus = { ...(config.directus || {}), apiUrl };
|
||||
}
|
||||
|
||||
config.globals = await fetchGlobals();
|
||||
const globals = await fetchGlobals();
|
||||
|
||||
config.url = globals.url;
|
||||
|
||||
await fs.ensureDir(CACHE_DIR);
|
||||
await fs.writeJson(CONFIG_PATH, config, { spaces: 2 });
|
||||
|
|
|
@ -21,7 +21,7 @@ export const runJobsMenu = async () => {
|
|||
{
|
||||
name: '💿 Scrobble listens from Navidrome',
|
||||
type: 'curl',
|
||||
apiUrl: `${config.globals.url}/api/scrobble.php`,
|
||||
apiUrl: `${config.url}/api/scrobble.php`,
|
||||
tokenEnvVar: 'NAVIDROME_SCROBBLE_TOKEN',
|
||||
method: 'POST'
|
||||
},
|
||||
|
@ -35,14 +35,14 @@ export const runJobsMenu = async () => {
|
|||
{
|
||||
name: '🐘 Send posts to Mastodon',
|
||||
type: 'curl',
|
||||
apiUrl: `${config.globals.url}/api/mastodon.php`,
|
||||
apiUrl: `${config.url}/api/mastodon.php`,
|
||||
tokenEnvVar: 'MASTODON_SYNDICATION_TOKEN',
|
||||
method: 'POST'
|
||||
},
|
||||
{
|
||||
name: '🎤 Import artist from Navidrome',
|
||||
type: 'curl',
|
||||
apiUrl: `${config.globals.url}/api/artist-import.php`,
|
||||
apiUrl: `${config.url}/api/artist-import.php`,
|
||||
tokenEnvVar: 'ARTIST_IMPORT_TOKEN',
|
||||
method: 'POST',
|
||||
paramsPrompt: [{
|
||||
|
@ -55,7 +55,7 @@ export const runJobsMenu = async () => {
|
|||
{
|
||||
name: '📖 Import book',
|
||||
type: 'curl',
|
||||
apiUrl: `${config.globals.url}/api/book-import.php`,
|
||||
apiUrl: `${config.url}/api/book-import.php`,
|
||||
tokenEnvVar: 'BOOK_IMPORT_TOKEN',
|
||||
method: 'POST',
|
||||
paramsPrompt: [{
|
||||
|
@ -68,7 +68,7 @@ export const runJobsMenu = async () => {
|
|||
{
|
||||
name: '📽 Import movie or show',
|
||||
type: 'curl',
|
||||
apiUrl: `${config.globals.url}/api/watching-import.php`,
|
||||
apiUrl: `${config.url}/api/watching-import.php`,
|
||||
tokenEnvVar: 'WATCHING_IMPORT_TOKEN',
|
||||
method: 'POST',
|
||||
tokenIncludeInParams: true,
|
||||
|
@ -89,7 +89,7 @@ export const runJobsMenu = async () => {
|
|||
{
|
||||
name: '📺 Import upcoming TV seasons',
|
||||
type: 'curl',
|
||||
apiUrl: `${config.globals.url}/api/seasons-import.php`,
|
||||
apiUrl: `${config.url}/api/seasons-import.php`,
|
||||
tokenEnvVar: 'SEASONS_IMPORT_TOKEN',
|
||||
method: 'POST'
|
||||
}];
|
||||
|
|
10
cli/package-lock.json
generated
10
cli/package-lock.json
generated
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "coryd",
|
||||
"version": "3.2.3",
|
||||
"version": "3.2.4",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "coryd",
|
||||
"version": "3.2.3",
|
||||
"version": "3.2.4",
|
||||
"dependencies": {
|
||||
"@directus/sdk": "^19.1.0",
|
||||
"chalk": "^5.4.1",
|
||||
|
@ -432,9 +432,9 @@
|
|||
"license": "MIT"
|
||||
},
|
||||
"node_modules/brace-expansion": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
|
||||
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
|
||||
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "coryd",
|
||||
"version": "3.2.3",
|
||||
"version": "3.2.4",
|
||||
"description": "The CLI for my site to run scripts, manage and download assets.",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
|
18
package-lock.json
generated
18
package-lock.json
generated
|
@ -668,9 +668,9 @@
|
|||
"license": "ISC"
|
||||
},
|
||||
"node_modules/brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"version": "1.1.12",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
|
||||
"integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
@ -756,9 +756,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/caniuse-lite": {
|
||||
"version": "1.0.30001721",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001721.tgz",
|
||||
"integrity": "sha512-cOuvmUVtKrtEaoKiO0rSc29jcjwMwX5tOHDy4MgVFEWiUXj4uBMJkwI8MDySkgXidpMiHUcviogAvFi4pA2hDQ==",
|
||||
"version": "1.0.30001722",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001722.tgz",
|
||||
"integrity": "sha512-DCQHBBZtiK6JVkAGw7drvAMK0Q0POD/xZvEmDp6baiMMP6QXXk9HpD6mNYBZWhOPG6LvIDb82ITqtWjhDckHCA==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
|
@ -1757,9 +1757,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/glob/node_modules/brace-expansion": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
|
||||
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
|
||||
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue