mirror of
https://github.com/bitbaum/solon.git
synced 2026-12-04 05:07:04 +01:00
* wip: law ask reliability and prompt * fix(law): reliable ask with one retry, cited sources, no prompt wording, honest headline, widget clearance, account email words, build sha - law ask: whole-stream cap raised, first-token deadline, one automatic retry on the next model, errors logged, localized failure text - answers list the provisions they cite as links; no-result wording never leaks the prompt - /law headline = sum of what place pages print (register acts), not text-held subset - feedback widget avoids the place tiles (data-fc-avoid) - /account: plain words for a missing email with one primary button, all locales - /api/health build and <meta name=solon-build> Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
65 lines
2.4 KiB
JavaScript
65 lines
2.4 KiB
JavaScript
const createNextIntlPlugin = require("next-intl/plugin");
|
|
|
|
// Points next-intl at the request config that picks each request's language
|
|
// and loads its messages (English underneath, the translation on top).
|
|
const withNextIntl = createNextIntlPlugin("./src/i18n/request.ts");
|
|
|
|
// Photographs from the bucket (src/lib/media/): with a public base set at build
|
|
// time, next/image takes its addresses from the media loader and the app box
|
|
// resizes nothing (its optimiser is off). Unset, Next optimises as before.
|
|
const MEDIA_BASE = process.env.NEXT_PUBLIC_MEDIA_BASE;
|
|
|
|
// The commit being built, a public hash: CI's or the deploy's variable, else the checkout's own.
|
|
function buildSha() {
|
|
const fromEnv = [
|
|
process.env.GITHUB_SHA,
|
|
process.env.GIT_SHA,
|
|
process.env.GIT_COMMIT,
|
|
process.env.SOURCE_COMMIT,
|
|
].find((v) => v && /^[0-9a-f]{7,40}$/i.test(v.trim()));
|
|
if (fromEnv) return fromEnv.trim().slice(0, 12);
|
|
try {
|
|
return require("node:child_process")
|
|
.execSync("git rev-parse --short=12 HEAD", { stdio: ["ignore", "pipe", "ignore"] })
|
|
.toString()
|
|
.trim();
|
|
} catch {
|
|
return "unknown";
|
|
}
|
|
}
|
|
|
|
/** @type {import('next').NextConfig} */
|
|
const nextConfig = {
|
|
// Standalone output is required by the self-hosted Hetzner deploy
|
|
// (scripts/hetzner/deploy.sh stages the standalone build, same as every
|
|
// sibling app on the box).
|
|
output: "standalone",
|
|
env: { SOLON_BUILD_SHA: buildSha() },
|
|
// Member pictures come from OrangeCat's storage (the identity root keeps
|
|
// the profile; Solon only shows it). Places' photographs come from
|
|
// Wikimedia Commons (`pnpm run places:photos`, each with its licence).
|
|
images: {
|
|
...(MEDIA_BASE
|
|
? {
|
|
loader: "custom",
|
|
loaderFile: "./src/lib/media/loader.ts",
|
|
// The widths photographs are rendered at (MEDIA_WIDTHS, src/lib/media/variants.ts),
|
|
// so each srcset entry names the width its file has.
|
|
deviceSizes: [640, 960, 1280, 1920, 2560],
|
|
}
|
|
: {}),
|
|
remotePatterns: [
|
|
{
|
|
protocol: "https",
|
|
hostname: "supabase.orangecat.ch",
|
|
pathname: "/storage/v1/object/public/**",
|
|
},
|
|
{ protocol: "https", hostname: "orangecat.ch" },
|
|
{ protocol: "https", hostname: "upload.wikimedia.org", pathname: "/wikipedia/commons/**" },
|
|
{ protocol: "https", hostname: "thumb.wikimedia.org", pathname: "/wikipedia/commons/**" },
|
|
],
|
|
},
|
|
};
|
|
|
|
module.exports = withNextIntl(nextConfig);
|