The code and data behind xeiaso.net
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

cmd/xesite: fix public API metadata

Signed-off-by: Xe Iaso <me@xeiaso.net>

Xe Iaso 12cb998b 988bae1a

+16 -7
+2 -1
.vscode/settings.json
··· 32 32 }, 33 33 "protoc": { 34 34 "options": ["--proto_path=pb", "--proto_path=internal/adminpb"] 35 - } 35 + }, 36 + "nixEnvSelector.nixFile": "${workspaceFolder}/flake.nix" 36 37 }
+14 -6
cmd/xesite/api.go
··· 5 5 "os" 6 6 "os/exec" 7 7 "runtime" 8 + "strings" 8 9 9 10 "github.com/twitchtv/twirp" 10 11 "google.golang.org/protobuf/types/known/emptypb" ··· 13 14 "xeiaso.net/v4/pb" 14 15 ) 15 16 17 + var denoVersion string 18 + 19 + func init() { 20 + cmd := exec.Command("deno", "--version") 21 + out, err := cmd.CombinedOutput() 22 + if err != nil { 23 + denoVersion = "unknown" 24 + return 25 + } 26 + denoVersion = strings.Split(strings.TrimSpace(string(out)), "\n")[0] 27 + } 28 + 16 29 type MetaServer struct { 17 30 fs *lume.FS 18 31 } 19 32 20 33 func (ms *MetaServer) Metadata(ctx context.Context, _ *emptypb.Empty) (*pb.BuildInfo, error) { 21 - deno, err := exec.LookPath("deno") 22 - if err != nil { 23 - return nil, twirp.InternalErrorf("can't find deno in $PATH: %w", err) 24 - } 25 - 26 34 commit, err := ms.fs.Commit() 27 35 if err != nil { 28 36 return nil, twirp.InternalErrorf("can't get commit hash: %w", err) ··· 31 39 result := &pb.BuildInfo{ 32 40 Commit: commit, 33 41 GoVersion: runtime.Version(), 34 - DenoVersion: deno, 42 + DenoVersion: denoVersion, 35 43 XesiteVersion: os.Args[0], 36 44 BuildTime: timestamppb.New(ms.fs.BuildTime()), 37 45 }