diff --git a/.goreleaser.yml b/.goreleaser.yml index a485ed5..46972c4 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -10,7 +10,7 @@ builds: env: - CGO_ENABLED=0 binary: OliveTin - main: main.go + main: . dir: service goos: - linux diff --git a/var/marketing/Makefile b/var/marketing/Makefile index a827093..3f15221 100644 --- a/var/marketing/Makefile +++ b/var/marketing/Makefile @@ -1,7 +1,7 @@ updatescreenshots: - repo-common-take-screenshot mainpage-darkop http://localhost:1337/ 1024 680 --dark - repo-common-take-screenshot mainpage-laptop http://localhost:1337/ 1024 680 - repo-common-take-screenshot mainpage-phone http://localhost:1337/ 600 1160 + SCREENSHOT_DIR=screenshots SHOT_WIDTH=1024 SHOT_HEIGHT=680 SHOT_DARK=1 repo-helper screenshot mainpage-darkop http://localhost:1337/ --width 1024 --height 680 --script resize_viewport.py + SCREENSHOT_DIR=screenshots SHOT_WIDTH=1024 SHOT_HEIGHT=680 repo-helper screenshot mainpage-laptop http://localhost:1337/ --width 1024 --height 680 --script resize_viewport.py + SCREENSHOT_DIR=screenshots SHOT_WIDTH=600 SHOT_HEIGHT=1160 repo-helper screenshot mainpage-phone http://localhost:1337/ --width 600 --height 1160 --script resize_viewport.py repo-common-image-framer .PHONY: updatescreenshots diff --git a/var/marketing/__pycache__/resize_viewport.cpython-314.pyc b/var/marketing/__pycache__/resize_viewport.cpython-314.pyc new file mode 100644 index 0000000..3bd4e36 Binary files /dev/null and b/var/marketing/__pycache__/resize_viewport.cpython-314.pyc differ diff --git a/var/marketing/resize_viewport.py b/var/marketing/resize_viewport.py new file mode 100644 index 0000000..cb6eb43 --- /dev/null +++ b/var/marketing/resize_viewport.py @@ -0,0 +1,24 @@ +import os + +from selenium.webdriver.common.by import By +from selenium.webdriver.support.ui import WebDriverWait + +from repo_helper.screenshot import set_viewport_size + + +def _enable_dark_mode(driver): + driver.execute_cdp_cmd( + "Emulation.setEmulatedMedia", + {"features": [{"name": "prefers-color-scheme", "value": "dark"}]}, + ) + + +def run(driver): + WebDriverWait(driver, 30).until( + lambda d: bool(d.find_element(By.TAG_NAME, "body").get_attribute("loaded-dashboard")) + ) + if os.environ.get("SHOT_DARK") == "1": + _enable_dark_mode(driver) + width = int(os.environ["SHOT_WIDTH"]) + height = int(os.environ["SHOT_HEIGHT"]) + set_viewport_size(driver, width, height) diff --git a/var/marketing/screenshots/mainpage-darkop.png b/var/marketing/screenshots/mainpage-darkop.png index 565c932..d565af9 100644 Binary files a/var/marketing/screenshots/mainpage-darkop.png and b/var/marketing/screenshots/mainpage-darkop.png differ diff --git a/var/marketing/screenshots/mainpage-darkop_framed.png b/var/marketing/screenshots/mainpage-darkop_framed.png index 2343a42..8c0546e 100644 Binary files a/var/marketing/screenshots/mainpage-darkop_framed.png and b/var/marketing/screenshots/mainpage-darkop_framed.png differ diff --git a/var/marketing/screenshots/mainpage-laptop.png b/var/marketing/screenshots/mainpage-laptop.png index c96a480..2e09db1 100644 Binary files a/var/marketing/screenshots/mainpage-laptop.png and b/var/marketing/screenshots/mainpage-laptop.png differ diff --git a/var/marketing/screenshots/mainpage-laptop_framed.png b/var/marketing/screenshots/mainpage-laptop_framed.png index c38b5a4..2c7ccab 100644 Binary files a/var/marketing/screenshots/mainpage-laptop_framed.png and b/var/marketing/screenshots/mainpage-laptop_framed.png differ diff --git a/var/marketing/screenshots/mainpage-phone.png b/var/marketing/screenshots/mainpage-phone.png index 5c42715..d881642 100644 Binary files a/var/marketing/screenshots/mainpage-phone.png and b/var/marketing/screenshots/mainpage-phone.png differ diff --git a/var/marketing/screenshots/mainpage-phone_framed.png b/var/marketing/screenshots/mainpage-phone_framed.png index c0d984f..7a6ba5c 100644 Binary files a/var/marketing/screenshots/mainpage-phone_framed.png and b/var/marketing/screenshots/mainpage-phone_framed.png differ diff --git a/var/windows/OliveTin.wxs b/var/windows/OliveTin.wxs index 7884d8a..ebb8345 100644 --- a/var/windows/OliveTin.wxs +++ b/var/windows/OliveTin.wxs @@ -17,7 +17,7 @@ - + diff --git a/var/windows/build-msi.sh b/var/windows/build-msi.sh index 2efca19..b1eb6fe 100755 --- a/var/windows/build-msi.sh +++ b/var/windows/build-msi.sh @@ -63,6 +63,15 @@ if [[ ! -f "${SOURCE_ROOT}/config.yaml" ]]; then exit 1 fi +if ! command -v objdump >/dev/null; then + echo "objdump is required to verify OliveTin.exe Windows resources" >&2 + exit 1 +fi +if ! objdump -h "${SOURCE_ROOT}/OliveTin.exe" | grep -q '[[:space:]]\.rsrc[[:space:]]'; then + echo "OliveTin.exe is missing embedded Windows resources (.rsrc); use main: . in .goreleaser.yml" >&2 + exit 1 +fi + mkdir -p "${APP_STAGING}/webui" cp "${SOURCE_ROOT}/OliveTin.exe" "${APP_STAGING}/" cp -a "${SOURCE_ROOT}/webui/." "${APP_STAGING}/webui/" @@ -89,4 +98,9 @@ wixl \ "${SCRIPT_DIR}/OliveTin.wxs" \ "${HEAT_WXS}" +if ! msiinfo export "${MSI_PATH}" Media 2>/dev/null | grep -q '#cab1.cab'; then + echo "MSI cabinet is not embedded (expected #cab1.cab in Media table); check EmbedCab in OliveTin.wxs" >&2 + exit 1 +fi + echo "Built ${MSI_PATH}" diff --git a/var/windows/generate-resources.sh b/var/windows/generate-resources.sh index d1ad41c..7830b74 100755 --- a/var/windows/generate-resources.sh +++ b/var/windows/generate-resources.sh @@ -91,4 +91,10 @@ trap 'rm -rf "${WORK_DIR}" "${TOOL_BIN%/*}"' EXIT rm -f "${SERVICE_DIR}"/resource_windows_*.syso mv "${WORK_DIR}"/resource_windows_*.syso "${SERVICE_DIR}/" + +if ! compgen -G "${SERVICE_DIR}/resource_windows_*.syso" >/dev/null; then + echo "goversioninfo did not produce resource_windows_*.syso files" >&2 + exit 1 +fi + echo "Wrote Windows resource files to ${SERVICE_DIR}"