Monorepo for Tangled tangled.org

Compare changes

Choose any two refs to compare.

Changed files
+53 -47
appview
pages
templates
layouts
state
cmd
dolly
docs
nix
+4
appview/pages/templates/layouts/base.html
··· 11 <script defer src="/static/htmx-ext-ws.min.js"></script> 12 <script defer src="/static/actor-typeahead.js" type="module"></script> 13 14 <!-- preconnect to image cdn --> 15 <link rel="preconnect" href="https://avatar.tangled.sh" /> 16 <link rel="preconnect" href="https://camo.tangled.sh" />
··· 11 <script defer src="/static/htmx-ext-ws.min.js"></script> 12 <script defer src="/static/actor-typeahead.js" type="module"></script> 13 14 + <link rel="icon" href="/static/logos/dolly.ico" sizes="48x48"/> 15 + <link rel="icon" href="/static/logos/dolly.svg" sizes="any" type="image/svg+xml"/> 16 + <link rel="apple-touch-icon" href="/static/logos/dolly.png"/> 17 + 18 <!-- preconnect to image cdn --> 19 <link rel="preconnect" href="https://avatar.tangled.sh" /> 20 <link rel="preconnect" href="https://camo.tangled.sh" />
+29
appview/state/manifest.go
···
··· 1 + package state 2 + 3 + import ( 4 + "encoding/json" 5 + "net/http" 6 + ) 7 + 8 + // https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Manifest 9 + // https://www.w3.org/TR/appmanifest/ 10 + var manifestData = map[string]any{ 11 + "name": "tangled", 12 + "description": "tightly-knit social coding.", 13 + "icons": []map[string]string{ 14 + { 15 + "src": "/static/logos/dolly.svg", 16 + "sizes": "144x144", 17 + }, 18 + }, 19 + "start_url": "/", 20 + "id": "https://tangled.org", 21 + "display": "standalone", 22 + "background_color": "#111827", 23 + "theme_color": "#111827", 24 + } 25 + 26 + func (p *State) WebAppManifest(w http.ResponseWriter, r *http.Request) { 27 + w.Header().Set("Content-Type", "application/manifest+json") 28 + json.NewEncoder(w).Encode(manifestData) 29 + }
+1 -3
appview/state/router.go
··· 32 s.pages, 33 ) 34 35 - router.Get("/favicon.svg", s.Favicon) 36 - router.Get("/favicon.ico", s.Favicon) 37 - router.Get("/pwa-manifest.json", s.PWAManifest) 38 router.Get("/robots.txt", s.RobotsTxt) 39 40 userRouter := s.UserRouter(&middleware)
··· 32 s.pages, 33 ) 34 35 + router.Get("/pwa-manifest.json", s.WebAppManifest) 36 router.Get("/robots.txt", s.RobotsTxt) 37 38 userRouter := s.UserRouter(&middleware)
-36
appview/state/state.go
··· 202 return s.db.Close() 203 } 204 205 - func (s *State) Favicon(w http.ResponseWriter, r *http.Request) { 206 - w.Header().Set("Content-Type", "image/svg+xml") 207 - w.Header().Set("Cache-Control", "public, max-age=31536000") // one year 208 - w.Header().Set("ETag", `"favicon-svg-v1"`) 209 - 210 - if match := r.Header.Get("If-None-Match"); match == `"favicon-svg-v1"` { 211 - w.WriteHeader(http.StatusNotModified) 212 - return 213 - } 214 - 215 - s.pages.Favicon(w) 216 - } 217 - 218 func (s *State) RobotsTxt(w http.ResponseWriter, r *http.Request) { 219 w.Header().Set("Content-Type", "text/plain") 220 w.Header().Set("Cache-Control", "public, max-age=86400") // one day ··· 223 Allow: / 224 ` 225 w.Write([]byte(robotsTxt)) 226 - } 227 - 228 - // https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Manifest 229 - const manifestJson = `{ 230 - "name": "tangled", 231 - "description": "tightly-knit social coding.", 232 - "icons": [ 233 - { 234 - "src": "/favicon.svg", 235 - "sizes": "144x144" 236 - } 237 - ], 238 - "start_url": "/", 239 - "id": "org.tangled", 240 - 241 - "display": "standalone", 242 - "background_color": "#111827", 243 - "theme_color": "#111827" 244 - }` 245 - 246 - func (p *State) PWAManifest(w http.ResponseWriter, r *http.Request) { 247 - w.Header().Set("Content-Type", "application/json") 248 - w.Write([]byte(manifestJson)) 249 } 250 251 func (s *State) TermsOfService(w http.ResponseWriter, r *http.Request) {
··· 202 return s.db.Close() 203 } 204 205 func (s *State) RobotsTxt(w http.ResponseWriter, r *http.Request) { 206 w.Header().Set("Content-Type", "text/plain") 207 w.Header().Set("Cache-Control", "public, max-age=86400") // one day ··· 210 Allow: / 211 ` 212 w.Write([]byte(robotsTxt)) 213 } 214 215 func (s *State) TermsOfService(w http.ResponseWriter, r *http.Request) {
+1 -1
cmd/dolly/main.go
··· 47 os.Exit(1) 48 } 49 50 - if !isValidHexColor(fillColor) { 51 fmt.Fprintf(os.Stderr, "Invalid color format: %s. Use hex format like #FF5733\n", fillColor) 52 os.Exit(1) 53 }
··· 47 os.Exit(1) 48 } 49 50 + if fillColor != "currentColor" && !isValidHexColor(fillColor) { 51 fmt.Fprintf(os.Stderr, "Invalid color format: %s. Use hex format like #FF5733\n", fillColor) 52 os.Exit(1) 53 }
+6
docs/logo.html
···
··· 1 + <div class="flex items-center gap-2 w-fit mx-auto"> 2 + <span class="w-16 h-16 [&>svg]:w-full [&>svg]:h-full text-black dark:text-white"> 3 + ${ dolly.svg() } 4 + </span> 5 + <span class="font-bold text-4xl not-italic text-black dark:text-white">tangled</span> 6 + </div>
+7 -6
docs/template.html
··· 74 ${ x.svg() } 75 $if(toc-title)$$toc-title$$else$Table of Contents$endif$ 76 </button> 77 ${ search.html() } 78 ${ table-of-contents:toc.html() } 79 </div> ··· 88 class="hidden md:flex md:flex-col gap-4 fixed left-0 top-0 w-80 h-screen 89 bg-gray-50 dark:bg-gray-800 border-r border-gray-200 dark:border-gray-700 90 p-4 z-50 overflow-y-auto"> 91 ${ search.html() } 92 <div class="flex-1"> 93 $if(toc-title)$ ··· 118 $endif$ 119 $endif$ 120 </header> 121 - $endif$ 122 - 123 - $if(abstract)$ 124 - <article class="prose dark:prose-invert max-w-none"> 125 - $abstract$ 126 - </article> 127 $endif$ 128 129 <article class="prose dark:prose-invert max-w-none">
··· 74 ${ x.svg() } 75 $if(toc-title)$$toc-title$$else$Table of Contents$endif$ 76 </button> 77 + ${ logo.html() } 78 ${ search.html() } 79 ${ table-of-contents:toc.html() } 80 </div> ··· 89 class="hidden md:flex md:flex-col gap-4 fixed left-0 top-0 w-80 h-screen 90 bg-gray-50 dark:bg-gray-800 border-r border-gray-200 dark:border-gray-700 91 p-4 z-50 overflow-y-auto"> 92 + ${ logo.html() } 93 ${ search.html() } 94 <div class="flex-1"> 95 $if(toc-title)$ ··· 120 $endif$ 121 $endif$ 122 </header> 123 + $if(abstract)$ 124 + <article class="prose dark:prose-invert max-w-none"> 125 + $abstract$ 126 + </article> 127 + $endif$ 128 $endif$ 129 130 <article class="prose dark:prose-invert max-w-none">
+1 -1
nix/pkgs/appview-static-files.nix
··· 30 31 ${dolly}/bin/dolly -output logos/dolly.png -size 180x180 32 ${dolly}/bin/dolly -output logos/dolly.ico -size 48x48 33 - ${dolly}/bin/dolly -output logos/dolly.svg 34 # tailwindcss -c $src/tailwind.config.js -i $src/input.css -o tw.css won't work 35 # for whatever reason (produces broken css), so we are doing this instead 36 cd ${src} && ${tailwindcss}/bin/tailwindcss -i input.css -o $out/tw.css
··· 30 31 ${dolly}/bin/dolly -output logos/dolly.png -size 180x180 32 ${dolly}/bin/dolly -output logos/dolly.ico -size 48x48 33 + ${dolly}/bin/dolly -output logos/dolly.svg -color currentColor 34 # tailwindcss -c $src/tailwind.config.js -i $src/input.css -o tw.css won't work 35 # for whatever reason (produces broken css), so we are doing this instead 36 cd ${src} && ${tailwindcss}/bin/tailwindcss -i input.css -o $out/tw.css
+4
nix/pkgs/docs.nix
··· 5 inter-fonts-src, 6 ibm-plex-mono-src, 7 lucide-src, 8 src, 9 }: 10 runCommandLocal "docs" {} '' ··· 17 18 # icons 19 cp -rf ${lucide-src}/*.svg working/ 20 21 # content - chunked 22 ${pandoc}/bin/pandoc ${src}/docs/DOCS.md \
··· 5 inter-fonts-src, 6 ibm-plex-mono-src, 7 lucide-src, 8 + dolly, 9 src, 10 }: 11 runCommandLocal "docs" {} '' ··· 18 19 # icons 20 cp -rf ${lucide-src}/*.svg working/ 21 + 22 + # logo 23 + ${dolly}/bin/dolly -output working/dolly.svg -color currentColor 24 25 # content - chunked 26 ${pandoc}/bin/pandoc ${src}/docs/DOCS.md \