{
export class PostUploadCommandData {
constructor(public readonly post: ScrapedPostDetails, public readonly siteId: string) {}
}
+
+export class SetPostUploadInfoData {
+ constructor(public readonly postId: string, public readonly info: PostUploadInfo) {}
+}
+
+export class SetExactPostId {
+ constructor(public readonly postId: string, public readonly exactPostId: number) {}
+}
diff --git a/src/options/Options.vue b/src/options/App.vue
similarity index 93%
rename from src/options/Options.vue
rename to src/options/App.vue
index 9fc7abd..1819b4f 100644
--- a/src/options/Options.vue
+++ b/src/options/App.vue
@@ -2,6 +2,7 @@
import { useColorMode } from "@vueuse/core";
import SzuruWrapper from "~/api";
import { Config, SzuruSiteConfig } from "~/config";
+import { getErrorMessage } from "~/utils";
let autoSearchSimilar = ref(false);
let loadTagCounts = ref(false);
@@ -17,7 +18,7 @@ const selectedSite = computed(() => {
}
});
-type StatusType = "ok" | "error";
+type StatusType = "success" | "error";
async function testConnection() {
if (
@@ -32,7 +33,7 @@ async function testConnection() {
const api = new SzuruWrapper(selectedSite.value.domain, selectedSite.value.username, selectedSite.value.authToken);
try {
- const info = (await api.getInfo());
+ const info = await api.getInfo();
const instanceName = info?.config.name;
if (instanceName == undefined) {
@@ -41,9 +42,7 @@ async function testConnection() {
setStatus(`Connected to ${info.config.name} at ${selectedSite.value.domain}`);
}
} catch (ex) {
- // TODO: This error message is not very descriptive.
- console.dir(ex);
- setStatus("Couldn't connect to " + selectedSite.value.domain + "\n\n" + ex, "error");
+ setStatus(`Couldn't connect to ${selectedSite.value.domain}. ${getErrorMessage(ex)}`, "error");
}
}
@@ -62,7 +61,7 @@ async function saveSettings() {
setStatus("Settings successfully saved");
}
-function setStatus(text: string, type: StatusType = "ok") {
+function setStatus(text: string, type: StatusType = "success") {
statusText.value = text;
statusType.value = "status-" + type;
}
@@ -197,6 +196,8 @@ let mode = useColorMode({ emitAuto: true });
+ {{ statusText }}
+
@@ -243,6 +244,14 @@ html.dark .content-wrapper {
line-height: 120%;
}
+.status-error {
+ color: red;
+}
+
+.status-success {
+ color: green;
+}
+
label {
display: block;
padding: 0.3em 0;
diff --git a/src/options/main.ts b/src/options/main.ts
index aff9403..18addf6 100644
--- a/src/options/main.ts
+++ b/src/options/main.ts
@@ -1,5 +1,5 @@
import { createApp } from "vue";
-import App from "./Options.vue";
+import App from "./App.vue";
import { setupApp } from "~/logic/common-setup";
import "../styles";
diff --git a/src/popup/Popup.vue b/src/popup/App.vue
similarity index 75%
rename from src/popup/Popup.vue
rename to src/popup/App.vue
index 5a44f6e..e9ad6ca 100644
--- a/src/popup/Popup.vue
+++ b/src/popup/App.vue
@@ -1,27 +1,28 @@