ImportSubscription no longer requires only http(s): paste awg://, AWG .conf/JSON, or naive links; subscription parser also reads hosted AWG and Clash wireguard/naive. Site lists support emails and FAQ; Store listing texts/tools updated. Co-authored-by: Cursor <cursoragent@cursor.com>
60 lines
1.2 KiB
Go
60 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"encoding/csv"
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
func main() {
|
|
path := filepath.Join(`D:\vpn navi`, "store.csv")
|
|
f, err := os.Open(path)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
r := csv.NewReader(f)
|
|
r.FieldsPerRecord = -1
|
|
r.LazyQuotes = true
|
|
all, err := r.ReadAll()
|
|
f.Close()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
h := all[0]
|
|
di, ei := 3, 4
|
|
for i, x := range h {
|
|
if x == "default" {
|
|
di = i
|
|
}
|
|
if x == "en" {
|
|
ei = i
|
|
}
|
|
}
|
|
ruB, _ := os.ReadFile(filepath.Join(`D:\vpn navi`, "dist", "microsoft-store", "AdditionalLicense.ru.txt"))
|
|
enB, _ := os.ReadFile(filepath.Join(`D:\vpn navi`, "dist", "microsoft-store", "AdditionalLicense.en.txt"))
|
|
ru := string(ruB)
|
|
en := string(enB)
|
|
for i := 1; i < len(all); i++ {
|
|
for len(all[i]) < len(h) {
|
|
all[i] = append(all[i], "")
|
|
}
|
|
if all[i][0] == "AdditionalLicenseTerms" {
|
|
all[i][di] = ru
|
|
all[i][ei] = en
|
|
}
|
|
}
|
|
out, err := os.Create(path)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
_, _ = out.Write([]byte{0xEF, 0xBB, 0xBF})
|
|
w := csv.NewWriter(out)
|
|
_ = w.WriteAll(all)
|
|
w.Flush()
|
|
out.Close()
|
|
listing := filepath.Join(`D:\vpn navi`, "dist", "microsoft-store", "listing", "store.csv")
|
|
if data, err := os.ReadFile(path); err == nil {
|
|
_ = os.WriteFile(listing, data, 0644)
|
|
}
|
|
}
|