Skip to content

Commit 0ec3a12

Browse files
committed
Le sigh, colons. Use secret references
1 parent a10dc8d commit 0ec3a12

4 files changed

Lines changed: 13 additions & 8 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ This launches an interactive wizard that lets you:
7474
**Threaded Replies**:
7575
The first time you publish an event, `bin/event publish` will save the generated Mastodon and Bluesky URLs directly into the post's markdown front matter. If you run `bin/event publish` again for the *same* event (e.g. to send a Reminder or Post-Event recap), it will automatically fetch those URLs and post your new updates as **threaded replies** to the original post on both platforms!
7676

77+
### Troubleshooting Social Publishing
78+
- **"Failed to retrieve Mastodon/Bluesky token from 1Password"**: This usually means your terminal session's 1Password CLI authentication has timed out or is pointed at the wrong account. Run `op signin` in your terminal to unlock the CLI, and try again!
79+
7780
## Deployment
7881

7982
You can deploy Bridgetown sites on hosts like statichost.eu and Render as well as traditional web servers by simply building and copying the output folder to your HTML root.

lib/publishers/bluesky_publisher.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
class BlueskyPublisher < Publisher
88
# TODO: Fill in these 1Password reference URIs
9-
OP_HANDLE = "op://Ruby::AZ/Ruby::AZ Bluesky/Handle"
10-
OP_APP_PASSWORD = "op://Private/Ruby::AZ Bluesky/App_Password"
9+
OP_HANDLE = "op://kfwlipdix57khyxqu75jssdpbq/ye56thdtqjc55kmgnouoiemwiq/API/Handle"
10+
OP_APP_PASSWORD = "op://kfwlipdix57khyxqu75jssdpbq/ye56thdtqjc55kmgnouoiemwiq/API/App_Password"
1111
API = "https://bsky.social"
1212

1313
def name = "Bluesky"
@@ -31,7 +31,7 @@ def post(text, reply_to: nil)
3131
"createdAt" => Time.now.utc.strftime("%Y-%m-%dT%H:%M:%S.%3NZ"),
3232
}
3333
record["facets"] = facets unless facets.empty?
34-
34+
3535
if reply_to
3636
cid = fetch_cid(session, reply_to)
3737
if cid
@@ -121,15 +121,15 @@ def fetch_cid(session, uri)
121121
repo = parts[0]
122122
collection = parts[1]
123123
rkey = parts[2]
124-
124+
125125
get_uri = URI("#{API}/xrpc/com.atproto.repo.getRecord?repo=#{repo}&collection=#{collection}&rkey=#{rkey}")
126126
req = Net::HTTP::Get.new(get_uri)
127127
req["Authorization"] = "Bearer #{session[:access_jwt]}"
128-
128+
129129
http = Net::HTTP.new(get_uri.host, get_uri.port)
130130
http.use_ssl = true
131131
res = http.request(req)
132-
132+
133133
return nil unless res.is_a?(Net::HTTPSuccess)
134134
JSON.parse(res.body)["cid"]
135135
end

lib/publishers/mastodon_publisher.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class MastodonPublisher < Publisher
88
# TODO: Fill in these 1Password reference URIs
9-
OP_TOKEN = "op://Ruby::AZ/Ruby::AZ Mastodon/Access_Token"
9+
OP_TOKEN = "op://kfwlipdix57khyxqu75jssdpbq/db7ybuqiegezwyx3wevc6ymj4u/API/Access_Token"
1010
INSTANCE = "https://ruby.social"
1111

1212
def name = "Mastodon"
@@ -22,7 +22,7 @@ def post(text, reply_to: nil)
2222

2323
request = Net::HTTP::Post.new(uri)
2424
request["Authorization"] = "Bearer #{token}"
25-
25+
2626
if reply_to && reply_to.include?("/")
2727
reply_to = reply_to.split("/").last
2828
end

lib/publishers/publisher.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ def post(text, reply_to: nil)
1919
def fetch_op_secret(op_path)
2020
output = `op read "#{op_path}" 2>&1`
2121
return output.strip if $?.success?
22+
23+
puts "\n[1Password Error]: #{output.strip}"
2224
nil
2325
end
2426
end

0 commit comments

Comments
 (0)