mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 23:23:28 +00:00
add cookie jar
This commit is contained in:
9742
src/data/public_suffix_list.zig
Normal file
9742
src/data/public_suffix_list.zig
Normal file
File diff suppressed because it is too large
Load Diff
42
src/data/public_suffix_list_gen.go
Normal file
42
src/data/public_suffix_list_gen.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
resp, err := http.Get("https://publicsuffix.org/list/public_suffix_list.dat")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
var domains []string
|
||||
|
||||
scanner := bufio.NewScanner(resp.Body)
|
||||
for scanner.Scan() {
|
||||
line := strings.TrimSpace(scanner.Text())
|
||||
if len(line) == 0 || strings.HasPrefix(line, "//") {
|
||||
continue
|
||||
}
|
||||
|
||||
domains = append(domains, line)
|
||||
}
|
||||
|
||||
lookup :=
|
||||
"const std = @import(\"std\");\n\n" +
|
||||
"pub fn lookup(value: []const u8) bool {\n" +
|
||||
" return public_suffix_list.has(value);\n" +
|
||||
"}\n"
|
||||
fmt.Println(lookup)
|
||||
|
||||
fmt.Println("const public_suffix_list = std.StaticStringMap(void).initComptime([_]struct { []const u8, void }{")
|
||||
for _, domain := range domains {
|
||||
fmt.Printf(` .{ "%s", {} },`, domain)
|
||||
fmt.Println()
|
||||
}
|
||||
fmt.Println("});")
|
||||
}
|
||||
Reference in New Issue
Block a user