diff --git a/social-app.-.md b/social-app.-.md index 566a20f..9c245e4 100644 --- a/social-app.-.md +++ b/social-app.-.md @@ -150,8 +150,8 @@ function at-repos-social-app-write() { f=$dt/lib/strings/url-helpers.ts sed -i 's#`https://go\.syu\.is/redirect\?u=\${encodeURIComponent(url)}`#url#g' $f - f=$dt/state/geolocation.tsx - sed -i 's#https://syu\.is/ipcc#https://bsky\.app/ipcc#g' $f + #f=$dt/state/geolocation.tsx + #sed -i 's#https://syu\.is/ipcc#https://bsky\.app/ipcc#g' $f f=$dt/view/icons/Logotype.tsx o=$d/icons/Logotype.tsx @@ -164,4 +164,53 @@ function at-repos-social-app-write() { sed -i "s#source={{uri: avatar}}#source={{ uri: hackModifyThumbnailPath(avatar, 1 > 0), }}#g" $f grep -R $did_admin .|cut -d : -f 1|sort -u|xargs sed -i "s/${did_admin}/${did}/g" } +``` + +## ipcc + +自前のサービスにするか、あるいは、dockerで建てるかです。 + +```js +// Cloudflare Workerのコード +export default { + async fetch(request) { + // IPアドレスから国を取得 + const country = request.cf?.country || 'JP'; + + return new Response(JSON.stringify({ countryCode: country }), { + status: 200, + headers: { + 'Content-Type': 'application/json', + 'Access-Control-Allow-Origin': '*', // CORSを許可! + 'Access-Control-Allow-Methods': 'GET', + }, + }); + }, +}; +``` + +dokcerの方法は以下。 + +> ./configs/ipcc/default.conf + +```js +server { + location / { + add_header Content-Type application/json; + add_header Access-Control-Allow-Origin *; + return 200 '{"countryCode":"JP"}'; + } +} +``` + +> compose.yml + +```yml + ipcc: + image: nginx:alpine + restart: always + volumes: + - ./configs/ipcc/default.conf:/etc/nginx/conf.d/default.conf + ports: + - "8099:80" ``` \ No newline at end of file