diff --git a/frontend/package.json b/frontend/package.json index 972a4889..39d85801 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -39,7 +39,7 @@ "pinia": "^3.0.4", "pretty-bytes": "^7.2.0", "tus-js-client": "^4.3.1", - "utif": "^3.2.0", + "utif": "^3.1.0", "video.js": "^8.24.2", "videojs-hotkeys": "^0.2.30", "videojs-mobile-ui": "^1.2.7", diff --git a/frontend/public/img/artcraft/NOTICE.md b/frontend/public/img/artcraft/NOTICE.md new file mode 100644 index 00000000..7c2b4c80 --- /dev/null +++ b/frontend/public/img/artcraft/NOTICE.md @@ -0,0 +1,5 @@ +Original application icons downloaded from https://getartcraft.com/images/apps//icon.webp on 2026-11-01. + +Applications and original artwork: ArtCraft / storytold. These icons identify the corresponding third-party applications and do not imply affiliation. + +Official application pages: https://getartcraft.com/apps diff --git a/frontend/public/img/artcraft/cadcraft.webp b/frontend/public/img/artcraft/cadcraft.webp new file mode 100644 index 00000000..256295ac Binary files /dev/null and b/frontend/public/img/artcraft/cadcraft.webp differ diff --git a/frontend/public/img/artcraft/deckcraft.webp b/frontend/public/img/artcraft/deckcraft.webp new file mode 100644 index 00000000..fdcd817b Binary files /dev/null and b/frontend/public/img/artcraft/deckcraft.webp differ diff --git a/frontend/public/img/artcraft/designcraft.webp b/frontend/public/img/artcraft/designcraft.webp new file mode 100644 index 00000000..872709e6 Binary files /dev/null and b/frontend/public/img/artcraft/designcraft.webp differ diff --git a/frontend/public/img/artcraft/figcraft.webp b/frontend/public/img/artcraft/figcraft.webp new file mode 100644 index 00000000..e4ec3786 Binary files /dev/null and b/frontend/public/img/artcraft/figcraft.webp differ diff --git a/frontend/public/img/artcraft/gridcraft.webp b/frontend/public/img/artcraft/gridcraft.webp new file mode 100644 index 00000000..11a24148 Binary files /dev/null and b/frontend/public/img/artcraft/gridcraft.webp differ diff --git a/frontend/public/img/artcraft/lightcraft.webp b/frontend/public/img/artcraft/lightcraft.webp new file mode 100644 index 00000000..c86ad0c1 Binary files /dev/null and b/frontend/public/img/artcraft/lightcraft.webp differ diff --git a/frontend/public/img/artcraft/pdfcraft.webp b/frontend/public/img/artcraft/pdfcraft.webp new file mode 100644 index 00000000..54031303 Binary files /dev/null and b/frontend/public/img/artcraft/pdfcraft.webp differ diff --git a/frontend/public/img/artcraft/photocraft.webp b/frontend/public/img/artcraft/photocraft.webp new file mode 100644 index 00000000..1a1bfc6b Binary files /dev/null and b/frontend/public/img/artcraft/photocraft.webp differ diff --git a/frontend/public/img/artcraft/soundcraft.webp b/frontend/public/img/artcraft/soundcraft.webp new file mode 100644 index 00000000..e8a6d02b Binary files /dev/null and b/frontend/public/img/artcraft/soundcraft.webp differ diff --git a/frontend/public/img/artcraft/vectorcraft.webp b/frontend/public/img/artcraft/vectorcraft.webp new file mode 100644 index 00000000..4e51cc4e Binary files /dev/null and b/frontend/public/img/artcraft/vectorcraft.webp differ diff --git a/frontend/public/img/artcraft/wordcraft.webp b/frontend/public/img/artcraft/wordcraft.webp new file mode 100644 index 00000000..e9dbcdf1 Binary files /dev/null and b/frontend/public/img/artcraft/wordcraft.webp differ diff --git a/frontend/scripts/check-artcraft-menus.cjs b/frontend/scripts/check-artcraft-menus.cjs new file mode 100644 index 00000000..90ff4596 --- /dev/null +++ b/frontend/scripts/check-artcraft-menus.cjs @@ -0,0 +1,143 @@ +const fs = require("node:fs"), + path = require("node:path"), + assert = require("node:assert/strict"); +const { chromium } = require(process.env.PLAYWRIGHT_MODULE); +(async () => { + const base = process.env.FILEBROWSER_QA_URL, + out = process.env.FILEBROWSER_QA_OUTPUT; + fs.mkdirSync(out, { recursive: true }); + const browser = await chromium.launch({ + executablePath: process.env.BROWSER_EXECUTABLE, + headless: true, + args: ["--use-angle=swiftshader", "--enable-unsafe-swiftshader"], + }); + try { + const context = await browser.newContext({ + viewport: { width: 1440, height: 1000 }, + }), + page = await context.newPage(); + const errors = []; + page.on("pageerror", (error) => errors.push(String(error))); + await page.goto(base + "/files/"); + await page.locator(".item").first().waitFor(); + await page.locator(".workspace-actions-button").click(); + const root = page.locator(".context-menu:not(.context-submenu)"); + assert.equal( + await root + .getByRole("menuitem", { name: "Создать папку", exact: true }) + .count(), + 1 + ); + await root + .getByRole("menuitem", { name: "Создать файл", exact: true }) + .click(); + const fileMenu = page.locator(".context-submenu").first(); + assert.equal( + await fileMenu + .getByRole("button", { name: "Создать папку", exact: true }) + .count(), + 0 + ); + await fileMenu + .getByRole("menuitem", { name: "ArtCraft", exact: true }) + .click(); + const craftMenu = page.locator(".context-submenu").last(); + await craftMenu + .getByRole("menuitem", { name: "WordCraft (.docx)", exact: true }) + .waitFor(); + assert.equal(await craftMenu.locator(".create-app-icon").count(), 4); + await page.screenshot({ path: path.join(out, "create-file-artcraft.png") }); + await craftMenu + .getByRole("menuitem", { name: "WordCraft (.docx)", exact: true }) + .click(); + await page.locator("#focus-prompt").waitFor(); + assert.equal(await page.locator(".context-menu").count(), 0); + await page + .getByRole("button", { name: "Отмена", exact: true }) + .last() + .click(); + await page + .locator('.item[aria-label="document.docx"]') + .click({ button: "right" }); + await root.locator(".action-app-icon").first().waitFor(); + assert( + await root + .locator(".action-app-icon") + .first() + .evaluate((icon) => icon.complete && icon.naturalWidth > 0) + ); + await page.keyboard.press("Escape"); + await page.goto(base + "/settings/profile"); + await page + .getByRole("button", { name: "Настройки автооткрытия", exact: true }) + .click(); + const dialog = page.getByRole("dialog", { name: "Настройки автооткрытия" }); + assert((await dialog.locator(".auto-open-row").count()) > 200); + await dialog.getByRole("searchbox").fill(".jpg"); + await dialog + .locator('select[aria-label=".jpg"]') + .selectOption("photocraft"); + await dialog.getByRole("searchbox").fill(".wav"); + await dialog.locator('select[aria-label=".wav"]').selectOption("download"); + await page.screenshot({ path: path.join(out, "auto-open-search.png") }); + await dialog.locator("footer button").click(); + const saved = page.waitForResponse( + (r) => r.request().method() === "PUT" && r.url().includes("/api/users/") + ); + await page.locator(".settings-save button").click(); + assert.equal((await saved).status(), 200); + let user = await (await page.request.get(base + "/api/session")).json(); + assert.equal(user.autoOpen[".jpg"], "photocraft"); + assert.equal(user.autoOpen[".wav"], "download"); + await page.reload(); + await page + .getByRole("button", { name: "Настройки автооткрытия", exact: true }) + .click(); + await dialog.getByRole("searchbox").fill(".jpg"); + assert.equal( + await dialog.locator('select[aria-label=".jpg"]').inputValue(), + "photocraft" + ); + await page.keyboard.press("Escape"); + await page.goto(base + "/files/"); + const popup = context.waitForEvent("page"); + await page.locator('.item[aria-label="photo.jpg"]').dblclick(); + const editor = await popup; + await editor.waitForURL("**/editor/photocraft?**"); + await editor.close(); + const download = page.waitForEvent("download"); + await page.locator('.item[aria-label="tone.wav"]').dblclick(); + assert.equal((await download).suggestedFilename(), "tone.wav"); + await page.goto(base + "/settings/global"); + const status = await ( + await page.request.get(base + "/api/media/status") + ).json(); + assert.equal(status.available, true); + await page.getByRole("heading", { name: "FFmpeg", exact: true }).waitFor(); + await page.getByText("Доступен", { exact: true }).waitFor(); + await page.screenshot({ path: path.join(out, "ffmpeg-status.png") }); + await page.setViewportSize({ width: 390, height: 844 }); + await page.goto(base + "/files/"); + await page.locator(".workspace-actions-button").click(); + await root + .getByRole("menuitem", { name: "Создать файл", exact: true }) + .click(); + await page + .locator(".context-submenu") + .first() + .getByRole("menuitem", { name: "ArtCraft", exact: true }) + .click(); + await craftMenu + .getByRole("menuitem", { name: "WordCraft (.docx)", exact: true }) + .waitFor(); + const bounds = await craftMenu.boundingBox(); + assert(bounds.x >= 0 && bounds.x + bounds.width <= 390); + await page.screenshot({ path: path.join(out, "menus-mobile.png") }); + assert.deepEqual(errors, []); + console.log( + "ArtCraft menus/icons, folder action, persisted auto-open preferences, editor/download routing, FFmpeg status and mobile submenu passed" + ); + } finally { + await browser.close(); + } +})(); diff --git a/frontend/src/components/Sidebar.vue b/frontend/src/components/Sidebar.vue index ad1d9af1..0c9cb03c 100644 --- a/frontend/src/components/Sidebar.vue +++ b/frontend/src/components/Sidebar.vue @@ -63,8 +63,8 @@ diff --git a/frontend/src/components/files/CraftAction.vue b/frontend/src/components/files/CraftAction.vue index fba3cdc6..2d8e1739 100644 --- a/frontend/src/components/files/CraftAction.vue +++ b/frontend/src/components/files/CraftAction.vue @@ -2,7 +2,7 @@ @@ -15,6 +15,7 @@ import { useI18n } from "vue-i18n"; import { useAuthStore } from "@/stores/auth"; import { useAddonsStore } from "@/stores/addons"; import Action from "@/components/header/Action.vue"; +import { baseURL } from "@/utils/constants"; const props = defineProps<{ file?: { name: string; url: string; isDir: boolean } | null; }>(); diff --git a/frontend/src/components/files/CreateMenu.vue b/frontend/src/components/files/CreateMenu.vue index 58b84898..bca7434a 100644 --- a/frontend/src/components/files/CreateMenu.vue +++ b/frontend/src/components/files/CreateMenu.vue @@ -8,7 +8,9 @@ @click.stop="expanded = !expanded" @keydown.right.stop.prevent="expand" > - {{ t("buttons.create") }}{{ + craftOnly ? "ArtCraft" : t("explorer.createFile") + }} @@ -18,7 +20,7 @@ class="context-menu context-submenu" role="menu" :data-context-owner="owner?.id" - :aria-label="t('buttons.create')" + :aria-label="craftOnly ? 'ArtCraft' : t('explorer.createFile')" :style="{ left: left + 'px', top: top + 'px' }" @click.stop="choose" @contextmenu.prevent.stop @@ -30,9 +32,11 @@ class="action" @click.stop="collapse" > - {{ t("buttons.create") }} + {{ + craftOnly ? "ArtCraft" : t("explorer.createFile") + }} - + @@ -41,6 +45,7 @@ import { inject, nextTick, onBeforeUnmount, ref, watch } from "vue"; import { useI18n } from "vue-i18n"; import { contextMenuKey, submenuPosition } from "@/utils/context-menu"; import CreateOptions from "./CreateOptions.vue"; +defineProps<{ craftOnly?: boolean }>(); const { t } = useI18n(), owner = inject(contextMenuKey); const expanded = ref(false), @@ -51,10 +56,9 @@ const submenu = ref(), trigger = ref(); function position() { if (!submenu.value || !trigger.value) return; - const parent = trigger.value - .closest(".context-menu") - ?.getBoundingClientRect(); - if (!parent) return; + const parent = + trigger.value.closest(".context-menu")?.getBoundingClientRect() || + trigger.value.getBoundingClientRect(); const row = trigger.value.getBoundingClientRect(), panel = submenu.value.getBoundingClientRect(); compact.value = window.innerWidth < parent.width + panel.width + 24; @@ -80,6 +84,11 @@ function collapse() { trigger.value?.focus({ preventScroll: true }); } function choose(event: MouseEvent) { + if ( + event.target instanceof Element && + event.target.closest('button[aria-haspopup="menu"]') + ) + return; if (!(event.target instanceof Element) || !event.target.closest("button")) return; expanded.value = false; diff --git a/frontend/src/components/files/CreateOptions.vue b/frontend/src/components/files/CreateOptions.vue index 761468c1..9a91f16c 100644 --- a/frontend/src/components/files/CreateOptions.vue +++ b/frontend/src/components/files/CreateOptions.vue @@ -1,8 +1,4 @@ + diff --git a/frontend/src/components/files/DirectoryTree.vue b/frontend/src/components/files/DirectoryTree.vue new file mode 100644 index 00000000..a72b502f --- /dev/null +++ b/frontend/src/components/files/DirectoryTree.vue @@ -0,0 +1,111 @@ + + + diff --git a/frontend/src/components/files/ListingItem.vue b/frontend/src/components/files/ListingItem.vue index 65a77062..c3cf3a9f 100644 --- a/frontend/src/components/files/ListingItem.vue +++ b/frontend/src/components/files/ListingItem.vue @@ -51,7 +51,11 @@ + diff --git a/frontend/src/components/files/ResourcePreview.vue b/frontend/src/components/files/ResourcePreview.vue index 3737abdc..9d5a6d43 100644 --- a/frontend/src/components/files/ResourcePreview.vue +++ b/frontend/src/components/files/ResourcePreview.vue @@ -25,19 +25,10 @@ class="resource-image" @error="failed = true" /> -