# Weather-o for iPhone Duo

## Current status

The app work is finished: all four cities have square and wider animated boards, display presets, PNG export, offline packaging and optional local city selection. Existing wallpapers and Live Photo exports are preserved. The production build and automated scene and preservation checks pass.

The hosted viewer and wallpaper endpoint use **https://weather-o.vercel.app** on Vercel. The custom hostname `weather-o.saksham.pro` is attached to that project and awaiting its GoDaddy CNAME record. Domain ownership is already verified. Nothing has been installed on an iPhone. Browser rendering checks could not run in this workspace because it blocks the temporary local server (`listen EPERM`); Safari, Live Photo eligibility and folding behavior still need testing on the actual phone. The hosted endpoint has separate selection and failure tests.

The iPhone Duo is a released Apple phone, introduced September 9, 2026 and available October 23. Its closed body is passport sized. Hardware verified November 25, 2026 against [Apple’s announcement](https://www.apple.com/newsroom/2026/09/apple-unveils-iphone-duo/) and [technical specifications](https://www.apple.com/iphone-duo/specs/).

| Display | Wallpaper pixels | Scene |
| --- | --- | --- |
| 5.4-inch outer, closed | 1398 × 2034 | Original square board |
| 7.6-inch inner, open landscape | 2670 × 1878 | Wider board with additional districts |
| 7.6-inch inner, open portrait | 1878 × 2670 | Same wider board, reframed |

The board shape and the wallpaper image shape are distinct. The outer wallpaper is portrait; its wooden city board remains square. Apple's inner resolution is listed in portrait order; the landscape preset rotates it. CSS viewport sizes vary with scale, browser controls and multitasking. Auto adapts at a 600 CSS pixel window width; it does not read a hinge sensor. Use an explicit display preset if needed.

## Build and verify

From this folder, run `npm install` if dependencies aren't already installed in the parent project, then `npm run build`. The production website is `dist/`, with no CDN requests. `npm run check` starts an ephemeral local server, checks the real build in headless Chrome, writes screenshots to `out/checks/`, and closes the browser and server. Set `CHROME` to your Chrome executable if it isn't in the standard macOS location.

For a manual preview, `npm start` serves the production viewer build. The hosted build under `hosting/weather-o/` also supplies the wallpaper endpoint. On-device Safari, wallpaper eligibility and fold transitions still need physical-device testing.

## Hosted wallpaper updates: city, weather and time

The hosted architecture serves this viewer and **`/api/wallpaper`** from the same HTTPS origin on Vercel. Use **https://weather-o.vercel.app** while the custom hostname **`weather-o.saksham.pro`** waits for the GoDaddy CNAME record below and TLS validation. The local `npm start` preview serves only the viewer, not this endpoint.

The phone sends its location to the endpoint, which selects the nearest supported city within 125 km, looks up that city's current weather, chooses dawn/day/dusk/night from sunrise and sunset, and returns an actual PNG. No Mac server, Tailscale or VPN is needed after publication. It uses ordinary mobile data or Wi-Fi.

The first hosted catalog uses the **136 existing portrait PNGs** in the [public wallpapers release](https://github.com/saksham-uw/weather-o/releases/tag/wallpapers). It does not claim that the newer Closed/Open/Upright exports are already published. You can still export those layouts from the viewer. City selection uses distance to a city centre, not municipal boundaries. Outside the supported area, the endpoint returns an error so the shortcut can keep the existing wallpaper.

### Make the Update Weather-o shortcut

First save a PNG from the viewer into Photos and add it in **Settings → Wallpaper**. Use this Photos wallpaper as the destination below.

1. Create a shortcut named **Update Weather-o** and add **Get Current Location**.
2. Add **Get Details of Locations → Latitude** using that location. Save its result as the variable **Latitude**.
3. Add another **Get Details of Locations → Longitude**, explicitly selecting the original Current Location result, not the previous Latitude output. Save its result as **Longitude**.
4. Add a **URL** action containing `https://weather-o.vercel.app/api/wallpaper`. Once the custom domain is active, you can use `https://weather-o.saksham.pro/api/wallpaper` instead.
5. Add **Get Contents of URL**. Select **POST**, set **Request Body → JSON**, and add two **Number** fields: `latitude` = the Latitude variable and `longitude` = the Longitude variable. Passing numbers as JSON avoids URL encoding and decimal formatting problems. Do not use **Open URLs**; the response must pass into the next action.
6. Add **Get Images from Input**, using the Contents of URL result.
7. Add **If** the Images result **has any value**. Inside the If branch, add **Set Wallpaper Photo**, explicitly select the Images result, choose your Photos wallpaper, and turn off **Show Preview** or any equivalent option requiring interaction. Choose the Lock Screen and/or Home Screen destination available on your iOS version. In Otherwise, stop the shortcut without changing the wallpaper. Some network errors stop the shortcut before this check, also leaving the existing wallpaper in place.
8. Run it manually once while unlocked. Allow location, network and wallpaper permissions, confirm the selected destination, and check the crop on both displays. Then test it when locked after enabling the automatic-run settings below. These are instructions; no shortcut has been installed on your phone by this project.

Apple documents [making API requests from Shortcuts](https://support.apple.com/en-tm/guide/shortcuts/apd58d46713f/ios) and the [Set Wallpaper Photo action](https://support.apple.com/en-am/101583).

### Schedule updates on the phone

Attach **Arrive** automations for the places you visit in the supported cities to **Update Weather-o**. Each trigger runs the same shortcut; the phone's location determines the city. Adjust the map circles to useful arrival areas. Also add **Time of Day** automations for times such as morning, midday, sunset and night so weather and lighting can change while you stay in one place. Avoid a permanently running shortcut or a loop with long waits.

Enable execution without confirmation and allow running when locked. Apple's current guide uses the shortcut's **Edit → Automation** to attach a trigger and **Edit → Info → Privacy → Allow Running When Locked**. On versions with a separate automation editor, use the **Automation** tab and choose **Run Immediately** or turn off **Ask Before Running** when offered. Test each trigger on the installed iOS version; some actions may still require their own permissions. See Apple's [automation guide](https://support.apple.com/guide/shortcuts/add-automations-apdfbdbd7123/ios).

The website cannot wake Shortcuts when weather changes. Updates occur when an arrival, scheduled time or other configured iOS trigger runs. The phone must have Internet access for a fresh image; offline operation keeps the existing wallpaper. The API delivers still PNGs, not a Live Photo pair or a continuously animated wallpaper, and does not change wallpapers when the phone folds.

### Endpoint behavior and deployment source

`hosting/weather-o/` contains the hosted viewer source, shared wallpaper selection code, Vercel function entry points, verified PNG catalog and tests. `npm test` checks selection and failures; `npm run build` or `npm run build:vercel` builds the static viewer. `vercel.json` configures Vercel to serve `viewer/dist/` and deploy the functions in `api/` with Node.js 24. `npm run sync-viewer` refreshes the checked-in viewer copy from `app/` when developing in this repository; builds use the copy so the hosted source can also build independently after installing its locked dependency. The earlier Worker build is available separately as `npm run build:sites` and is not needed by Vercel.

The API accepts POST JSON with `latitude` and `longitude`. For manual previews it also accepts GET parameters: `city`, `weather`, `time`, `season` (`auto`, `normal`, `winter`) and `format` (`image` or `json`). For example, `/api/wallpaper?city=toronto&weather=rain&time=night` returns a PNG with no weather lookup. `?city=toronto&format=json` returns current selection metadata and a deterministic image URL. `/api/health` reports the supported catalog.

Current conditions and sunrise/sunset come from [Open-Meteo](https://open-meteo.com/en/docs), fetched for the public city centre rather than forwarding the phone's precise coordinates. Forecasts are reused for up to ten minutes within a Worker instance. Dawn and dusk span 45 minutes either side of sunrise and sunset. Automatic winter decoration uses December–February in the city's timezone and only selects winter variants present in the catalog; it is not a measurement of snow on the ground. Snow in Delhi/Udaipur falls back to the available overcast scene. A metadata response reports this substitution. Upstream failures return an error rather than inventing clear weather or returning an HTML page as a wallpaper.

The implementation has no location database or application logging, though hosting providers may retain normal request logs. POST keeps phone coordinates out of the request URL. Open-Meteo and GitHub are external dependencies, so failures leave the phone's current wallpaper in place. Physical iPhone permissions, background execution and crop behavior still need on-device testing.

### Connect weather-o.saksham.pro

The custom hostname is attached to the **weather-o** project in the **saksham-uws-projects** Vercel account. Vercel has already verified ownership; only the subdomain's DNS routing is pending. The authoritative nameservers are GoDaddy's `ns57.domaincontrol.com` and `ns58.domaincontrol.com`.

In **GoDaddy → Domain Portfolio → saksham.pro → DNS → Add New Record**, add this record. GoDaddy's Name field uses only the subdomain prefix:

| Type | Name | Value |
| --- | --- | --- |
| CNAME | `weather-o` | `36b1a439e6c235a0.vercel-dns-017.com.` |

Leave TTL at GoDaddy's default. This is the exact recommended CNAME returned by Vercel for this project; no new TXT record or nameserver change is required. Keep Gmail's existing MX, SPF, DKIM and DMARC records as they are. The earlier ChatGPT Sites CNAME and verification TXT instructions are superseded by this Vercel record.

After the record propagates, verify the domain with `npx --yes vercel@latest domains verify weather-o.saksham.pro --scope saksham-uws-projects`. Vercel provisions TLS after DNS is correct. DNS changes have not been performed from this workspace. The Vercel deployment URL works independently of this custom-domain setup. See [GoDaddy's CNAME instructions](https://www.godaddy.com/help/add-a-cname-record-19236) and [Vercel's external DNS setup guide](https://vercel.com/docs/domains/set-up-custom-domain).

## Automatic city wallpapers, without Tailscale

Use **on-device Shortcuts arrival automations** to switch between wallpapers already saved on your iPhone. After the one-time transfer and setup, changing the wallpaper needs no Mac server, Tailscale, VPN or wallpaper download. You do not need to install the animated web viewer. The supported cities are Toronto, Mississauga, Delhi and Udaipur.

These are setup instructions, not an installed automation: the shortcuts and their location triggers still need to be configured and tested on your iPhone. Apple documents [location triggers](https://support.apple.com/guide/shortcuts/travel-triggers-apd8ebfc4e8e/ios), [automations that run without asking](https://support.apple.com/guide/shortcuts/add-automations-apdfbdbd7123/ios), and the [Switch Between Wallpapers action](https://support.apple.com/en-am/101583).

### 1. Put each city's wallpaper on your phone

In the Mac viewer, choose a city and the Closed display, click **Save wallpaper**, then AirDrop the PNG to your iPhone and save it in Photos. Repeat for the cities you use. If you prefer to render all four without opening the viewer, run this from the project folder on your Mac:

```sh
npm install
node app/render.mjs --city toronto,mississauga,delhi,udaipur --display closed --time dusk --weather clear --still
```

The PNGs are saved in `app/out/<city>/`, for example `app/out/toronto/toronto_dusk_clear_closed.png`. AirDrop those PNGs into Photos once. This command creates still images; their weather and time of day remain the chosen clear/dusk scene. To compare wider crops, use `--display both` and transfer the `_open.png` versions too.

On iPhone, open **Settings → Wallpaper → Add New Wallpaper → Photos** and make a wallpaper for each city. Choose **Set as Wallpaper Pair**, or customize the Home Screen separately. Check the crop with the phone open and closed. This automation switches the saved wallpaper as a whole; it does not select separate image files for the two displays.

### 2. Make a shortcut that switches to one city

1. In **Shortcuts**, create a shortcut named **Weather-o Toronto**.
2. Add **Switch Between Wallpapers**. Tap its wallpaper parameter and select the Toronto wallpaper you just created. Choose that specific wallpaper rather than an option that asks you to choose each time.
3. Run the shortcut manually. Allow any requested permissions and check that the correct Lock Screen and Home Screen appear.
4. Repeat for Mississauga, Delhi and Udaipur as needed, selecting the corresponding saved wallpaper each time.

Switching an existing wallpaper keeps its already configured image and crop. If you later create and verify an eligible Live Photo wallpaper manually, you can select that saved wallpaper instead; automated switching itself does not create a Live Photo or enable animation.

### 3. Run each shortcut when you arrive

1. Add an **Arrive** automation for **Weather-o Toronto**. In the current Shortcuts layout, open the shortcut and choose **Edit → Automation → Arrive**. On versions with the separate automation editor, use **Automation → + → Arrive**, then choose the existing **Weather-o Toronto** shortcut.
2. Choose a Toronto location and adjust the blue circle on the map to cover the arrival area you want. Set the time option to **Any**.
3. Enable execution without confirmation. Apple's current guide uses **Edit → Info → Privacy → Allow Running When Locked**. If your version shows **Run Immediately**, select it; if it shows **Ask Before Running**, turn that off. Complete any action-specific permission prompts during the manual test.
4. Repeat with the appropriate location and shortcut for each other city.

Choose non-overlapping arrival areas, particularly for Toronto and Mississauga. If the map cannot define a useful non-overlapping area for the whole city, use places you arrive at, such as home, work or an airport. **Arrive detects entry into the circle you configure; it is not a city-boundary-change event.** It does not guarantee a switch at the municipal boundary. Outside your configured areas, the last selected wallpaper stays in place.

Run the current city's shortcut manually once to set the initial wallpaper; an Arrive trigger may not fire merely because you enabled it while already inside its area. Then check a real departure and return with the phone locked. Keep Location Services enabled and confirm the shortcut is allowed to run when locked. If the manual run works but arrival does not, check the trigger area and automatic-run settings on the phone.

This setup changes the actual system wallpaper using saved city images. The viewer's **Use my city** button only changes the open viewer. Updating the scene for live weather or time of day needs additional shortcut actions and rendered variants; weather lookups can use ordinary mobile data or Wi-Fi, without Tailscale. Continuous Three.js animation and fold-triggered wallpaper changes are not part of this city automation.

## Optional: install the animated viewer

The animated viewer lets you explore and export scenes. It is independent of the city wallpaper automations above. For a quick first wallpaper, use the Mac viewer and AirDrop its PNG; hosting is only needed if you also want to open or install the viewer on the phone.

A Mac's `localhost` preview address only works on the Mac itself. The private setup below has **not** been performed, and there is no phone installation link yet. It is an optional viewer installation method, not a requirement for automatic city wallpapers.

### Optional private installation using your Mac

1. Install [Tailscale](https://tailscale.com/download) on the Mac and iPhone, sign in to the same personal account, and connect both devices. This creates the private connection used for installation and future updates.
2. Open Terminal on your Mac and enter the project folder. Copy these commands one line at a time; leave Terminal open after the last command:

   ```sh
   cd '/Users/saksham/Weekend Projects/Weather-o'
   npm --prefix app run build
   npm --prefix app start
   ```

   If you moved the project, substitute its folder in the first line. The last command serves the built viewer on this Mac at `http://127.0.0.1:5173`. If that port is already occupied, stop the existing preview or choose another port and use that same port in the next step.

3. Open a second Terminal tab and run:

   ```sh
   tailscale serve http://127.0.0.1:5173
   ```

   Follow any HTTPS setup prompt. If `tailscale` is not found, follow [Tailscale's macOS CLI setup](https://tailscale.com/kb/1080/cli). The command prints a private `https://…ts.net` address. Use that exact address; no address has been generated for this project yet. This uses [Tailscale Serve](https://tailscale.com/docs/features/tailscale-serve) to forward a local port, which works with the macOS app; direct folder serving has additional macOS restrictions. Serve shares within your Tailscale network; Funnel would make the service public. Leave both Terminal tabs running for installation.
4. On iPhone with Tailscale connected, open the printed HTTPS address in Safari. Use **Share → Add to Home Screen → Open as Web App → Add**. [Apple's installation instructions](https://support.apple.com/guide/iphone/open-as-web-app-iphea86e5236/27/ios/27) cover the phone controls.
5. Open Weather-o from its Home Screen icon, wait for the scene to load, choose **Adapt to window**, and test opening and closing the phone. Check that the city stays selected and that both crops work. Start with **Calm · 15 fps** and try Pause and Still.
6. After that first load, turn on Airplane Mode and turn Wi-Fi off, reopen Weather-o and try switching cities. If it fails, reconnect and reload before testing again. iOS can clear website storage, so keep the private installation address available.

Keep the Mac awake, its viewer server running, and both devices connected to Tailscale for first installation, updates or recovery after storage is cleared. Once caching succeeds, the installed viewer is designed to work offline. To end this temporary setup, press **Control-C in each Terminal tab**; the [Serve command reference](https://tailscale.com/docs/reference/tailscale-cli/serve) explains its foreground lifetime. No background service is configured by these commands. This setup still needs a real phone check; it has not been exercised in this workspace.

### After installation

Check the PNG as a system wallpaper on both screens before generating more files. Try a Live Photo export if wake-up animation matters, and verify that iOS accepts the pair. Use the on-device city automation above to switch between configured wallpapers independently of this viewer. The animated viewer, Live Photo wake-up animation and Shortcuts wallpaper changes are separate features; the viewer cannot promise continuous animation behind icons or an automatic fold-triggered system wallpaper change.

For the full, continuously animated square-to-wide experience, open the viewer in Safari and use Share → Add to Home Screen → Open as Web App → Add, following [Apple’s instructions](https://support.apple.com/guide/iphone/open-as-web-app-iphea86e5236/27/ios/27). Its scenes and Three.js modules are cached offline after installation. Location is optional, requested only by “Use my city,” processed locally, and matched to one of the four supported cities within 125 km. It selects the city's current time period. Weather stays manually selected; no live weather service or background location tracking is connected.

Keep the viewer on a private HTTPS address if you do not want to publish a website. A trusted certificate is required on the phone; plain LAN HTTP does not provide service workers or reliable location permission. Opening index.html from Files isn't equivalent. GitHub Pages publishes a site; it is optional, not configured here. Exported images can be AirDropped into Photos without any website. A native personal Xcode install adds signing and maintenance; it is unnecessary for this viewer. No verified Artcraft iOS launcher integration was found and none is assumed.

For an actual system wallpaper, save a full-resolution PNG from the viewer, save it to Photos, then choose it in Settings → Wallpaper. For animation, the renderer below can create a HEIC/MOV Live Photo pair on macOS. Import both files into Photos together, sync them to the phone, then choose an eligible Live Photo in Wallpaper. [Apple documents playback when the phone wakes](https://support.apple.com/en-ae/120734), not an arbitrary continuously running renderer behind icons. Generated-pair eligibility must be checked on the device; having a valid pair is not a guarantee that iOS will animate it.

Apple's sources reviewed here do not establish a supported way for a third-party viewer to assign a different custom wallpaper file to each display or execute Three.js as the system wallpaper. The viewer implements both scene layouts inside the app; it does not claim an OS-level fold-triggered wallpaper switch. Apple [recommends adaptable layouts and preserving state across displays](https://developer.apple.com/design/human-interface-guidelines/designing-for-iphone-duo); this viewer responds to available window space and preserves its scene and loop phase.

For city-based changes, follow **Automatic city wallpapers, without Tailscale** above. An alternative shortcut can use **Set Wallpaper Photo** with a saved image if you prefer updating one wallpaper slot. Configure its destination wallpaper, turn off any preview that asks for interaction, and test manually before enabling an arrival automation. The exact picker and permitted automation behavior need verification on the installed iOS version. Local images avoid API keys, downloads and GitHub tokens. Use separate Time of Day automations if desired; the web viewer itself doesn't update system wallpaper in the background.

## Render wallpaper files

`node render.mjs --city toronto --display both --still` makes both full-resolution PNGs. `--display all` includes the upright inner display. `--all --display both` renders every supported time, weather and season for both screens. `--sample --still --size 600x420` provides quick samples; a custom size is explicitly marked in its filename. Original files in the parent project are left intact.

For a video: `node render.mjs --city udaipur --display open --fps 15 --no-live`. Default seamless loops last 12 seconds. For a Live Photo: `node render.mjs --city toronto --display closed --live` exports a separate 3-second lock-screen clip plus HEIC/MOV pair. Its ordinary MP4 remains the full 12-second seamless preview. Requires ffmpeg and, for Live Photos, macOS Swift/AVFoundation. `--size WIDTHxHEIGHT`, `--time`, `--weather`, `--season`, `--gl swiftshader`, and `--force` are supported. The manifest only lists files actually present, including their dimensions and display; it never advertises unrendered pairs.

Files include display suffixes, e.g. `toronto_dusk_clear_closed.png` and `toronto_dusk_clear_open.png`. Keep the old release files in place until replacement renders are complete. GitHub Releases can store these pre-rendered files; uploading or changing the existing workflow is not part of this build.

Existing wallpapers and Live Photo pairs are preserved. If an export would collide with any saved file, the whole new set gets a numbered suffix such as `_v2`; `--force` makes a new copy rather than replacing the previous one. The standalone Live Photo helper refuses an existing output basename. Rebuilding does not clean the output folders, and offline updates retain previous cached versions while loading assets from the current version.

## Mechanics and power

Four deterministic original city builders are preserved. Open boards add symmetric neighbourhood streets, green corridors, markets or lakeside gardens without stretching the landmarks. Roads, water and weather animate from one shared normalized loop phase. The viewer defaults to 15 fps, offers 30 fps and still modes, caps pixel ratio at 1.5, respects reduced motion on first use, stops scheduling frames when paused/hidden, and uses a full-resolution render only when exporting. This reduces rendering work; battery life has not been measured on a Duo. Reloaded scenes dispose GPU geometry, materials, textures and postprocessing targets.

Existing root scripts and square renders remain available separately. All changes for this viewer are contained in `app/`.
