fix ozone
This commit is contained in:
17
compose.yml
17
compose.yml
@@ -110,11 +110,11 @@ services:
|
|||||||
env_file:
|
env_file:
|
||||||
- ./envs/jetstream
|
- ./envs/jetstream
|
||||||
|
|
||||||
ozone-web:
|
ozone:
|
||||||
build:
|
build:
|
||||||
context: ./repos/ozone/
|
context: ./repos/ozone/
|
||||||
ports:
|
ports:
|
||||||
- 2586:3000
|
- 2585:3000
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- ./data/ozone/:/data/
|
- ./data/ozone/:/data/
|
||||||
@@ -124,16 +124,3 @@ services:
|
|||||||
database:
|
database:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
|
||||||
ozone:
|
|
||||||
build:
|
|
||||||
context: ./repos/atproto/
|
|
||||||
dockerfile: services/ozone/Dockerfile
|
|
||||||
ports:
|
|
||||||
- 2585:3000
|
|
||||||
restart: always
|
|
||||||
command: node --enable-source-maps api.js
|
|
||||||
volumes:
|
|
||||||
- ./data/ozone/:/data/
|
|
||||||
env_file:
|
|
||||||
- ./envs/ozone
|
|
||||||
|
|
||||||
|
|||||||
77
install.zsh
77
install.zsh
@@ -106,6 +106,8 @@ function at-repos-social-app-avatar-write() {
|
|||||||
did_admin=did:plc:6qyecktefllvenje24fcxnie
|
did_admin=did:plc:6qyecktefllvenje24fcxnie
|
||||||
dt=$d/repos/social-app/src
|
dt=$d/repos/social-app/src
|
||||||
cd $dt
|
cd $dt
|
||||||
|
grep -R syu.is .|cut -d : -f 1|sort -u|xargs sed -i "s/syu.is/${host}/g"
|
||||||
|
grep -R web.syu.is .|cut -d : -f 1|sort -u|xargs sed -i "s/web.syu.is/web.${host}/g"
|
||||||
f=$dt/lib/constants.ts
|
f=$dt/lib/constants.ts
|
||||||
sed -i "s#export const BSKY_SERVICE = 'https://bsky.social'#export const BSKY_SERVICE = 'https://${host}'#g" $f
|
sed -i "s#export const BSKY_SERVICE = 'https://bsky.social'#export const BSKY_SERVICE = 'https://${host}'#g" $f
|
||||||
sed -i "s#export const BSKY_SERVICE_DID = 'did:web:bsky.social'#export const BSKY_SERVICE_DID = 'did:web:${host}'#g" $f
|
sed -i "s#export const BSKY_SERVICE_DID = 'did:web:bsky.social'#export const BSKY_SERVICE_DID = 'did:web:${host}'#g" $f
|
||||||
@@ -113,51 +115,9 @@ function at-repos-social-app-avatar-write() {
|
|||||||
sed -i "s#export const PUBLIC_APPVIEW = 'https://api.bsky.app'#export const PUBLIC_APPVIEW = 'https://bsky.${host}'#g" $f
|
sed -i "s#export const PUBLIC_APPVIEW = 'https://api.bsky.app'#export const PUBLIC_APPVIEW = 'https://bsky.${host}'#g" $f
|
||||||
sed -i "s#export const PUBLIC_APPVIEW_DID = 'did:web:api.bsky.app'#export const PUBLIC_APPVIEW_DID = 'did:web:bsky.${host}'#g" $f
|
sed -i "s#export const PUBLIC_APPVIEW_DID = 'did:web:api.bsky.app'#export const PUBLIC_APPVIEW_DID = 'did:web:bsky.${host}'#g" $f
|
||||||
|
|
||||||
# Disable external services (CORS fix)
|
|
||||||
f=$dt/state/geolocation/const.ts
|
|
||||||
curl -sL https://raw.githubusercontent.com/bluesky-social/social-app/refs/heads/main/src/state/geolocation/const.ts -o $f
|
|
||||||
cat > $f << 'GEOEOF'
|
|
||||||
import {type GeolocationStatus} from '#/state/geolocation/types'
|
|
||||||
import {BAPP_CONFIG_DEV_URL, IS_DEV} from '#/env'
|
|
||||||
import {type Device} from '#/storage'
|
|
||||||
|
|
||||||
export const IPCC_URL = `https://bsky.app/ipcc`
|
|
||||||
// Disabled for self-hosted environment to avoid CORS errors
|
|
||||||
export const BAPP_CONFIG_URL_PROD = null
|
|
||||||
export const BAPP_CONFIG_URL = null
|
|
||||||
export const GEOLOCATION_CONFIG_URL = BAPP_CONFIG_URL
|
|
||||||
|
|
||||||
export const DEFAULT_GEOLOCATION_CONFIG: Device['geolocation'] = {
|
|
||||||
countryCode: undefined,
|
|
||||||
regionCode: undefined,
|
|
||||||
ageRestrictedGeos: [],
|
|
||||||
ageBlockedGeos: [],
|
|
||||||
}
|
|
||||||
|
|
||||||
export const DEFAULT_GEOLOCATION_STATUS: GeolocationStatus = {
|
|
||||||
countryCode: undefined,
|
|
||||||
regionCode: undefined,
|
|
||||||
isAgeRestrictedGeo: false,
|
|
||||||
isAgeBlockedGeo: false,
|
|
||||||
}
|
|
||||||
GEOEOF
|
|
||||||
|
|
||||||
# Add null check to geolocation config.ts to prevent fetch(null) errors
|
|
||||||
f=$dt/state/geolocation/config.ts
|
|
||||||
curl -sL https://raw.githubusercontent.com/bluesky-social/social-app/refs/heads/main/src/state/geolocation/config.ts -o $f
|
|
||||||
# Add null check at the beginning of getGeolocationConfig function (after line with 'url: string,')
|
|
||||||
sed -i "s/): Promise<Device\['geolocation'\]> {/): Promise<Device['geolocation']> {\n if (!url) return undefined/" $f
|
|
||||||
|
|
||||||
# Disable Statsig (CORS fix)
|
|
||||||
f=$dt/lib/statsig/statsig.tsx
|
|
||||||
sed -i "s#api: 'https://events.bsky.app/v2'#api: '' // Disabled for self-hosted#g" $f
|
|
||||||
# Disable SDK initialization to prevent statsigapi.net connections
|
|
||||||
sed -i "s#const SDK_KEY = 'client-SXJakO39w9vIhl3D44u8UupyzFl4oZ2qPIkjwcvuPsV'#const SDK_KEY = '' // Disabled for self-hosted#g" $f
|
|
||||||
|
|
||||||
f=$dt/view/icons/Logotype.tsx
|
f=$dt/view/icons/Logotype.tsx
|
||||||
o=$d/icons/Logotype.tsx
|
o=$d/icons/Logotype.tsx
|
||||||
cp -rf $o $f
|
cp -rf $o $f
|
||||||
|
|
||||||
f=$dt/view/com/util/UserAvatar.tsx
|
f=$dt/view/com/util/UserAvatar.tsx
|
||||||
curl -sL https://raw.githubusercontent.com/bluesky-social/social-app/refs/heads/main/src/view/com/util/UserAvatar.tsx -o $f
|
curl -sL https://raw.githubusercontent.com/bluesky-social/social-app/refs/heads/main/src/view/com/util/UserAvatar.tsx -o $f
|
||||||
sed -i "s#/img/avatar/plain/#https://cdn.web.syu.is/img/avatar/plain/#g" $f
|
sed -i "s#/img/avatar/plain/#https://cdn.web.syu.is/img/avatar/plain/#g" $f
|
||||||
@@ -211,6 +171,16 @@ function at-repos-social-app-disable-external-services-patch() {
|
|||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function at-repos-social-app-statsig-patch() {
|
||||||
|
f=$d/repos/social-app/src/lib/statsig/statsig.tsx
|
||||||
|
p_=$d/patching/disable-statsig-sdk.diff
|
||||||
|
d_=$d/repos/social-app
|
||||||
|
echo "applying patch: under ${f} for ${p_}"
|
||||||
|
pushd ${d_}
|
||||||
|
patch -p1 < ${p_}
|
||||||
|
popd
|
||||||
|
}
|
||||||
|
|
||||||
function at-repos-social-app-dockerfile-yarn-timeout-patch() {
|
function at-repos-social-app-dockerfile-yarn-timeout-patch() {
|
||||||
f=$d/repos/social-app/Dockerfile
|
f=$d/repos/social-app/Dockerfile
|
||||||
p_=$d/patching/140-social-app-yarn-network-timeout.patch
|
p_=$d/patching/140-social-app-yarn-network-timeout.patch
|
||||||
@@ -271,16 +241,17 @@ function at-repos-build-docker-atproto() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function at-repos-push-reset() {
|
function at-repos-push-reset() {
|
||||||
docker restart registry
|
if [ -n "$(docker ps -q -f name=registry)" ]; then
|
||||||
docker stop registry
|
echo "Registry is already running."
|
||||||
docker rm registry
|
docker restart registry
|
||||||
docker volume rm registry-data 2>/dev/null || true
|
docker stop registry
|
||||||
|
docker rm registry
|
||||||
|
docker volume rm registry-data 2>/dev/null || true
|
||||||
|
fi
|
||||||
docker run -d -p ${dport}:${dport} --name registry \
|
docker run -d -p ${dport}:${dport} --name registry \
|
||||||
--restart=always \
|
--restart=always \
|
||||||
-v registry-data:/var/lib/registry \
|
-v registry-data:/var/lib/registry \
|
||||||
registry:2
|
registry:2
|
||||||
sleep 3
|
|
||||||
docker run -d -p ${dport}:${dport} --name registry --restart=always registry:2
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function at-repos-push-docker() {
|
function at-repos-push-docker() {
|
||||||
@@ -289,10 +260,6 @@ function at-repos-push-docker() {
|
|||||||
service=${services[$i]}
|
service=${services[$i]}
|
||||||
docker tag at-${service}:latest localhost:${dport}/${service}:latest
|
docker tag at-${service}:latest localhost:${dport}/${service}:latest
|
||||||
docker push localhost:${dport}/${service}:latest
|
docker push localhost:${dport}/${service}:latest
|
||||||
if [ "$service" = "ozone" ];then
|
|
||||||
docker tag at-${service}:latest localhost:${dport}/${service}-web:latest
|
|
||||||
docker push localhost:${dport}/${service}-web:latest
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
docker tag at-${1}:latest localhost:${dport}/${1}:latest
|
docker tag at-${1}:latest localhost:${dport}/${1}:latest
|
||||||
@@ -313,7 +280,10 @@ case "`cat /etc/hostname`" in
|
|||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
at-repos-push-reset
|
if [ "$1" = "r" ];then
|
||||||
|
at-repos-push-reset
|
||||||
|
exit
|
||||||
|
fi
|
||||||
at-repos-clone
|
at-repos-clone
|
||||||
at-repos-pull
|
at-repos-pull
|
||||||
at-repos-social-app-icon
|
at-repos-social-app-icon
|
||||||
@@ -321,6 +291,7 @@ case "`cat /etc/hostname`" in
|
|||||||
at-repos-social-app-avatar-write
|
at-repos-social-app-avatar-write
|
||||||
at-repos-social-app-agent-patch
|
at-repos-social-app-agent-patch
|
||||||
at-repos-social-app-disable-external-services-patch
|
at-repos-social-app-disable-external-services-patch
|
||||||
|
at-repos-social-app-statsig-patch
|
||||||
at-repos-social-app-dockerfile-yarn-timeout-patch
|
at-repos-social-app-dockerfile-yarn-timeout-patch
|
||||||
at-repos-atproto-service-bsky-api-patch
|
at-repos-atproto-service-bsky-api-patch
|
||||||
at-repos-atproto-service-pds-index-patch
|
at-repos-atproto-service-pds-index-patch
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
diff --git a/service/index.js b/service/index.js
|
diff --git a/service/index.js b/service/index.js
|
||||||
index 943c281..7721cd9 100644
|
index d5295a3..7721cd9 100644
|
||||||
--- a/service/index.js
|
--- a/service/index.js
|
||||||
+++ b/service/index.js
|
+++ b/service/index.js
|
||||||
@@ -1,5 +1,7 @@
|
@@ -1,5 +1,7 @@
|
||||||
@@ -19,7 +19,7 @@ index 943c281..7721cd9 100644
|
|||||||
const pkg = require('@atproto/ozone/package.json')
|
const pkg = require('@atproto/ozone/package.json')
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
@@ -16,37 +19,48 @@ async function main() {
|
@@ -16,30 +19,48 @@ async function main() {
|
||||||
const frontendHandler = frontend.getRequestHandler()
|
const frontendHandler = frontend.getRequestHandler()
|
||||||
await frontend.prepare()
|
await frontend.prepare()
|
||||||
// backend
|
// backend
|
||||||
@@ -41,19 +41,16 @@ index 943c281..7721cd9 100644
|
|||||||
await db.close()
|
await db.close()
|
||||||
}
|
}
|
||||||
- const ozone = await OzoneService.create(config, secrets)
|
- const ozone = await OzoneService.create(config, secrets)
|
||||||
|
-
|
||||||
+ const server = await ozone.OzoneService.create(config, secrets)
|
+ const server = await ozone.OzoneService.create(config, secrets)
|
||||||
// setup handlers
|
+ // setup handlers
|
||||||
- ozone.app.get('/.well-known/ozone-metadata.json', (_req, res) => {
|
|
||||||
+ server.app.get('/.well-known/ozone-metadata.json', (_req, res) => {
|
+ server.app.get('/.well-known/ozone-metadata.json', (_req, res) => {
|
||||||
return res.json({
|
+ 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,
|
+ did: server.ctx.cfg.service.did,
|
||||||
+ url: server.ctx.cfg.service.publicUrl,
|
+ url: server.ctx.cfg.service.publicUrl,
|
||||||
+ publicKey: server.ctx.signingKey.did(),
|
+ publicKey: server.ctx.signingKey.did(),
|
||||||
})
|
+ })
|
||||||
})
|
+ })
|
||||||
// Note: We must use `use()` here. This should be the last middleware.
|
// Note: We must use `use()` here. This should be the last middleware.
|
||||||
- ozone.app.use((req, res) => {
|
- ozone.app.use((req, res) => {
|
||||||
+ server.app.use((req, res) => {
|
+ server.app.use((req, res) => {
|
||||||
|
|||||||
22
patching/disable-statsig-sdk.diff
Normal file
22
patching/disable-statsig-sdk.diff
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
diff --git a/src/lib/statsig/statsig.tsx b/src/lib/statsig/statsig.tsx
|
||||||
|
index 1234567..89abcdef 100644
|
||||||
|
--- a/src/lib/statsig/statsig.tsx
|
||||||
|
+++ b/src/lib/statsig/statsig.tsx
|
||||||
|
@@ -266,6 +266,7 @@ export async function tryFetchGates(
|
||||||
|
}
|
||||||
|
|
||||||
|
export function initialize() {
|
||||||
|
+ if (!SDK_KEY) return Promise.resolve()
|
||||||
|
return Statsig.initialize(SDK_KEY, null, createStatsigOptions([]))
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -310,6 +311,9 @@ export function Provider({children}: {children: React.ReactNode}) {
|
||||||
|
return () => clearInterval(id)
|
||||||
|
}, [handleIntervalTick])
|
||||||
|
|
||||||
|
+ if (!SDK_KEY) {
|
||||||
|
+ return <GateCache.Provider value={gateCache}>{children}</GateCache.Provider>
|
||||||
|
+ }
|
||||||
|
return (
|
||||||
|
<GateCache.Provider value={gateCache}>
|
||||||
|
<StatsigProvider
|
||||||
Reference in New Issue
Block a user