Compare commits

...

4 Commits

Author SHA1 Message Date
bryan newbold 9e36606f70 update to draft version of category short names 2025-07-19 17:37:14 +02:00
bryan newbold 8098907212 bump go toolchain in Dockerfile 2025-07-19 17:11:45 +02:00
bryan newbold 1741fef383 attempt fetching reuse intent declaration; set AI-PREF genai HTTP header if found 2025-07-19 16:40:47 +02:00
bryan newbold 302d3bc3c6 bump indigo dep 2025-07-19 16:40:11 +02:00
5 changed files with 35 additions and 5 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
FROM golang:1.23-bullseye AS build-env
FROM golang:1.24-bullseye AS build-env
WORKDIR /usr/src/social-app
+1 -1
View File
@@ -1,4 +1,4 @@
FROM golang:1.23-bullseye AS build-env
FROM golang:1.24-bullseye AS build-env
WORKDIR /usr/src/social-app
+28
View File
@@ -20,6 +20,8 @@ import (
"time"
appbsky "github.com/bluesky-social/indigo/api/bsky"
"github.com/bluesky-social/indigo/atproto/client"
"github.com/bluesky-social/indigo/atproto/identity"
"github.com/bluesky-social/indigo/atproto/syntax"
"github.com/bluesky-social/indigo/util/cliutil"
"github.com/bluesky-social/indigo/xrpc"
@@ -38,6 +40,7 @@ type Server struct {
httpd *http.Server
xrpcc *xrpc.Client
cfg *Config
dir identity.Directory
ipccClient http.Client
}
@@ -109,6 +112,7 @@ func serve(cctx *cli.Context) error {
ipccHost: ipccHost,
staticCDNHost: staticCDNHost,
},
dir: identity.DefaultDirectory(),
ipccClient: http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
@@ -593,6 +597,30 @@ func (srv *Server) WebProfile(c echo.Context) error {
if !unauthedViewingOkay {
return c.Render(http.StatusOK, "profile.html", data)
}
// resolve intents declaration
ident, err := srv.dir.Lookup(ctx, *handleOrDID)
if err != nil {
log.Warnf("failed to resolve identity: %s\t%v", handleOrDID, err)
return c.Render(http.StatusOK, "profile.html", data)
}
clnt := client.NewAPIClient(ident.PDSEndpoint())
resp := make(map[string]any)
err = clnt.Get(ctx, "com.atproto.repo.getRecord", map[string]any{"repo": ident.DID.String(), "collection": "org.user-intents.demo.declaration", "rkey": "self"}, &resp)
if nil == err {
// if we *did* get a declaration...
synthIntent, ok := resp["value"].(map[string]any)["syntheticContentGeneration"].(map[string]any)
if ok && synthIntent != nil {
log.Infof("found syntheticContentGeneration user intent from %s: %v", synthIntent["updatedAt"], synthIntent["allow"])
switch synthIntent["allow"] {
case true:
c.Response().Header().Set("Content-Usage", "train-genai=y,ai-use=y")
case false:
c.Response().Header().Set("Content-Usage", "train-genai=n,ai-use=n")
}
}
}
req := c.Request()
data["profileView"] = pv
data["requestURI"] = fmt.Sprintf("https://%s%s", req.Host, req.URL.Path)
+3 -3
View File
@@ -1,11 +1,11 @@
module github.com/bluesky-social/social-app/bskyweb
go 1.23
go 1.24
toolchain go1.23.4
toolchain go1.24.4
require (
github.com/bluesky-social/indigo v0.0.0-20250605010711-db9bb60025dc
github.com/bluesky-social/indigo v0.0.0-20250716175339-eebba3d96129
github.com/flosch/pongo2/v6 v6.0.0
github.com/ipfs/go-log v1.0.5
github.com/joho/godotenv v1.5.1
+2
View File
@@ -4,6 +4,8 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bluesky-social/indigo v0.0.0-20250605010711-db9bb60025dc h1:chbGD59Cn1mw07kbq9Uvb8WUFIr1dcoL5TOhT+I9bV4=
github.com/bluesky-social/indigo v0.0.0-20250605010711-db9bb60025dc/go.mod h1:ovyxp8AMO1Hoe838vMJUbqHTZaAR8ABM3g3TXu+A5Ng=
github.com/bluesky-social/indigo v0.0.0-20250716175339-eebba3d96129 h1:81032NtsXNDdD8St+XHEdFlbRukJDKlS7XkGhrdZKNk=
github.com/bluesky-social/indigo v0.0.0-20250716175339-eebba3d96129/go.mod h1:0XUyOCRtL4/OiyeqMTmr6RlVHQMDgw3LS7CfibuZR5Q=
github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874 h1:N7oVaKyGp8bttX0bfZGmcGkjz7DLQXhAn3DNd3T0ous=
github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874/go.mod h1:r5xuitiExdLAJ09PR7vBVENGvp4ZuTBeWTGtxuX3K+c=
github.com/carlmjohnson/versioninfo v0.22.5 h1:O00sjOLUAFxYQjlN/bzYTuZiS0y6fWDQjMRvwtKgwwc=