refactor: extract shared utilities in asset build, LXC script and portal JS - #4
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
…rtal JS Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pure refactor of the three code files in the repo; no behavior change. Generated asset output is verified byte-identical (
sha256sumover all 184 generated PNG/ICO/SVG files, before vs. after).scripts/brandkit.py(new) — shared rendering layer for the asset pipeline.build-assets.pyhad the per-brand loop and the webOwie/Proxmox block duplicating the samemkdir(parents=True,exist_ok=True)+contain(...).save(...)idiom (~14 call sites) and re-rendering the same two webOwie SVGs a second time. brandkit now owns the primitives (render_svgislru_cached, so the second webOwie render is free), the deliverable size tables (FAVICON_SIZES,APP_ICONS,BANNER_SIZES,SOCIAL_SIZES), the color/width constants, and the set-level helpers:build-assets.pybecomesbuild_brand()/build_proxmox()/main()over those helpers. Insidebanner(),max(28,int(h*.07))/max(14,int(h*.035))were recomputed 3×/2× per banner — nowbrand_size/tagline_sizelocals.scripts/create-netbootxyz-alpine-lxc.sh— replaced the repeated literal prefixes with helpers:step N "..."(wasecho "[N/8] ...", hardcoded step total in 8 places),warn,kvfor the aligned summary block,alpine_templatesfor the twice-repeatedpveam available --section system, andcontainer_ipfor thepct exec … ip -4 addr show eth0 …one-liner. In the embedded installer, the duplicatedcurl -fL --retry 5 --connect-timeout 20invocations collapse intofetch <file>,echo "[container] …"intolog, and the nginxautoindex/add_headerpair that was copied into bothlocationblocks moves up to theserverblock (location /then becomes empty and is dropped — the server-levelrootalready serves it).brand.js— the raw-content base URL was hardcoded three times (manifest URL, initialmanifeststate,rawAssetfallback); now oneRAW_BASE(plusREPO_BASE). AddedbyId/on(selector,type,fn)for the repeatedgetElementByIdandquerySelectorAll(...).forEach(el=>el.addEventListener(...))pattern, andassetRow/assetNoticeso the empty-state and error-state markup no longer duplicate the.asset-rowwrapper.fallbackMark(brand)→markFallback(label)(it only ever used.name).Link to Devin session: https://app.devin.ai/sessions/844676b8009d4dc3a1d4f40ff90a5810
Requested by: @puchadave