# A closer look at geminispace.info backlinks Continuation of testing why comitium feed agregator have failed to handle geminispace.info backlinks (as I mentioned in [previous post at Sat 29 May 2021 08:36:05 PM CEST]). The first part of answer is obvious because geminispace.info backlink page template consists in [root/serve/templates/fragments/footer.gmi] two variables. One of it is printed, and it is changing every time geminispace.info index is updated. The second part of answer is still unclear for me. Because I have added two backlinks pages to my comitium installation. The first for szczezuja.flounder.online domain, and the second for szczezuja.space domain. And there must be some difference because, beside index update date, the pages are in different "days" on comitium feeds page. I was thinking that dynamic created page on geminispace.info could be processed in different way, despite the same content. But after I have been looking into the source code there are no evidence that there is a place for such difference. Comitium is computing a hash for whole response from gemini client library. Everything seems to be ok. The main conclusions are: * It will be easy to build some Bash script in the same manner as Lace.sh to get content of geminispace.info/backlink page; * It won't be necessary to use of gp-gemini library - easier is to use openssl system command; * It will be easy to parse and remove tricky sections of content; * It will be easy to make diff, and compute hash for changes tracking; ## GUS ### [root/serve/views.py] > @app.route("/backlinks") > def backlinks(request): > if request.query: > url = unquote(request.query) > internal_backlinks, external_backlinks = gus.get_backlinks(url) > body = render_template( > "backlinks.gmi", > url=url, > internal_backlinks=internal_backlinks, > external_backlinks=external_backlinks, > index_modification_time=gus.statistics["index_modification_time"], > quote=random.choice(constants.QUOTE_BANK), > ) > return Response(Status.SUCCESS, "text/gemini", body) > else: > return Response(Status.INPUT, "Gemini URL") ### [root/serve/templates/fragments/footer.gmi] > > "{{ quote["quote"] }}" --- {{ quote["author"] }} > => /add-seed See any missing results? Let GUS know your Gemini URL exists. > Index updated on: {{ index_modification_time|datetimeformat }} The footer fragment, which is included in every page is a bit problematic. It has some fortune message code (which is not activated on geminispace.info) and indext modification time. ### [root/serve/templates/backlinks.gmi] The backlinks page template looks ok. There are no changing parts, only core information and a duck ASCII-art. ## Comitium ### [root/fetch/gemini.go] > func geminiPage(data *core.FullData, remote string, title string) error { > resp, err := fetchGemini(remote) > if err != nil { > return err > } > defer resp.Body.Close() > > reader := io.LimitReader(resp.Body, 1073741824) // 1 GiB > > var page core.Page > page.Title = title > page.Link = remote > h := sha256.New() > if _, err := io.Copy(h, reader); err != nil { > return err > } > newHash := fmt.Sprintf("%x", h.Sum(nil)) > page.Hash = newHash > page.Updated = time.Now() > > data.InsertPage(&page, remote) > return nil > } Comitium looks also ok, it is computing SHA256 for fetched response. ## go-gemini ### [go-gemini/client.go] Looks that go-gemini library is passing original content readed from network address. => gemini://szczezuja.space/tinylog.gmi [previous post at Sat 29 May 2021 08:36:05 PM CEST] => https://natpen.net/code/gus/tree/serve/views.py [root/serve/views.py] => https://natpen.net/code/gus/tree/serve/templates/backlinks.gmi [root/serve/templates/backlinks.gmi] => https://natpen.net/code/gus/tree/serve/templates/fragments/footer.gmi [root/serve/templates/fragments/footer.gmi] => https://git.nytpu.com/comitium/tree/fetch/gemini.go [root/fetch/gemini.go] => https://git.sr.ht/~adnano/go-gemini/tree/master/item/client.go [go-gemini/client.go] -- szczezuja.space CC BY-SA @ Mon 31 May 2021 08:10:16 PM CEST tags: #backlink, #gemini