A community based topic aggregation platform built on atproto
1#!/bin/bash
2
3# Script: 2-setup-wellknown.sh
4# Purpose: Generate .well-known/atproto-did file for domain verification
5#
6# This script creates the .well-known/atproto-did file that proves you own your domain.
7# You'll need to host this file at https://yourdomain.com/.well-known/atproto-did
8
9set -e
10
11echo "================================================"
12echo "Step 2: Setup .well-known/atproto-did"
13echo "================================================"
14echo ""
15
16# Load config if available
17if [ -f "aggregator-config.env" ]; then
18 source aggregator-config.env
19 echo "✓ Loaded configuration from aggregator-config.env"
20 echo " DID: $AGGREGATOR_DID"
21 echo ""
22else
23 echo "Configuration file not found. Please run 1-create-pds-account.sh first."
24 exit 1
25fi
26
27# Get domain
28read -p "Enter your aggregator's domain (e.g., rss-bot.example.com): " DOMAIN
29
30if [ -z "$DOMAIN" ]; then
31 echo "Error: Domain is required"
32 exit 1
33fi
34
35# Save domain to config
36echo "" >> aggregator-config.env
37echo "AGGREGATOR_DOMAIN=\"$DOMAIN\"" >> aggregator-config.env
38
39echo ""
40echo "Creating .well-known directory..."
41mkdir -p .well-known
42
43# Create the atproto-did file
44echo "$AGGREGATOR_DID" > .well-known/atproto-did
45
46echo "✓ Created .well-known/atproto-did with content: $AGGREGATOR_DID"
47echo ""
48
49echo "================================================"
50echo "Next Steps:"
51echo "================================================"
52echo ""
53echo "1. Upload the .well-known directory to your web server"
54echo " The file must be accessible at:"
55echo " https://$DOMAIN/.well-known/atproto-did"
56echo ""
57echo "2. Verify it's working by running:"
58echo " curl https://$DOMAIN/.well-known/atproto-did"
59echo " (Should return: $AGGREGATOR_DID)"
60echo ""
61echo "3. Once verified, run: ./3-register-with-coves.sh"
62echo ""
63
64# Create nginx example
65cat > nginx-example.conf <<EOF
66# Example nginx configuration for serving .well-known
67# Add this to your nginx server block:
68
69location /.well-known/atproto-did {
70 alias /path/to/your/.well-known/atproto-did;
71 default_type text/plain;
72 add_header Access-Control-Allow-Origin *;
73}
74EOF
75
76echo "✓ Created nginx-example.conf for reference"
77echo ""
78
79# Create Apache example
80cat > apache-example.conf <<EOF
81# Example Apache configuration for serving .well-known
82# Add this to your Apache virtual host:
83
84Alias /.well-known /path/to/your/.well-known
85<Directory /path/to/your/.well-known>
86 Options None
87 AllowOverride None
88 Require all granted
89 Header set Access-Control-Allow-Origin "*"
90</Directory>
91EOF
92
93echo "✓ Created apache-example.conf for reference"