diff --git a/install.zsh b/install.zsh
index 51858e6..79bb206 100755
--- a/install.zsh
+++ b/install.zsh
@@ -15,6 +15,7 @@ function at-repos-env() {
https://github.com/bluesky-social/atproto
https://github.com/bluesky-social/social-app
https://github.com/bluesky-social/feed-generator
+ https://github.com/bluesky-social/ozone
)
d=${0:a:h}
dh=${0:a:h:h}
@@ -144,6 +145,26 @@ function at-repos-social-app-patch() {
popd
}
+function at-repos-ozone-patch() {
+ #DOMAIN=syu.is
+ cd $d/repos
+ d_=$d/repos/ozone
+ rm -rf ${d_}
+ p_=$d/patching/120-ozone-runtimeEnvVars.diff
+ git clone https://github.com/bluesky-social/ozone
+ cd ${d_}
+ pushd ${d_}
+ echo "applying patch: under ${d_} for ${p_}"
+ patch -p1 < ${p_}
+ popd
+
+ p_=$d/patching/122-ozone-enable-daemon.diff
+ echo "applying patch: under ${d_} for ${p_}"
+ pushd ${d_}
+ patch -p1 < ${p_}
+ popd
+}
+
function at-repos-docker() {
cd $d
docker compose build && docker compose up -d
@@ -157,6 +178,7 @@ at-repos-social-app-icon-origin
at-repos-social-app-write
at-repos-bsky-patch
at-repos-social-app-patch
+at-repos-ozone-patch
echo "[y]docker compose build && up"
read key
diff --git a/patching/120-ozone-runtimeEnvVars.diff b/patching/120-ozone-runtimeEnvVars.diff
new file mode 100644
index 0000000..4f369a8
--- /dev/null
+++ b/patching/120-ozone-runtimeEnvVars.diff
@@ -0,0 +1,119 @@
+diff --git a/app/layout.tsx b/app/layout.tsx
+index bfc3470..9350629 100644
+--- a/app/layout.tsx
++++ b/app/layout.tsx
+@@ -5,6 +5,7 @@ import 'yet-another-react-lightbox/styles.css'
+ import 'yet-another-react-lightbox/plugins/thumbnails.css'
+ import 'yet-another-react-lightbox/plugins/captions.css'
+ import { ToastContainer } from 'react-toastify'
++import { PublicEnvScript } from 'next-runtime-env';
+
+ import { Shell } from '@/shell/Shell'
+ import { CommandPaletteRoot } from '@/shell/CommandPalette/Root'
+@@ -36,6 +37,7 @@ export default function RootLayout({
+ isDarkModeEnabled() ? 'dark' : ''
+ }`}
+ >
++
+ Ozone
+
+
++
++
+
+ blueSkyUrlMatcher.test(url)
+
+diff --git a/package.json b/package.json
+index 8919841..750dce9 100644
+--- a/package.json
++++ b/package.json
+@@ -37,6 +37,7 @@
+ "kbar": "^0.1.0-beta.45",
+ "lande": "^1.0.10",
+ "next": "15.2.4",
++ "next-runtime-env": "^3.2.1",
+ "react": "19.1.0",
+ "react-dom": "19.1.0",
+ "react-dropzone": "^14.3.5",
diff --git a/patching/122-ozone-enable-daemon.diff b/patching/122-ozone-enable-daemon.diff
new file mode 100644
index 0000000..3b783df
--- /dev/null
+++ b/patching/122-ozone-enable-daemon.diff
@@ -0,0 +1,82 @@
+diff --git a/service/index.js b/service/index.js
+index 943c281..7721cd9 100644
+--- a/service/index.js
++++ b/service/index.js
+@@ -1,5 +1,7 @@
+ const next = require('next')
+-const {
++const ozone = require('@atproto/ozone')
++/*
++{
+ readEnv,
+ httpLogger,
+ envToCfg,
+@@ -7,6 +9,7 @@ const {
+ OzoneService,
+ Database,
+ } = require('@atproto/ozone')
++*/
+ const pkg = require('@atproto/ozone/package.json')
+
+ async function main() {
+@@ -16,37 +19,48 @@ async function main() {
+ const frontendHandler = frontend.getRequestHandler()
+ await frontend.prepare()
+ // backend
+- const env = readEnv()
++ const env = ozone.readEnv()
+ env.version ??= pkg.version
+- const config = envToCfg(env)
+- const secrets = envToSecrets(env)
++ const config = ozone.envToCfg(env)
++ const secrets = ozone.envToSecrets(env)
+ const migrate = process.env.OZONE_DB_MIGRATE === '1'
+ if (migrate) {
+- const db = new Database({
++ const db = new ozone.Database({
+ url: config.db.postgresUrl,
+ schema: config.db.postgresSchema,
+ })
+ await db.migrateToLatestOrThrow()
+ await db.close()
+ }
+- const ozone = await OzoneService.create(config, secrets)
++ const server = await ozone.OzoneService.create(config, secrets)
+ // setup handlers
+- ozone.app.get('/.well-known/ozone-metadata.json', (_req, res) => {
++ server.app.get('/.well-known/ozone-metadata.json', (_req, res) => {
+ return res.json({
+- did: ozone.ctx.cfg.service.did,
+- url: ozone.ctx.cfg.service.publicUrl,
+- publicKey: ozone.ctx.signingKey.did(),
++ did: server.ctx.cfg.service.did,
++ url: server.ctx.cfg.service.publicUrl,
++ publicKey: server.ctx.signingKey.did(),
+ })
+ })
+ // Note: We must use `use()` here. This should be the last middleware.
+- ozone.app.use((req, res) => {
++ server.app.use((req, res) => {
+ void frontendHandler(req, res, undefined)
+ })
+ // run
+- const httpServer = await ozone.start()
++ const httpServer = await server.start()
++ // starts: involve ops from atproto/packages/dev-env/src/ozone.ts >>>
++ ozone.httpLogger.info('starts ozone daemon')
++ const daemon = await ozone.OzoneDaemon.create(config, secrets)
++ await daemon.start()
++ //if (process.env.OZONE_ENABLE_EVENT_REVERSER != 'true') // atproto/services/ozone/daemon.js doesn't stop eventReverser
++ //{
++ // ozone.httpLogger.info('disable ozone daemon eventReverser')
++ // await daemon.ctx.eventReverser.destroy()
++ //}
++ // ends: involve ops from atproto/packages/dev-env/src/ozone.ts <<<
++
+ /** @type {import('net').AddressInfo} */
+ const addr = httpServer.address()
+- httpLogger.info(`Ozone is running at http://localhost:${addr.port}`)
++ ozone.httpLogger.info(`Ozone is running at http://localhost:${addr.port}`)
+ }
+
+ main().catch(console.error)