Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Dns = Spec.ServiceProvider{ Id: "dns", NeedProxy: false, MatchHandler: func(c Spec.Claim) bool { if !strings.HasPrefix(c.String(), "dns:") { return false } if !strings.HasSuffix(c.String(), "?type=TXT") { return false } domain := strings.TrimSuffix(strings.TrimPrefix(c.String(), "dns:"), "?type=TXT") return utils.Is_fqdn(domain) }, MakeClaimProfileFunc: makeProfileDns, FetchFunc: fetchDns, }
View Source
var Forgejo = Spec.ServiceProvider{ Id: "forgejo", NeedProxy: false, MatchHandler: func(c Spec.Claim) bool { if !utils.Is_https_url(string(c)) { return false } url, err := url.Parse(string(c)) if err != nil { return false } path := url.Path s := strings.Split(path, "/") if len(s) != 3 { return false } user := s[1] repo := s[2] api_url := "https://" + url.Host + "/api/v1/repos/" + user + "/" + repo re, err := http.NewRequest("GET", api_url, nil) if err != nil { return false } Re, err := http.DefaultClient.Do(re) if err != nil { return false } defer Re.Body.Close() if Re.StatusCode != 200 { return false } var res map[string]any b, err := io.ReadAll(Re.Body) if err != nil { return false } err = json.Unmarshal(b, &res) if err != nil { return false } n, ok := res["name"].(string) if !ok || n != repo { return false } if res["owner"].(map[string]any)["login"].(string) != user { return false } if res["html_url"].(string) != string(c) { return false } return true }, MakeClaimProfileFunc: makeProfileForgejo, FetchFunc: fetchForgejo, }
View Source
var Github = Spec.ServiceProvider{ Id: "github", NeedProxy: false, MatchHandler: func(c Spec.Claim) bool { re := regexp.MustCompile(`^https://gist\.github\.com/[^/]+/[^/]+/?$`) return re.MatchString(string(c)) }, MakeClaimProfileFunc: makeProfileGithub, FetchFunc: fetchGithub, }
View Source
var Misskey = Spec.ServiceProvider{ Id: "misskey", NeedProxy: false, MatchHandler: func(c Spec.Claim) bool { if !utils.Is_https_url(string(c)) { return false } url, err := url.Parse(string(c)) if err != nil { return false } meta_api := "https://" + url.Hostname() + "/api/meta" json_detail_false := []byte(`{"detail":false}`) meta, err := utils.Post_fetchJson(meta_api, bytes.NewReader(json_detail_false)) if err != nil { return false } defer meta.Body.Close() if meta.StatusCode != 200 { return false } var res map[string]any b, err := io.ReadAll(meta.Body) if err != nil { return false } err = json.Unmarshal(b, &res) if err != nil { return false } if res["uri"] != "https://"+url.Hostname() { return false } return true }, MakeClaimProfileFunc: makeProfileMisskey, FetchFunc: fetchMisskey, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.