diff --git a/scripts/on-dev b/scripts/on-dev index e405c658..b8c037f8 100755 --- a/scripts/on-dev +++ b/scripts/on-dev @@ -71,7 +71,15 @@ fi sync() { ssh "$host" "mkdir -p '$remote'" - rsync -a --no-owner --no-group --delete-after --filter=':- .gitignore' --exclude=.git "$dir/" "$host:$remote/" + local changes + changes=$(rsync -a -i --no-owner --no-group --delete-after --filter=':- .gitignore' --exclude=.git "$dir/" "$host:$remote/") || + die "rsync to $host failed" + # app/build.rs lists the migrations when database/migrations changes, but rsync keeps a new file's old mtime, so cargo + # would build the old list in: touch the folder when a migration was added or removed (not on every sync, which + # would rebuild the app each time). + if printf '%s\n' "$changes" | grep -qE '^([<>]f\+{9}|\*deleting) +app/database/migrations/'; then + ssh "$host" "touch '$remote/app/database/migrations'" + fi } # One remote command, quoted for the remote shell, with the toolchain on PATH and the CPUs pinned. diff --git a/server/frontend/src/api/client.ts b/server/frontend/src/api/client.ts index d01ca6f9..0bef887d 100644 --- a/server/frontend/src/api/client.ts +++ b/server/frontend/src/api/client.ts @@ -35,7 +35,8 @@ export async function request(method: HttpMethod, path: string, body?: unknow try { res = await fetch(path, { method, - headers: body === undefined ? undefined : { 'Content-Type': 'application/json' }, + // Accept: the app answers errors as JSON (with their description) only to a request that asks for it + headers: body === undefined ? { Accept: 'application/json' } : { Accept: 'application/json', 'Content-Type': 'application/json' }, credentials: 'same-origin', body: body === undefined ? undefined : JSON.stringify(body), })