* feat(library): open the shelf filtered from a #/library?tag= link (#668) workspace#/library?tag=<name>&tag=<name>&tag_mode=all|any|untagged opens the Prompt library with those Tags and that Tag match, as Refine and Browse do. Old tag bookmarks are sent to this form. The filter stays in the hash until the shelf has mounted with it, then the address becomes #/library. A link is rendered even when the shelf is already open. A link that cannot be read opens the whole shelf and says so. * feat: old admin, gallery and metadata URLs lead into the workspace (#668) /prompt_manager/gallery answers 302 to workspace#/images and /prompt_manager/gallery.html to workspace#/inspect. The Location is relative, so a reverse-proxy prefix is kept. /prompt_manager/admin serves a small page that maps the old hash in the browser (the server never sees it): the dashboard opens the Prompt library, #/tags opens Tags & categories, and a tag bookmark such as #/tags/a,b?mode=or opens the Library filtered by those tags (workspace#/library?tag=a&tag=b&tag_mode=any). The mapping is web/js/legacy-links.js. The browser specs that drove the old pages go; the specs that only checked the old URLs now follow the redirects. The page files themselves are removed in the next commit. * chore: delete the old admin, gallery and metadata pages (#668) Removes web/admin.html, gallery.html, metadata.html, their controllers (admin.js, gallery.js, tags-page.js) and the ten helper modules only they loaded, with their unit tests. The vendored Tailwind build and the Makefile that rebuilt it go too: nothing else used them. Kept and still tested: comfy-metadata.js (its PromptManagerPair tests move to comfy-metadata.test.js), api-client.js, gallery-settings.js, png-metadata.js, cache-ownership.js. The inspector's Copy settings summary keeps its pinned COPY ALL template as a frozen copy in its test. The Viewer.js fixture suite drove the old controllers; it is now a smoke of the vendored build alone. The System coverage table has no row kept in legacy any more (the four become approved removals), and the table of ids removed from the old pages goes with the pages it checked. Coverage floors of the remaining files are unchanged; the deleted files' entries are removed. * docs: the old pages are gone, their URLs lead into the workspace (#668) README lists where each old URL now opens, with a tag-bookmark example and the workspace link form. README-legacy says the pages it describes were removed. TESTING.md records D207 (redirects, the bookmark mapping and the #/library?tag= form), D208 (no editing surface for records used only as a negative; data and exports kept) and D209 (the four System rows that were kept in legacy), and no longer says the old pages stay at their URLs. * fix(library): a Library link leaves title focus to the shell (#668) The shell focuses a page title on a navigation inside the workspace and never on the first render. A Library link followed that for the first, but also focused the title when the page was loaded directly on the link. * test: compare old-URL landings without building patterns from text (#668) Code scanning flagged two test lines: a regular expression built from a hash with only / and # escaped, and a regular expression used to cut <noscript> and <script> out of the redirect page. The address is now compared by its parts, and the page's inline script is found by plain string search. * feat(library): keep the tag filter in the address (#668) Ruling after the live test: a tag link used to become #/library once the shelf had its filter, so Reload and Back then Forward showed the whole Library. The address now stays #/library?tag=a&tag=b&tag_mode=any|untagged, in one canonical spelling. It is the truth for Tags and Tag match: Reload, Back and Forward restore the filter, a change in Refine replaces the address without a history entry, and #/library (the sidebar link, the old dashboard URL) always means no tag filter. Search, category, folder, sort and the archived shelf stay out of the address. The way back from a prompt's page and Browse on Tags & categories go to the filtered address. A saved view keeps its own address.
31 lines
1019 B
Python
31 lines
1019 B
Python
"""The node's Recent request must name a sort the server whitelists."""
|
|
|
|
import os
|
|
import re
|
|
import sys
|
|
import unittest
|
|
|
|
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
sys.path.insert(0, ROOT)
|
|
|
|
from database.operations import SORT_ORDERS
|
|
|
|
NODE_EXTENSION = os.path.join(ROOT, "web", "comfy", "prompt_manager.js")
|
|
|
|
|
|
class TestSortContract(unittest.TestCase):
|
|
def test_node_recent_button_requests_recently_used(self):
|
|
# The node extension can't import the shared module (ComfyUI load order is
|
|
# not guaranteed), so it sends the key directly; it must be a server key.
|
|
with open(NODE_EXTENSION, encoding="utf-8") as fh:
|
|
source = fh.read()
|
|
match = re.search(r"/prompt_manager/recent\?[^`'\"]*sort=([a-z_]+)", source)
|
|
|
|
self.assertIsNotNone(match, "node Recent request does not send a sort")
|
|
self.assertEqual(match.group(1), "last_used_desc")
|
|
self.assertIn(match.group(1), SORT_ORDERS)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|