tangled
alpha
login
or
join now
stream.place
/
streamplace
Live video on the AT Protocol
74
fork
atom
overview
issues
1
pulls
pipelines
add branding to page title el
Natalie B.
1 week ago
b8df6914
4db669ea
+80
-38
1 changed file
expand all
collapse all
unified
split
pkg
linking
linking.go
+80
-38
pkg/linking/linking.go
···
106
106
return nil, errors.New("livestream view is not a livestream")
107
107
}
108
108
109
109
-
titleStr := fmt.Sprintf("@%s's livestream on %s", lsv.Author.Handle, u.Host)
109
109
+
titleStr := fmt.Sprintf("@%s's livestream on ", lsv.Author.Handle)
110
110
outURL := u.String()
111
111
-
112
112
-
pageTitle := fmt.Sprintf("@%s | %s", lsv.Author.Handle, u.Host)
113
111
114
112
thumbURL, _ := url.Parse(u.String())
115
113
thumbURL.Path = "/xrpc/place.stream.live.getProfileCard"
···
123
121
// Facebook Meta Tags
124
122
{Type: "property", Key: "og:url", Content: u.String()},
125
123
{Type: "property", Key: "og:type", Content: "website"},
126
126
-
{Type: "property", Key: "og:title", Content: titleStr},
127
124
{Type: "property", Key: "og:description", Content: ls.Title},
128
125
{Type: "property", Key: "og:image", Content: thumbURL.String()},
129
126
···
131
128
{Type: "name", Key: "twitter:card", Content: "summary_large_image"},
132
129
{Type: "property", Key: "twitter:domain", Content: u.Host},
133
130
{Type: "property", Key: "twitter:url", Content: outURL},
134
134
-
{Type: "name", Key: "twitter:title", Content: titleStr},
135
131
{Type: "name", Key: "twitter:description", Content: ls.Title},
136
132
{Type: "name", Key: "twitter:image", Content: thumbURL.String()},
137
133
}
134
134
+
brandingTitle := "streamplace node"
135
135
+
if l.sdb != nil && l.cli != nil {
136
136
+
branding, err := l.getBrandingAssets("did:web:" + l.cli.BroadcasterHost)
137
137
+
if err == nil {
138
138
+
for i := range branding {
139
139
+
val := branding[i]
140
140
+
if val.Key == "siteTitle" && val.Data != nil {
141
141
+
brandingTitle = *val.Data
142
142
+
}
143
143
+
marshalledJson, err := json.Marshal(val)
144
144
+
if err != nil {
145
145
+
fmt.Printf("error marshalling branding asset %s: %v\n", val.Key, err)
146
146
+
continue
147
147
+
}
148
148
+
metaTags = append(metaTags, MetaTag{
149
149
+
Type: "name",
150
150
+
Key: "internal-brand:" + val.Key,
151
151
+
Content: string(marshalledJson),
152
152
+
})
153
153
+
}
154
154
+
} else {
155
155
+
// log but we should not block rendering
156
156
+
fmt.Printf("error fetching branding assets: %v\n", err)
157
157
+
}
158
158
+
}
159
159
+
160
160
+
// do twitter/og title after
161
161
+
metaTags = append(metaTags, MetaTag{
162
162
+
Type: "property",
163
163
+
Key: "og:title",
164
164
+
Content: fmt.Sprintf("%s%s", titleStr, brandingTitle),
165
165
+
})
166
166
+
metaTags = append(metaTags, MetaTag{
167
167
+
Type: "name",
168
168
+
Key: "twitter:title",
169
169
+
Content: fmt.Sprintf("%s%s", titleStr, brandingTitle),
170
170
+
})
138
171
139
172
return l.GenerateHTML(ctx, &PageConfig{
140
140
-
Title: pageTitle,
173
173
+
Title: fmt.Sprintf("%s%s", titleStr, brandingTitle),
141
174
Metas: metaTags,
142
175
SentryDSN: sentryDSN,
143
176
})
···
160
193
{Type: "property", Key: "og:url", Content: u.String()},
161
194
{Type: "property", Key: "og:type", Content: "website"},
162
195
{Type: "property", Key: "og:title", Content: "Stream.place"},
163
163
-
{Type: "property", Key: "og:description", Content: "Stream.place is open-source livestreaming on the AT Protocol."},
196
196
+
{Type: "property", Key: "og:description", Content: "Open-source livestreaming on the AT Protocol."},
164
197
{Type: "property", Key: "og:image", Content: thumbURL.String()},
165
198
166
199
// Twitter Meta Tags
···
168
201
{Type: "property", Key: "twitter:domain", Content: u.Host},
169
202
{Type: "property", Key: "twitter:url", Content: u.String()},
170
203
{Type: "name", Key: "twitter:title", Content: "Stream.place"},
171
171
-
{Type: "name", Key: "twitter:description", Content: "Stream.place is open-source livestreaming on the AT Protocol."},
204
204
+
{Type: "name", Key: "twitter:description", Content: "Open-source livestreaming on the AT Protocol."},
172
205
{Type: "name", Key: "twitter:image", Content: thumbURL.String()},
173
206
}
174
207
208
208
+
brandingTitle := "streamplace node"
209
209
+
if l.sdb != nil && l.cli != nil {
210
210
+
branding, err := l.getBrandingAssets("did:web:" + l.cli.BroadcasterHost)
211
211
+
if err == nil {
212
212
+
for i := range branding {
213
213
+
val := branding[i]
214
214
+
if val.Key == "siteTitle" && val.Data != nil {
215
215
+
brandingTitle = *val.Data
216
216
+
}
217
217
+
marshalledJson, err := json.Marshal(val)
218
218
+
if err != nil {
219
219
+
fmt.Printf("error marshalling branding asset %s: %v\n", val.Key, err)
220
220
+
continue
221
221
+
}
222
222
+
metaTags = append(metaTags, MetaTag{
223
223
+
Type: "name",
224
224
+
Key: "internal-brand:" + val.Key,
225
225
+
Content: string(marshalledJson),
226
226
+
})
227
227
+
}
228
228
+
} else {
229
229
+
// log but we should not block rendering
230
230
+
fmt.Printf("error fetching branding assets: %v\n", err)
231
231
+
}
232
232
+
}
233
233
+
234
234
+
// do twitter/og title after
235
235
+
metaTags = append(metaTags, MetaTag{
236
236
+
Type: "property",
237
237
+
Key: "og:title",
238
238
+
Content: brandingTitle,
239
239
+
})
240
240
+
metaTags = append(metaTags, MetaTag{
241
241
+
Type: "name",
242
242
+
Key: "twitter:title",
243
243
+
Content: brandingTitle,
244
244
+
})
245
245
+
175
246
return l.GenerateHTML(ctx, &PageConfig{
176
176
-
Title: "Stream.place",
247
247
+
Title: brandingTitle,
177
248
Metas: metaTags,
178
249
SentryDSN: sentryDSN,
179
250
})
···
256
327
})
257
328
}
258
329
259
259
-
if l.sdb != nil && l.cli != nil {
260
260
-
261
261
-
branding, err := l.getBrandingAssets("did:web:" + l.cli.BroadcasterHost)
262
262
-
263
263
-
if err == nil {
264
264
-
265
265
-
for i := range branding {
266
266
-
val := branding[i]
267
267
-
//
268
268
-
marshalledJson, err := json.Marshal(val)
269
269
-
if err != nil {
270
270
-
fmt.Printf("error marshalling branding asset %s: %v\n", val.Key, err)
271
271
-
continue
272
272
-
}
273
273
-
head.AppendChild(&html.Node{
274
274
-
Type: html.ElementNode,
275
275
-
Data: "meta",
276
276
-
Attr: []html.Attribute{
277
277
-
{Key: "name", Val: "internal-brand:" + val.Key},
278
278
-
{Key: "content", Val: string(marshalledJson)},
279
279
-
},
280
280
-
})
281
281
-
282
282
-
}
283
283
-
} else {
284
284
-
// log but we should not block rendering
285
285
-
fmt.Printf("error fetching branding assets: %v\n", err)
286
286
-
}
287
287
-
}
288
330
// Render the HTML to a string
289
331
var buf bytes.Buffer
290
332
if err := html.Render(&buf, root); err != nil {