@@ -93,7 +93,7 @@ local function finalize(_, _, extra_data)
|
|||||||
local files_arg = table.concat(extra_data.exported_files, " ")
|
local files_arg = table.concat(extra_data.exported_files, " ")
|
||||||
|
|
||||||
local command = string.format(
|
local command = string.format(
|
||||||
"darktable-publish --title '%s' --slug '%s' %s",
|
"darktable-ghost-cms-publish --title '%s' --slug '%s' %s",
|
||||||
extra_data.title, extra_data.slug, files_arg
|
extra_data.title, extra_data.slug, files_arg
|
||||||
)
|
)
|
||||||
if extra_data.keywords ~= "" then
|
if extra_data.keywords ~= "" then
|
||||||
@@ -123,7 +123,7 @@ local function supported(_, _)
|
|||||||
end
|
end
|
||||||
|
|
||||||
dt.register_storage(
|
dt.register_storage(
|
||||||
"ghost_publish",
|
"ghost_cms_publish",
|
||||||
"publish to Ghost CMS",
|
"publish to Ghost CMS",
|
||||||
store,
|
store,
|
||||||
finalize,
|
finalize,
|
||||||
|
@@ -51,7 +51,7 @@ const upload = async (
|
|||||||
const key = await getAdminApiKey();
|
const key = await getAdminApiKey();
|
||||||
const token = createJwt(key);
|
const token = createJwt(key);
|
||||||
|
|
||||||
const f = Bun.file(path, { type });
|
const f = file(path, { type });
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("file", f);
|
formData.append("file", f);
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import { basename, extname } from "path";
|
import { basename, extname } from "path";
|
||||||
|
import { file } from "bun";
|
||||||
|
|
||||||
export interface FileInfo {
|
export interface FileInfo {
|
||||||
jpegPath: string;
|
jpegPath: string;
|
||||||
@@ -29,7 +30,7 @@ export const prepareFiles = async (files: string[]): Promise<FileInfo[]> => {
|
|||||||
const jpegPath = parts[0].replace(/\\:/g, ":");
|
const jpegPath = parts[0].replace(/\\:/g, ":");
|
||||||
const rawPath = parts[1]?.replace(/\\:/g, ":");
|
const rawPath = parts[1]?.replace(/\\:/g, ":");
|
||||||
|
|
||||||
const jpegFile = Bun.file(jpegPath);
|
const jpegFile = file(jpegPath);
|
||||||
if (!(await jpegFile.exists())) {
|
if (!(await jpegFile.exists())) {
|
||||||
throw new Error(`JPEG file not found: ${jpegPath}`);
|
throw new Error(`JPEG file not found: ${jpegPath}`);
|
||||||
}
|
}
|
||||||
@@ -47,7 +48,7 @@ export const prepareFiles = async (files: string[]): Promise<FileInfo[]> => {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const rawFile = Bun.file(rawPath);
|
const rawFile = file(rawPath);
|
||||||
if (!(await rawFile.exists())) {
|
if (!(await rawFile.exists())) {
|
||||||
throw new Error(`RAW file not found: ${rawPath}`);
|
throw new Error(`RAW file not found: ${rawPath}`);
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,7 @@ import { uploadFile, uploadImage, uploadPost } from "./api";
|
|||||||
import { getBasenameWithExtension, prepareFiles } from "./files";
|
import { getBasenameWithExtension, prepareFiles } from "./files";
|
||||||
|
|
||||||
new Command()
|
new Command()
|
||||||
.name("darktable-publish")
|
.name("darktable-ghost-cms-publish")
|
||||||
.description("Publish files to GHOST CMS with optional metadata.")
|
.description("Publish files to GHOST CMS with optional metadata.")
|
||||||
.option("-t, --title [string]", "Specify the title")
|
.option("-t, --title [string]", "Specify the title")
|
||||||
.option("-s, --slug [string]", "Specify the slug")
|
.option("-s, --slug [string]", "Specify the slug")
|
||||||
|
Reference in New Issue
Block a user