add social-app-custom
This commit is contained in:
159
install.zsh
159
install.zsh
@@ -108,7 +108,51 @@ function at-repos-social-app-avatar-write() {
|
||||
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
|
||||
sed -i "s/public.api.web/bsky/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 PUBLIC_BSKY_SERVICE = 'https://public.api.bsky.app'#export const PUBLIC_BSKY_SERVICE = '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
|
||||
|
||||
# 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
|
||||
|
||||
f=$dt/view/icons/Logotype.tsx
|
||||
o=$d/icons/Logotype.tsx
|
||||
cp -rf $o $f
|
||||
@@ -156,6 +200,16 @@ function at-repos-social-app-agent-patch() {
|
||||
popd
|
||||
}
|
||||
|
||||
function at-repos-social-app-disable-external-services-patch() {
|
||||
f=$d/repos/social-app/src/state/geolocation/const.ts
|
||||
p_=$d/patching/8980-social-app-disable-external-services.diff
|
||||
d_=$d/repos/social-app
|
||||
echo "applying patch: under ${f} for ${p_}"
|
||||
pushd ${d_}
|
||||
patch -p1 < ${p_}
|
||||
popd
|
||||
}
|
||||
|
||||
function at-repos-ozone-patch() {
|
||||
#DOMAIN=syu.is
|
||||
cd $d/repos
|
||||
@@ -188,7 +242,7 @@ function at-repos-build-docker-social() {
|
||||
docker compose build --no-cache social-app
|
||||
}
|
||||
|
||||
function at-repos-build-docker-tag() {
|
||||
function at-repos-push-docker() {
|
||||
docker restart registry
|
||||
docker stop registry
|
||||
docker rm registry
|
||||
@@ -230,12 +284,15 @@ function at-repos-pull-docker() {
|
||||
docker compose up -d --pull always
|
||||
}
|
||||
|
||||
function at-origin-social-app() {
|
||||
cp -rf $d/social-app-custom $d/repos/social-app
|
||||
}
|
||||
|
||||
at-repos-env
|
||||
|
||||
case "`cat /etc/hostname`" in
|
||||
at)
|
||||
at-repos-pull-docker
|
||||
exit
|
||||
;;
|
||||
*)
|
||||
at-repos-clone
|
||||
@@ -243,11 +300,103 @@ case "`cat /etc/hostname`" in
|
||||
at-repos-social-app-icon
|
||||
at-repos-social-app-icon-origin
|
||||
at-repos-social-app-avatar-write
|
||||
at-repos-social-app-agent-patch
|
||||
at-repos-social-app-disable-external-services-patch
|
||||
if [ -n "$1" ] && [ "$1" = "social-app-custom" ];then
|
||||
at-social-app-custom-pages
|
||||
at-social-app-custom-screens
|
||||
at-social-app-aiat-config
|
||||
at-social-app-aiat-logo
|
||||
at-origin-social-app
|
||||
exit
|
||||
fi
|
||||
at-repos-atproto-service-bsky-api-patch
|
||||
at-repos-atproto-service-pds-index-patch
|
||||
at-repos-social-app-agent-patch
|
||||
at-repos-ozone-patch
|
||||
at-repos-build-docker-atproto
|
||||
at-repos-build-docker-social
|
||||
if [ -n "$1" ] && [ "$1" = "s" ];then
|
||||
docker run -d -p ${dport}:${dport} --name registry --restart=always registry:2
|
||||
docker tag at-social-app:latest localhost:${dport}/social-app:latest
|
||||
docker push localhost:${dport}/social-app:latest
|
||||
exit
|
||||
fi
|
||||
at-repos-build-docker-atproto
|
||||
at-repos-push-docker
|
||||
;;
|
||||
esac
|
||||
|
||||
function at-social-app-custom-pages() {
|
||||
d_=$d/repos/social-app
|
||||
custom=$d/social-app-custom
|
||||
|
||||
echo "copying custom components to social-app"
|
||||
|
||||
# Create components directory if not exists
|
||||
mkdir -p ${d_}/src/components/custom
|
||||
|
||||
# Copy custom components
|
||||
cp ${custom}/PrivacyContent.tsx ${d_}/src/components/custom/
|
||||
cp ${custom}/AppInfo.tsx ${d_}/src/components/custom/
|
||||
|
||||
echo "custom components copied successfully"
|
||||
}
|
||||
|
||||
function at-social-app-aiat-config() {
|
||||
d_=$d/repos/social-app
|
||||
custom=$d/social-app-custom
|
||||
|
||||
echo "applying Aiat configuration"
|
||||
|
||||
# Update app.config.js
|
||||
cd ${d_}
|
||||
|
||||
# Backup original
|
||||
cp app.config.js app.config.js.orig
|
||||
|
||||
# Apply changes using sed
|
||||
sed -i "s/name: 'Bluesky'/name: 'Aiat'/g" app.config.js
|
||||
sed -i "s/slug: 'bluesky'/slug: 'aiat'/g" app.config.js
|
||||
sed -i "s/scheme: 'bluesky'/scheme: 'aiat'/g" app.config.js
|
||||
sed -i "s/owner: 'blueskysocial'/owner: 'syui'/g" app.config.js
|
||||
sed -i "s/bundleIdentifier: 'xyz.blueskyweb.app'/bundleIdentifier: 'ai.syui.at'/g" app.config.js
|
||||
|
||||
# Update package.json name
|
||||
sed -i 's/"name": "bsky.app"/"name": "aiat"/g' package.json
|
||||
|
||||
echo "Aiat configuration applied"
|
||||
}
|
||||
|
||||
function at-social-app-aiat-logo() {
|
||||
d_=$d/repos/social-app
|
||||
custom=$d/social-app-custom
|
||||
|
||||
echo "applying Aiat logo"
|
||||
|
||||
# Create logo directory if not exists
|
||||
mkdir -p ${custom}/assets
|
||||
|
||||
# Copy logo if exists in custom folder
|
||||
if [ -f ${custom}/assets/icon.png ]; then
|
||||
cp ${custom}/assets/icon.png ${d_}/assets/app-icons/ios_icon_default_next.png
|
||||
echo "Aiat logo applied"
|
||||
else
|
||||
echo "Warning: Logo file not found at ${custom}/assets/icon.png"
|
||||
echo "Please add your logo file there"
|
||||
fi
|
||||
}
|
||||
|
||||
function at-social-app-custom-screens() {
|
||||
d_=$d/repos/social-app
|
||||
custom=$d/social-app-custom
|
||||
|
||||
echo "applying custom screens"
|
||||
|
||||
# Copy custom screen files
|
||||
cp ${custom}/PrivacyPolicy.screen.tsx ${d_}/src/view/screens/PrivacyPolicy.tsx
|
||||
cp ${custom}/Support.screen.tsx ${d_}/src/view/screens/Support.tsx
|
||||
cp ${custom}/LicenseNotice.tsx ${d_}/src/components/custom/
|
||||
|
||||
echo "custom screens applied"
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user