queensferryme / hugo-theme-texify

A minimal, latex-style hugo theme for personal blogging
https://texify.qufy.me
MIT License
142 stars 46 forks source link

Shortcode tests unavailable (network error) #1

Closed queensferryme closed 3 years ago

queensferryme commented 4 years ago

I import the official hugo example site (https://github.com/gohugoio/hugoBasicExample) for testing this theme. However, content/post/rich-content.md result in an issue, presumably related to networking.

This file contains hugo shortcodes for instagram, twitter etc., and these services are sofar unaccessible from China mainland.

queensferry at queensferry-windows in /mnt/d/Code/hugo-theme-verse on features/site!
 ± hugo server --config="exampleSite/config.toml" --disableFastRender

Building sites … WARN 2020/02/01 19:32:16 found no layout file for "HTML" for "taxonomyTerm": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/02/01 19:32:16 found no layout file for "HTML" for "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/02/01 19:32:16 found no layout file for "HTML" for "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
ERROR 2020/02/01 19:32:17 Failed to get JSON resource "https://api.instagram.com/oembed/?url=https://www.instagram.com/p/BGvuInzyFAe/&maxwidth=640&omitscript=true": Get https://api.instagram.com/oembed/?url=https://www.instagram.com/p/BGvuInzyFAe/&maxwidth=640&omitscript=true: EOF
ERROR 2020/02/01 19:32:38 Failed to get JSON resource "https://api.twitter.com/1/statuses/oembed.json?id=1085870671291310081&omit_script=true": Get https://api.twitter.com/1/statuses/oembed.json?id=1085870671291310081&omit_script=true: dial tcp [2400:cb00:2048:1::6814:224e]:443: connect: connection refused
Total in 30017 ms
Error: Error building site: "/mnt/d/Code/hugo-theme-verse/exampleSite/content/posts/rich-content.md:1:1": timed out initializing value. This is most likely a circular loop in a shortcode

Using proxies (with proxychains4) doesn't help on my computer. Hence, this file content/post/rich-content.md is temporarily removed from exampleSite, waiting for future resolvement.

Creedowl commented 4 years ago

proxychains4 works well on my computer, please check your network

queensferryme commented 4 years ago

Related issues: https://github.com/gohugoio/hugo/issues/5659, https://github.com/gohugoio/hugo/issues/6954, https://github.com/gohugoio/hugo/issues/7228

queensferryme commented 4 years ago

Related issues: https://github.com/rofl0r/proxychains-ng/issues/199

As mentioned by the author of proxychains-ng:

proxychains hooks to dynamically loaded libc.

  1. go doesn't even use libc, it uses its own syscall wrappers
  2. go doesn't use dynamic linking, it uses static linking

so there's no way we could use this technique with go. the only way to hook into go binaries would be by using ptrace to hook the system calls themselves, which is hairy and platform-dependent - i.e. it means it would be a lot more work to produce and maintain. so i fear it is out of scope for this utility.

A possible alternative would be using graftcp.

queensferryme commented 3 years ago

Golang does not use libc, so proxychains-ng won't work. Turns out the solution is actually simple: set env vars like HTTP_PROXY and HTTPS_PROXY etc.