AdGuardHome/scripts/translations/main.go

539 lines
11 KiB
Go
Raw Normal View History

Pull request 1763: AG-20200-translation-script Merge in DNS/adguard-home from AG-20200-translation-script to master Squashed commit of the following: commit 3113b77c0312219f8134324caa232a53c42a3988 Merge: bbd784ab f736d85e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 17:41:08 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit bbd784ab817955f3342d140644a3199d558c22b8 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 13:23:48 2023 +0300 scripts: imp code commit 7d379ab1fc2ae9858f8e7e3754de9be3d23153b6 Merge: 4f6278ad 1daabb97 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 12:01:16 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 4f6278adb28287205a4fc89239e7ba776a15ff7a Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Mar 17 14:27:32 2023 +0300 scripts: imp error handling commit 64e307a591cfeac1986d477a55bcc714636663bc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 15:41:39 2023 +0300 scripts: imp code commit fe06df88f2bb3fc0de83f83deea26652485a22d4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 15:23:20 2023 +0300 scripts: add docs commit 15d65a075373586fc31a595d7c831b80752d7cf2 Merge: ddd3cacd 9f7a582d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 13:04:16 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit ddd3cacd507ca861c4d9d5f7600bdcc2c3068315 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 13:03:11 2023 +0300 scripts: imp code commit 4e8ebdc199f0c0ff4e7c7b8ae71483cca6c4d428 Merge: 73fedefa c6706445 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Mar 15 12:25:36 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 73fedefa4ceaf2273648afe5816f1903d96ba213 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Mar 15 12:25:04 2023 +0300 scripts: fix chlog commit 780b0a257b6b2e684cfe8a49e4c4d22bcd4056ec Merge: ef70d192 595484e0 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 14 14:58:24 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit ef70d192555a9ef2acd6dd1caeb4f05a10a1de63 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 14 14:57:36 2023 +0300 scripts: upd readme commit e28655826c8c5ce6ddf3cc904201681286a6be87 Merge: cae3b769 a2053526 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 13 14:28:47 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit cae3b769dfa6906653b32104169ae4a08a2c3723 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 13 14:27:29 2023 +0300 scripts: rm translations js commit 77e2e3480b52a70b8ef9be8f1edf581cca2a1a3a Merge: 99e2382a c11a52d6 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 7 16:04:06 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 99e2382a161dee0bff30ae488d8b42565330d82e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 7 16:03:19 2023 +0300 scripts: add translations go
2023-03-21 17:43:48 +03:00
// translations downloads translations, uploads translations, prints summary
// for translations, prints unused strings.
package main
import (
"bytes"
"encoding/json"
"flag"
"fmt"
"io"
Pull request 1789: AG-20200-translation-script-fix-upload Merge in DNS/adguard-home from AG-20200-translation-script-fix-upload to master Squashed commit of the following: commit 4d898926828dc438c29b0ae7cbad70d8dea0b8de Merge: 41ad204b 487675b9 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 13:30:36 2023 +0300 Merge branch 'master' into AG-20200-translation-script-fix-upload commit 41ad204bc3ce52ecc61e95261b9519cfc0af9abe Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 13:29:26 2023 +0300 scripts: imp more commit 5ea4821ee49638ad9011809faba0316a753a078b Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 12:38:22 2023 +0300 scripts: imp code commit 253a72fd0e195c7603883322885b7206ed434918 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 12:04:16 2023 +0300 scripts: add docs commit bfd70e338c78fd5b0292480d7f54f396593e98ca Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 10:56:05 2023 +0300 scripts: imp more commit 547b82785f210cc137903cb5b7e2ee41b2a20e59 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 10:08:16 2023 +0300 scripts: imp code commit a788e5ef8a3aa2633cc9fb64c83534f1d4080ef7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 20:14:55 2023 +0300 scripts: add multipart commit 39d352edf85288a51931dea5b758bc74dd08e19d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 18:35:08 2023 +0300 scripts: fix more commit bcbf155135c53789cc5c6c2c7c8b57dd471e4ea2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 17:47:40 2023 +0300 scripts: fix upload
2023-03-28 18:02:32 +03:00
"mime/multipart"
Pull request 1763: AG-20200-translation-script Merge in DNS/adguard-home from AG-20200-translation-script to master Squashed commit of the following: commit 3113b77c0312219f8134324caa232a53c42a3988 Merge: bbd784ab f736d85e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 17:41:08 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit bbd784ab817955f3342d140644a3199d558c22b8 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 13:23:48 2023 +0300 scripts: imp code commit 7d379ab1fc2ae9858f8e7e3754de9be3d23153b6 Merge: 4f6278ad 1daabb97 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 12:01:16 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 4f6278adb28287205a4fc89239e7ba776a15ff7a Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Mar 17 14:27:32 2023 +0300 scripts: imp error handling commit 64e307a591cfeac1986d477a55bcc714636663bc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 15:41:39 2023 +0300 scripts: imp code commit fe06df88f2bb3fc0de83f83deea26652485a22d4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 15:23:20 2023 +0300 scripts: add docs commit 15d65a075373586fc31a595d7c831b80752d7cf2 Merge: ddd3cacd 9f7a582d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 13:04:16 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit ddd3cacd507ca861c4d9d5f7600bdcc2c3068315 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 13:03:11 2023 +0300 scripts: imp code commit 4e8ebdc199f0c0ff4e7c7b8ae71483cca6c4d428 Merge: 73fedefa c6706445 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Mar 15 12:25:36 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 73fedefa4ceaf2273648afe5816f1903d96ba213 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Mar 15 12:25:04 2023 +0300 scripts: fix chlog commit 780b0a257b6b2e684cfe8a49e4c4d22bcd4056ec Merge: ef70d192 595484e0 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 14 14:58:24 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit ef70d192555a9ef2acd6dd1caeb4f05a10a1de63 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 14 14:57:36 2023 +0300 scripts: upd readme commit e28655826c8c5ce6ddf3cc904201681286a6be87 Merge: cae3b769 a2053526 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 13 14:28:47 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit cae3b769dfa6906653b32104169ae4a08a2c3723 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 13 14:27:29 2023 +0300 scripts: rm translations js commit 77e2e3480b52a70b8ef9be8f1edf581cca2a1a3a Merge: 99e2382a c11a52d6 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 7 16:04:06 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 99e2382a161dee0bff30ae488d8b42565330d82e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 7 16:03:19 2023 +0300 scripts: add translations go
2023-03-21 17:43:48 +03:00
"net/http"
Pull request 1789: AG-20200-translation-script-fix-upload Merge in DNS/adguard-home from AG-20200-translation-script-fix-upload to master Squashed commit of the following: commit 4d898926828dc438c29b0ae7cbad70d8dea0b8de Merge: 41ad204b 487675b9 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 13:30:36 2023 +0300 Merge branch 'master' into AG-20200-translation-script-fix-upload commit 41ad204bc3ce52ecc61e95261b9519cfc0af9abe Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 13:29:26 2023 +0300 scripts: imp more commit 5ea4821ee49638ad9011809faba0316a753a078b Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 12:38:22 2023 +0300 scripts: imp code commit 253a72fd0e195c7603883322885b7206ed434918 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 12:04:16 2023 +0300 scripts: add docs commit bfd70e338c78fd5b0292480d7f54f396593e98ca Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 10:56:05 2023 +0300 scripts: imp more commit 547b82785f210cc137903cb5b7e2ee41b2a20e59 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 10:08:16 2023 +0300 scripts: imp code commit a788e5ef8a3aa2633cc9fb64c83534f1d4080ef7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 20:14:55 2023 +0300 scripts: add multipart commit 39d352edf85288a51931dea5b758bc74dd08e19d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 18:35:08 2023 +0300 scripts: fix more commit bcbf155135c53789cc5c6c2c7c8b57dd471e4ea2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 17:47:40 2023 +0300 scripts: fix upload
2023-03-28 18:02:32 +03:00
"net/textproto"
Pull request 1763: AG-20200-translation-script Merge in DNS/adguard-home from AG-20200-translation-script to master Squashed commit of the following: commit 3113b77c0312219f8134324caa232a53c42a3988 Merge: bbd784ab f736d85e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 17:41:08 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit bbd784ab817955f3342d140644a3199d558c22b8 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 13:23:48 2023 +0300 scripts: imp code commit 7d379ab1fc2ae9858f8e7e3754de9be3d23153b6 Merge: 4f6278ad 1daabb97 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 12:01:16 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 4f6278adb28287205a4fc89239e7ba776a15ff7a Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Mar 17 14:27:32 2023 +0300 scripts: imp error handling commit 64e307a591cfeac1986d477a55bcc714636663bc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 15:41:39 2023 +0300 scripts: imp code commit fe06df88f2bb3fc0de83f83deea26652485a22d4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 15:23:20 2023 +0300 scripts: add docs commit 15d65a075373586fc31a595d7c831b80752d7cf2 Merge: ddd3cacd 9f7a582d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 13:04:16 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit ddd3cacd507ca861c4d9d5f7600bdcc2c3068315 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 13:03:11 2023 +0300 scripts: imp code commit 4e8ebdc199f0c0ff4e7c7b8ae71483cca6c4d428 Merge: 73fedefa c6706445 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Mar 15 12:25:36 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 73fedefa4ceaf2273648afe5816f1903d96ba213 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Mar 15 12:25:04 2023 +0300 scripts: fix chlog commit 780b0a257b6b2e684cfe8a49e4c4d22bcd4056ec Merge: ef70d192 595484e0 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 14 14:58:24 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit ef70d192555a9ef2acd6dd1caeb4f05a10a1de63 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 14 14:57:36 2023 +0300 scripts: upd readme commit e28655826c8c5ce6ddf3cc904201681286a6be87 Merge: cae3b769 a2053526 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 13 14:28:47 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit cae3b769dfa6906653b32104169ae4a08a2c3723 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 13 14:27:29 2023 +0300 scripts: rm translations js commit 77e2e3480b52a70b8ef9be8f1edf581cca2a1a3a Merge: 99e2382a c11a52d6 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 7 16:04:06 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 99e2382a161dee0bff30ae488d8b42565330d82e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 7 16:03:19 2023 +0300 scripts: add translations go
2023-03-21 17:43:48 +03:00
"net/url"
"os"
"path/filepath"
"strings"
"sync"
"time"
"github.com/AdguardTeam/AdGuardHome/internal/aghio"
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/golibs/log"
"golang.org/x/exp/maps"
"golang.org/x/exp/slices"
)
const (
twoskyConfFile = "./.twosky.json"
localesDir = "./client/src/__locales"
defaultBaseFile = "en.json"
defaultProjectID = "home"
srcDir = "./client/src"
twoskyURI = "https://twosky.int.agrd.dev/api/v1"
readLimit = 1 * 1024 * 1024
)
// langCode is a language code.
type langCode string
// languages is a map, where key is language code and value is display name.
type languages map[langCode]string
// textlabel is a text label of localization.
type textLabel string
// locales is a map, where key is text label and value is translation.
type locales map[textLabel]string
func main() {
if len(os.Args) == 1 {
usage("need a command")
}
if os.Args[1] == "help" {
usage("")
}
uriStr := os.Getenv("TWOSKY_URI")
if uriStr == "" {
uriStr = twoskyURI
}
uri, err := url.Parse(uriStr)
check(err)
projectID := os.Getenv("TWOSKY_PROJECT_ID")
if projectID == "" {
projectID = defaultProjectID
}
conf, err := readTwoskyConf()
check(err)
switch os.Args[1] {
case "summary":
err = summary(conf.Languages)
check(err)
case "download":
err = download(uri, projectID, conf.Languages)
check(err)
case "unused":
err = unused()
check(err)
case "upload":
err = upload(uri, projectID, conf.BaseLangcode)
check(err)
default:
usage("unknown command")
}
}
// check is a simple error-checking helper for scripts.
func check(err error) {
if err != nil {
panic(err)
}
}
// usage prints usage. If addStr is not empty print addStr and exit with code
// 1, otherwise exit with code 0.
func usage(addStr string) {
const usageStr = `Usage: go run main.go <command> [<args>]
Commands:
help
Print usage.
summary
Print summary.
download [-n <count>]
Download translations. count is a number of concurrent downloads.
unused
Print unused strings.
upload
Upload translations.`
if addStr != "" {
fmt.Printf("%s\n%s\n", addStr, usageStr)
os.Exit(1)
}
fmt.Println(usageStr)
os.Exit(0)
}
// twoskyConf is the configuration structure for localization.
type twoskyConf struct {
Languages languages `json:"languages"`
ProjectID string `json:"project_id"`
BaseLangcode langCode `json:"base_locale"`
LocalizableFiles []string `json:"localizable_files"`
}
// readTwoskyConf returns configuration.
func readTwoskyConf() (t twoskyConf, err error) {
b, err := os.ReadFile(twoskyConfFile)
if err != nil {
// Don't wrap the error since it's informative enough as is.
return twoskyConf{}, err
}
var tsc []twoskyConf
err = json.Unmarshal(b, &tsc)
if err != nil {
err = fmt.Errorf("unmarshalling %q: %w", twoskyConfFile, err)
return twoskyConf{}, err
}
if len(tsc) == 0 {
err = fmt.Errorf("%q is empty", twoskyConfFile)
return twoskyConf{}, err
}
conf := tsc[0]
for _, lang := range conf.Languages {
if lang == "" {
return twoskyConf{}, errors.Error("language is empty")
}
}
return conf, nil
}
// readLocales reads file with name fn and returns a map, where key is text
// label and value is localization.
func readLocales(fn string) (loc locales, err error) {
b, err := os.ReadFile(fn)
if err != nil {
// Don't wrap the error since it's informative enough as is.
return nil, err
}
loc = make(locales)
err = json.Unmarshal(b, &loc)
if err != nil {
err = fmt.Errorf("unmarshalling %q: %w", fn, err)
return nil, err
}
return loc, nil
}
// summary prints summary for translations.
func summary(langs languages) (err error) {
basePath := filepath.Join(localesDir, defaultBaseFile)
baseLoc, err := readLocales(basePath)
if err != nil {
return fmt.Errorf("summary: %w", err)
}
size := float64(len(baseLoc))
keys := maps.Keys(langs)
slices.Sort(keys)
for _, lang := range keys {
name := filepath.Join(localesDir, string(lang)+".json")
if name == basePath {
continue
}
var loc locales
loc, err = readLocales(name)
if err != nil {
return fmt.Errorf("summary: reading locales: %w", err)
}
f := float64(len(loc)) * 100 / size
fmt.Printf("%s\t %6.2f %%\n", lang, f)
}
return nil
}
// download and save all translations. uri is the base URL. projectID is the
// name of the project.
func download(uri *url.URL, projectID string, langs languages) (err error) {
var numWorker int
flagSet := flag.NewFlagSet("download", flag.ExitOnError)
flagSet.Usage = func() {
usage("download command error")
}
flagSet.IntVar(&numWorker, "n", 1, "number of concurrent downloads")
err = flagSet.Parse(os.Args[2:])
if err != nil {
// Don't wrap the error since there is exit on error.
return err
}
if numWorker < 1 {
usage("count must be positive")
}
downloadURI := uri.JoinPath("download")
client := &http.Client{
Timeout: 10 * time.Second,
}
var wg sync.WaitGroup
uriCh := make(chan *url.URL, len(langs))
for i := 0; i < numWorker; i++ {
wg.Add(1)
go downloadWorker(&wg, client, uriCh)
}
for lang := range langs {
uri = translationURL(downloadURI, defaultBaseFile, projectID, lang)
uriCh <- uri
}
close(uriCh)
wg.Wait()
return nil
}
// downloadWorker downloads translations by received urls and saves them.
func downloadWorker(wg *sync.WaitGroup, client *http.Client, uriCh <-chan *url.URL) {
defer wg.Done()
for uri := range uriCh {
data, err := getTranslation(client, uri.String())
if err != nil {
log.Error("download worker: getting translation: %s", err)
continue
}
q := uri.Query()
code := q.Get("language")
name := filepath.Join(localesDir, code+".json")
err = os.WriteFile(name, data, 0o664)
if err != nil {
log.Error("download worker: writing file: %s", err)
continue
}
fmt.Println(name)
}
}
// getTranslation returns received translation data or error.
func getTranslation(client *http.Client, url string) (data []byte, err error) {
resp, err := client.Get(url)
if err != nil {
return nil, fmt.Errorf("requesting: %w", err)
}
defer log.OnCloserError(resp.Body, log.ERROR)
if resp.StatusCode != http.StatusOK {
err = fmt.Errorf("url: %q; status code: %s", url, http.StatusText(resp.StatusCode))
return nil, err
}
limitReader, err := aghio.LimitReader(resp.Body, readLimit)
if err != nil {
err = fmt.Errorf("limit reading: %w", err)
return nil, err
}
data, err = io.ReadAll(limitReader)
if err != nil {
err = fmt.Errorf("reading all: %w", err)
return nil, err
}
return data, nil
}
// translationURL returns a new url.URL with provided query parameters.
func translationURL(oldURL *url.URL, baseFile, projectID string, lang langCode) (uri *url.URL) {
uri = &url.URL{}
*uri = *oldURL
q := uri.Query()
q.Set("format", "json")
q.Set("filename", baseFile)
q.Set("project", projectID)
q.Set("language", string(lang))
uri.RawQuery = q.Encode()
return uri
}
// unused prints unused text labels.
func unused() (err error) {
fileNames := []string{}
basePath := filepath.Join(localesDir, defaultBaseFile)
baseLoc, err := readLocales(basePath)
if err != nil {
return fmt.Errorf("unused: %w", err)
}
locDir := filepath.Clean(localesDir)
err = filepath.Walk(srcDir, func(name string, info os.FileInfo, err error) error {
if err != nil {
log.Info("accessing a path %q: %s", name, err)
return nil
}
if info.IsDir() {
return nil
}
if strings.HasPrefix(name, locDir) {
return nil
}
ext := filepath.Ext(name)
if ext == ".js" || ext == ".json" {
fileNames = append(fileNames, name)
}
return nil
})
if err != nil {
return fmt.Errorf("filepath walking %q: %w", srcDir, err)
}
err = removeUnused(fileNames, baseLoc)
return errors.Annotate(err, "removing unused: %w")
}
func removeUnused(fileNames []string, loc locales) (err error) {
knownUsed := []textLabel{
"blocking_mode_refused",
"blocking_mode_nxdomain",
"blocking_mode_custom_ip",
}
for _, v := range knownUsed {
delete(loc, v)
}
for _, fn := range fileNames {
var buf []byte
buf, err = os.ReadFile(fn)
if err != nil {
// Don't wrap the error since it's informative enough as is.
return err
}
for k := range loc {
if bytes.Contains(buf, []byte(k)) {
delete(loc, k)
}
}
}
printUnused(loc)
return nil
}
// printUnused text labels to stdout.
func printUnused(loc locales) {
keys := maps.Keys(loc)
slices.Sort(keys)
for _, v := range keys {
fmt.Println(v)
}
}
// upload base translation. uri is the base URL. projectID is the name of the
// project. baseLang is the base language code.
func upload(uri *url.URL, projectID string, baseLang langCode) (err error) {
Pull request 1789: AG-20200-translation-script-fix-upload Merge in DNS/adguard-home from AG-20200-translation-script-fix-upload to master Squashed commit of the following: commit 4d898926828dc438c29b0ae7cbad70d8dea0b8de Merge: 41ad204b 487675b9 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 13:30:36 2023 +0300 Merge branch 'master' into AG-20200-translation-script-fix-upload commit 41ad204bc3ce52ecc61e95261b9519cfc0af9abe Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 13:29:26 2023 +0300 scripts: imp more commit 5ea4821ee49638ad9011809faba0316a753a078b Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 12:38:22 2023 +0300 scripts: imp code commit 253a72fd0e195c7603883322885b7206ed434918 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 12:04:16 2023 +0300 scripts: add docs commit bfd70e338c78fd5b0292480d7f54f396593e98ca Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 10:56:05 2023 +0300 scripts: imp more commit 547b82785f210cc137903cb5b7e2ee41b2a20e59 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 10:08:16 2023 +0300 scripts: imp code commit a788e5ef8a3aa2633cc9fb64c83534f1d4080ef7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 20:14:55 2023 +0300 scripts: add multipart commit 39d352edf85288a51931dea5b758bc74dd08e19d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 18:35:08 2023 +0300 scripts: fix more commit bcbf155135c53789cc5c6c2c7c8b57dd471e4ea2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 17:47:40 2023 +0300 scripts: fix upload
2023-03-28 18:02:32 +03:00
defer func() { err = errors.Annotate(err, "upload: %w") }()
Pull request 1763: AG-20200-translation-script Merge in DNS/adguard-home from AG-20200-translation-script to master Squashed commit of the following: commit 3113b77c0312219f8134324caa232a53c42a3988 Merge: bbd784ab f736d85e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 17:41:08 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit bbd784ab817955f3342d140644a3199d558c22b8 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 13:23:48 2023 +0300 scripts: imp code commit 7d379ab1fc2ae9858f8e7e3754de9be3d23153b6 Merge: 4f6278ad 1daabb97 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 12:01:16 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 4f6278adb28287205a4fc89239e7ba776a15ff7a Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Mar 17 14:27:32 2023 +0300 scripts: imp error handling commit 64e307a591cfeac1986d477a55bcc714636663bc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 15:41:39 2023 +0300 scripts: imp code commit fe06df88f2bb3fc0de83f83deea26652485a22d4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 15:23:20 2023 +0300 scripts: add docs commit 15d65a075373586fc31a595d7c831b80752d7cf2 Merge: ddd3cacd 9f7a582d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 13:04:16 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit ddd3cacd507ca861c4d9d5f7600bdcc2c3068315 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 13:03:11 2023 +0300 scripts: imp code commit 4e8ebdc199f0c0ff4e7c7b8ae71483cca6c4d428 Merge: 73fedefa c6706445 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Mar 15 12:25:36 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 73fedefa4ceaf2273648afe5816f1903d96ba213 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Mar 15 12:25:04 2023 +0300 scripts: fix chlog commit 780b0a257b6b2e684cfe8a49e4c4d22bcd4056ec Merge: ef70d192 595484e0 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 14 14:58:24 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit ef70d192555a9ef2acd6dd1caeb4f05a10a1de63 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 14 14:57:36 2023 +0300 scripts: upd readme commit e28655826c8c5ce6ddf3cc904201681286a6be87 Merge: cae3b769 a2053526 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 13 14:28:47 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit cae3b769dfa6906653b32104169ae4a08a2c3723 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 13 14:27:29 2023 +0300 scripts: rm translations js commit 77e2e3480b52a70b8ef9be8f1edf581cca2a1a3a Merge: 99e2382a c11a52d6 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 7 16:04:06 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 99e2382a161dee0bff30ae488d8b42565330d82e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 7 16:03:19 2023 +0300 scripts: add translations go
2023-03-21 17:43:48 +03:00
uploadURI := uri.JoinPath("upload")
lang := baseLang
langStr := os.Getenv("UPLOAD_LANGUAGE")
if langStr != "" {
lang = langCode(langStr)
}
basePath := filepath.Join(localesDir, defaultBaseFile)
Pull request 1789: AG-20200-translation-script-fix-upload Merge in DNS/adguard-home from AG-20200-translation-script-fix-upload to master Squashed commit of the following: commit 4d898926828dc438c29b0ae7cbad70d8dea0b8de Merge: 41ad204b 487675b9 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 13:30:36 2023 +0300 Merge branch 'master' into AG-20200-translation-script-fix-upload commit 41ad204bc3ce52ecc61e95261b9519cfc0af9abe Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 13:29:26 2023 +0300 scripts: imp more commit 5ea4821ee49638ad9011809faba0316a753a078b Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 12:38:22 2023 +0300 scripts: imp code commit 253a72fd0e195c7603883322885b7206ed434918 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 12:04:16 2023 +0300 scripts: add docs commit bfd70e338c78fd5b0292480d7f54f396593e98ca Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 10:56:05 2023 +0300 scripts: imp more commit 547b82785f210cc137903cb5b7e2ee41b2a20e59 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 10:08:16 2023 +0300 scripts: imp code commit a788e5ef8a3aa2633cc9fb64c83534f1d4080ef7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 20:14:55 2023 +0300 scripts: add multipart commit 39d352edf85288a51931dea5b758bc74dd08e19d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 18:35:08 2023 +0300 scripts: fix more commit bcbf155135c53789cc5c6c2c7c8b57dd471e4ea2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 17:47:40 2023 +0300 scripts: fix upload
2023-03-28 18:02:32 +03:00
formData := map[string]string{
"format": "json",
"language": string(lang),
"filename": defaultBaseFile,
"project": projectID,
}
buf, cType, err := prepareMultipartMsg(formData, basePath)
if err != nil {
return fmt.Errorf("preparing multipart msg: %w", err)
}
err = send(uploadURI.String(), cType, buf)
if err != nil {
return fmt.Errorf("sending multipart msg: %w", err)
}
return nil
}
// prepareMultipartMsg prepares translation data for upload.
func prepareMultipartMsg(
formData map[string]string,
basePath string,
) (buf *bytes.Buffer, cType string, err error) {
buf = &bytes.Buffer{}
w := multipart.NewWriter(buf)
var fw io.Writer
for k, v := range formData {
err = w.WriteField(k, v)
if err != nil {
return nil, "", fmt.Errorf("writing field: %w", err)
}
}
file, err := os.Open(basePath)
if err != nil {
return nil, "", fmt.Errorf("opening file: %w", err)
}
defer func() {
err = errors.WithDeferred(err, file.Close())
}()
h := make(textproto.MIMEHeader)
h.Set("Content-Type", "application/json")
d := fmt.Sprintf("form-data; name=%q; filename=%q", "file", defaultBaseFile)
h.Set("Content-Disposition", d)
fw, err = w.CreatePart(h)
if err != nil {
return nil, "", fmt.Errorf("creating part: %w", err)
}
_, err = io.Copy(fw, file)
Pull request 1763: AG-20200-translation-script Merge in DNS/adguard-home from AG-20200-translation-script to master Squashed commit of the following: commit 3113b77c0312219f8134324caa232a53c42a3988 Merge: bbd784ab f736d85e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 17:41:08 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit bbd784ab817955f3342d140644a3199d558c22b8 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 13:23:48 2023 +0300 scripts: imp code commit 7d379ab1fc2ae9858f8e7e3754de9be3d23153b6 Merge: 4f6278ad 1daabb97 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 12:01:16 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 4f6278adb28287205a4fc89239e7ba776a15ff7a Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Mar 17 14:27:32 2023 +0300 scripts: imp error handling commit 64e307a591cfeac1986d477a55bcc714636663bc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 15:41:39 2023 +0300 scripts: imp code commit fe06df88f2bb3fc0de83f83deea26652485a22d4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 15:23:20 2023 +0300 scripts: add docs commit 15d65a075373586fc31a595d7c831b80752d7cf2 Merge: ddd3cacd 9f7a582d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 13:04:16 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit ddd3cacd507ca861c4d9d5f7600bdcc2c3068315 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 13:03:11 2023 +0300 scripts: imp code commit 4e8ebdc199f0c0ff4e7c7b8ae71483cca6c4d428 Merge: 73fedefa c6706445 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Mar 15 12:25:36 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 73fedefa4ceaf2273648afe5816f1903d96ba213 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Mar 15 12:25:04 2023 +0300 scripts: fix chlog commit 780b0a257b6b2e684cfe8a49e4c4d22bcd4056ec Merge: ef70d192 595484e0 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 14 14:58:24 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit ef70d192555a9ef2acd6dd1caeb4f05a10a1de63 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 14 14:57:36 2023 +0300 scripts: upd readme commit e28655826c8c5ce6ddf3cc904201681286a6be87 Merge: cae3b769 a2053526 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 13 14:28:47 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit cae3b769dfa6906653b32104169ae4a08a2c3723 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 13 14:27:29 2023 +0300 scripts: rm translations js commit 77e2e3480b52a70b8ef9be8f1edf581cca2a1a3a Merge: 99e2382a c11a52d6 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 7 16:04:06 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 99e2382a161dee0bff30ae488d8b42565330d82e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 7 16:03:19 2023 +0300 scripts: add translations go
2023-03-21 17:43:48 +03:00
if err != nil {
Pull request 1789: AG-20200-translation-script-fix-upload Merge in DNS/adguard-home from AG-20200-translation-script-fix-upload to master Squashed commit of the following: commit 4d898926828dc438c29b0ae7cbad70d8dea0b8de Merge: 41ad204b 487675b9 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 13:30:36 2023 +0300 Merge branch 'master' into AG-20200-translation-script-fix-upload commit 41ad204bc3ce52ecc61e95261b9519cfc0af9abe Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 13:29:26 2023 +0300 scripts: imp more commit 5ea4821ee49638ad9011809faba0316a753a078b Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 12:38:22 2023 +0300 scripts: imp code commit 253a72fd0e195c7603883322885b7206ed434918 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 12:04:16 2023 +0300 scripts: add docs commit bfd70e338c78fd5b0292480d7f54f396593e98ca Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 10:56:05 2023 +0300 scripts: imp more commit 547b82785f210cc137903cb5b7e2ee41b2a20e59 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 10:08:16 2023 +0300 scripts: imp code commit a788e5ef8a3aa2633cc9fb64c83534f1d4080ef7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 20:14:55 2023 +0300 scripts: add multipart commit 39d352edf85288a51931dea5b758bc74dd08e19d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 18:35:08 2023 +0300 scripts: fix more commit bcbf155135c53789cc5c6c2c7c8b57dd471e4ea2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 17:47:40 2023 +0300 scripts: fix upload
2023-03-28 18:02:32 +03:00
return nil, "", fmt.Errorf("copying: %w", err)
Pull request 1763: AG-20200-translation-script Merge in DNS/adguard-home from AG-20200-translation-script to master Squashed commit of the following: commit 3113b77c0312219f8134324caa232a53c42a3988 Merge: bbd784ab f736d85e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 17:41:08 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit bbd784ab817955f3342d140644a3199d558c22b8 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 13:23:48 2023 +0300 scripts: imp code commit 7d379ab1fc2ae9858f8e7e3754de9be3d23153b6 Merge: 4f6278ad 1daabb97 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 12:01:16 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 4f6278adb28287205a4fc89239e7ba776a15ff7a Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Mar 17 14:27:32 2023 +0300 scripts: imp error handling commit 64e307a591cfeac1986d477a55bcc714636663bc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 15:41:39 2023 +0300 scripts: imp code commit fe06df88f2bb3fc0de83f83deea26652485a22d4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 15:23:20 2023 +0300 scripts: add docs commit 15d65a075373586fc31a595d7c831b80752d7cf2 Merge: ddd3cacd 9f7a582d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 13:04:16 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit ddd3cacd507ca861c4d9d5f7600bdcc2c3068315 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 13:03:11 2023 +0300 scripts: imp code commit 4e8ebdc199f0c0ff4e7c7b8ae71483cca6c4d428 Merge: 73fedefa c6706445 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Mar 15 12:25:36 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 73fedefa4ceaf2273648afe5816f1903d96ba213 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Mar 15 12:25:04 2023 +0300 scripts: fix chlog commit 780b0a257b6b2e684cfe8a49e4c4d22bcd4056ec Merge: ef70d192 595484e0 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 14 14:58:24 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit ef70d192555a9ef2acd6dd1caeb4f05a10a1de63 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 14 14:57:36 2023 +0300 scripts: upd readme commit e28655826c8c5ce6ddf3cc904201681286a6be87 Merge: cae3b769 a2053526 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 13 14:28:47 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit cae3b769dfa6906653b32104169ae4a08a2c3723 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 13 14:27:29 2023 +0300 scripts: rm translations js commit 77e2e3480b52a70b8ef9be8f1edf581cca2a1a3a Merge: 99e2382a c11a52d6 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 7 16:04:06 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 99e2382a161dee0bff30ae488d8b42565330d82e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 7 16:03:19 2023 +0300 scripts: add translations go
2023-03-21 17:43:48 +03:00
}
Pull request 1789: AG-20200-translation-script-fix-upload Merge in DNS/adguard-home from AG-20200-translation-script-fix-upload to master Squashed commit of the following: commit 4d898926828dc438c29b0ae7cbad70d8dea0b8de Merge: 41ad204b 487675b9 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 13:30:36 2023 +0300 Merge branch 'master' into AG-20200-translation-script-fix-upload commit 41ad204bc3ce52ecc61e95261b9519cfc0af9abe Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 13:29:26 2023 +0300 scripts: imp more commit 5ea4821ee49638ad9011809faba0316a753a078b Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 12:38:22 2023 +0300 scripts: imp code commit 253a72fd0e195c7603883322885b7206ed434918 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 12:04:16 2023 +0300 scripts: add docs commit bfd70e338c78fd5b0292480d7f54f396593e98ca Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 10:56:05 2023 +0300 scripts: imp more commit 547b82785f210cc137903cb5b7e2ee41b2a20e59 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 10:08:16 2023 +0300 scripts: imp code commit a788e5ef8a3aa2633cc9fb64c83534f1d4080ef7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 20:14:55 2023 +0300 scripts: add multipart commit 39d352edf85288a51931dea5b758bc74dd08e19d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 18:35:08 2023 +0300 scripts: fix more commit bcbf155135c53789cc5c6c2c7c8b57dd471e4ea2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 17:47:40 2023 +0300 scripts: fix upload
2023-03-28 18:02:32 +03:00
err = w.Close()
if err != nil {
return nil, "", fmt.Errorf("closing writer: %w", err)
}
Pull request 1763: AG-20200-translation-script Merge in DNS/adguard-home from AG-20200-translation-script to master Squashed commit of the following: commit 3113b77c0312219f8134324caa232a53c42a3988 Merge: bbd784ab f736d85e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 17:41:08 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit bbd784ab817955f3342d140644a3199d558c22b8 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 13:23:48 2023 +0300 scripts: imp code commit 7d379ab1fc2ae9858f8e7e3754de9be3d23153b6 Merge: 4f6278ad 1daabb97 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 12:01:16 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 4f6278adb28287205a4fc89239e7ba776a15ff7a Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Mar 17 14:27:32 2023 +0300 scripts: imp error handling commit 64e307a591cfeac1986d477a55bcc714636663bc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 15:41:39 2023 +0300 scripts: imp code commit fe06df88f2bb3fc0de83f83deea26652485a22d4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 15:23:20 2023 +0300 scripts: add docs commit 15d65a075373586fc31a595d7c831b80752d7cf2 Merge: ddd3cacd 9f7a582d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 13:04:16 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit ddd3cacd507ca861c4d9d5f7600bdcc2c3068315 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 13:03:11 2023 +0300 scripts: imp code commit 4e8ebdc199f0c0ff4e7c7b8ae71483cca6c4d428 Merge: 73fedefa c6706445 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Mar 15 12:25:36 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 73fedefa4ceaf2273648afe5816f1903d96ba213 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Mar 15 12:25:04 2023 +0300 scripts: fix chlog commit 780b0a257b6b2e684cfe8a49e4c4d22bcd4056ec Merge: ef70d192 595484e0 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 14 14:58:24 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit ef70d192555a9ef2acd6dd1caeb4f05a10a1de63 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 14 14:57:36 2023 +0300 scripts: upd readme commit e28655826c8c5ce6ddf3cc904201681286a6be87 Merge: cae3b769 a2053526 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 13 14:28:47 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit cae3b769dfa6906653b32104169ae4a08a2c3723 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 13 14:27:29 2023 +0300 scripts: rm translations js commit 77e2e3480b52a70b8ef9be8f1edf581cca2a1a3a Merge: 99e2382a c11a52d6 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 7 16:04:06 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 99e2382a161dee0bff30ae488d8b42565330d82e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 7 16:03:19 2023 +0300 scripts: add translations go
2023-03-21 17:43:48 +03:00
Pull request 1789: AG-20200-translation-script-fix-upload Merge in DNS/adguard-home from AG-20200-translation-script-fix-upload to master Squashed commit of the following: commit 4d898926828dc438c29b0ae7cbad70d8dea0b8de Merge: 41ad204b 487675b9 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 13:30:36 2023 +0300 Merge branch 'master' into AG-20200-translation-script-fix-upload commit 41ad204bc3ce52ecc61e95261b9519cfc0af9abe Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 13:29:26 2023 +0300 scripts: imp more commit 5ea4821ee49638ad9011809faba0316a753a078b Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 12:38:22 2023 +0300 scripts: imp code commit 253a72fd0e195c7603883322885b7206ed434918 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 12:04:16 2023 +0300 scripts: add docs commit bfd70e338c78fd5b0292480d7f54f396593e98ca Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 10:56:05 2023 +0300 scripts: imp more commit 547b82785f210cc137903cb5b7e2ee41b2a20e59 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 10:08:16 2023 +0300 scripts: imp code commit a788e5ef8a3aa2633cc9fb64c83534f1d4080ef7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 20:14:55 2023 +0300 scripts: add multipart commit 39d352edf85288a51931dea5b758bc74dd08e19d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 18:35:08 2023 +0300 scripts: fix more commit bcbf155135c53789cc5c6c2c7c8b57dd471e4ea2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 17:47:40 2023 +0300 scripts: fix upload
2023-03-28 18:02:32 +03:00
return buf, w.FormDataContentType(), nil
}
Pull request 1763: AG-20200-translation-script Merge in DNS/adguard-home from AG-20200-translation-script to master Squashed commit of the following: commit 3113b77c0312219f8134324caa232a53c42a3988 Merge: bbd784ab f736d85e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 17:41:08 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit bbd784ab817955f3342d140644a3199d558c22b8 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 13:23:48 2023 +0300 scripts: imp code commit 7d379ab1fc2ae9858f8e7e3754de9be3d23153b6 Merge: 4f6278ad 1daabb97 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 12:01:16 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 4f6278adb28287205a4fc89239e7ba776a15ff7a Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Mar 17 14:27:32 2023 +0300 scripts: imp error handling commit 64e307a591cfeac1986d477a55bcc714636663bc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 15:41:39 2023 +0300 scripts: imp code commit fe06df88f2bb3fc0de83f83deea26652485a22d4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 15:23:20 2023 +0300 scripts: add docs commit 15d65a075373586fc31a595d7c831b80752d7cf2 Merge: ddd3cacd 9f7a582d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 13:04:16 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit ddd3cacd507ca861c4d9d5f7600bdcc2c3068315 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 13:03:11 2023 +0300 scripts: imp code commit 4e8ebdc199f0c0ff4e7c7b8ae71483cca6c4d428 Merge: 73fedefa c6706445 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Mar 15 12:25:36 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 73fedefa4ceaf2273648afe5816f1903d96ba213 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Mar 15 12:25:04 2023 +0300 scripts: fix chlog commit 780b0a257b6b2e684cfe8a49e4c4d22bcd4056ec Merge: ef70d192 595484e0 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 14 14:58:24 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit ef70d192555a9ef2acd6dd1caeb4f05a10a1de63 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 14 14:57:36 2023 +0300 scripts: upd readme commit e28655826c8c5ce6ddf3cc904201681286a6be87 Merge: cae3b769 a2053526 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 13 14:28:47 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit cae3b769dfa6906653b32104169ae4a08a2c3723 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 13 14:27:29 2023 +0300 scripts: rm translations js commit 77e2e3480b52a70b8ef9be8f1edf581cca2a1a3a Merge: 99e2382a c11a52d6 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 7 16:04:06 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 99e2382a161dee0bff30ae488d8b42565330d82e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 7 16:03:19 2023 +0300 scripts: add translations go
2023-03-21 17:43:48 +03:00
Pull request 1789: AG-20200-translation-script-fix-upload Merge in DNS/adguard-home from AG-20200-translation-script-fix-upload to master Squashed commit of the following: commit 4d898926828dc438c29b0ae7cbad70d8dea0b8de Merge: 41ad204b 487675b9 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 13:30:36 2023 +0300 Merge branch 'master' into AG-20200-translation-script-fix-upload commit 41ad204bc3ce52ecc61e95261b9519cfc0af9abe Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 13:29:26 2023 +0300 scripts: imp more commit 5ea4821ee49638ad9011809faba0316a753a078b Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 12:38:22 2023 +0300 scripts: imp code commit 253a72fd0e195c7603883322885b7206ed434918 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 12:04:16 2023 +0300 scripts: add docs commit bfd70e338c78fd5b0292480d7f54f396593e98ca Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 10:56:05 2023 +0300 scripts: imp more commit 547b82785f210cc137903cb5b7e2ee41b2a20e59 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 10:08:16 2023 +0300 scripts: imp code commit a788e5ef8a3aa2633cc9fb64c83534f1d4080ef7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 20:14:55 2023 +0300 scripts: add multipart commit 39d352edf85288a51931dea5b758bc74dd08e19d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 18:35:08 2023 +0300 scripts: fix more commit bcbf155135c53789cc5c6c2c7c8b57dd471e4ea2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 17:47:40 2023 +0300 scripts: fix upload
2023-03-28 18:02:32 +03:00
// send POST request to uriStr.
func send(uriStr, cType string, buf *bytes.Buffer) (err error) {
Pull request 1763: AG-20200-translation-script Merge in DNS/adguard-home from AG-20200-translation-script to master Squashed commit of the following: commit 3113b77c0312219f8134324caa232a53c42a3988 Merge: bbd784ab f736d85e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 17:41:08 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit bbd784ab817955f3342d140644a3199d558c22b8 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 13:23:48 2023 +0300 scripts: imp code commit 7d379ab1fc2ae9858f8e7e3754de9be3d23153b6 Merge: 4f6278ad 1daabb97 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 12:01:16 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 4f6278adb28287205a4fc89239e7ba776a15ff7a Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Mar 17 14:27:32 2023 +0300 scripts: imp error handling commit 64e307a591cfeac1986d477a55bcc714636663bc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 15:41:39 2023 +0300 scripts: imp code commit fe06df88f2bb3fc0de83f83deea26652485a22d4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 15:23:20 2023 +0300 scripts: add docs commit 15d65a075373586fc31a595d7c831b80752d7cf2 Merge: ddd3cacd 9f7a582d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 13:04:16 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit ddd3cacd507ca861c4d9d5f7600bdcc2c3068315 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 13:03:11 2023 +0300 scripts: imp code commit 4e8ebdc199f0c0ff4e7c7b8ae71483cca6c4d428 Merge: 73fedefa c6706445 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Mar 15 12:25:36 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 73fedefa4ceaf2273648afe5816f1903d96ba213 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Mar 15 12:25:04 2023 +0300 scripts: fix chlog commit 780b0a257b6b2e684cfe8a49e4c4d22bcd4056ec Merge: ef70d192 595484e0 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 14 14:58:24 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit ef70d192555a9ef2acd6dd1caeb4f05a10a1de63 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 14 14:57:36 2023 +0300 scripts: upd readme commit e28655826c8c5ce6ddf3cc904201681286a6be87 Merge: cae3b769 a2053526 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 13 14:28:47 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit cae3b769dfa6906653b32104169ae4a08a2c3723 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 13 14:27:29 2023 +0300 scripts: rm translations js commit 77e2e3480b52a70b8ef9be8f1edf581cca2a1a3a Merge: 99e2382a c11a52d6 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 7 16:04:06 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 99e2382a161dee0bff30ae488d8b42565330d82e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 7 16:03:19 2023 +0300 scripts: add translations go
2023-03-21 17:43:48 +03:00
var client http.Client
Pull request 1789: AG-20200-translation-script-fix-upload Merge in DNS/adguard-home from AG-20200-translation-script-fix-upload to master Squashed commit of the following: commit 4d898926828dc438c29b0ae7cbad70d8dea0b8de Merge: 41ad204b 487675b9 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 13:30:36 2023 +0300 Merge branch 'master' into AG-20200-translation-script-fix-upload commit 41ad204bc3ce52ecc61e95261b9519cfc0af9abe Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 13:29:26 2023 +0300 scripts: imp more commit 5ea4821ee49638ad9011809faba0316a753a078b Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 12:38:22 2023 +0300 scripts: imp code commit 253a72fd0e195c7603883322885b7206ed434918 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 12:04:16 2023 +0300 scripts: add docs commit bfd70e338c78fd5b0292480d7f54f396593e98ca Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 10:56:05 2023 +0300 scripts: imp more commit 547b82785f210cc137903cb5b7e2ee41b2a20e59 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 10:08:16 2023 +0300 scripts: imp code commit a788e5ef8a3aa2633cc9fb64c83534f1d4080ef7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 20:14:55 2023 +0300 scripts: add multipart commit 39d352edf85288a51931dea5b758bc74dd08e19d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 18:35:08 2023 +0300 scripts: fix more commit bcbf155135c53789cc5c6c2c7c8b57dd471e4ea2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 17:47:40 2023 +0300 scripts: fix upload
2023-03-28 18:02:32 +03:00
req, err := http.NewRequest(http.MethodPost, uriStr, buf)
if err != nil {
return fmt.Errorf("bad request: %w", err)
}
req.Header.Set("Content-Type", cType)
resp, err := client.Do(req)
Pull request 1763: AG-20200-translation-script Merge in DNS/adguard-home from AG-20200-translation-script to master Squashed commit of the following: commit 3113b77c0312219f8134324caa232a53c42a3988 Merge: bbd784ab f736d85e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 17:41:08 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit bbd784ab817955f3342d140644a3199d558c22b8 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 13:23:48 2023 +0300 scripts: imp code commit 7d379ab1fc2ae9858f8e7e3754de9be3d23153b6 Merge: 4f6278ad 1daabb97 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 12:01:16 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 4f6278adb28287205a4fc89239e7ba776a15ff7a Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Mar 17 14:27:32 2023 +0300 scripts: imp error handling commit 64e307a591cfeac1986d477a55bcc714636663bc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 15:41:39 2023 +0300 scripts: imp code commit fe06df88f2bb3fc0de83f83deea26652485a22d4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 15:23:20 2023 +0300 scripts: add docs commit 15d65a075373586fc31a595d7c831b80752d7cf2 Merge: ddd3cacd 9f7a582d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 13:04:16 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit ddd3cacd507ca861c4d9d5f7600bdcc2c3068315 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 13:03:11 2023 +0300 scripts: imp code commit 4e8ebdc199f0c0ff4e7c7b8ae71483cca6c4d428 Merge: 73fedefa c6706445 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Mar 15 12:25:36 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 73fedefa4ceaf2273648afe5816f1903d96ba213 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Mar 15 12:25:04 2023 +0300 scripts: fix chlog commit 780b0a257b6b2e684cfe8a49e4c4d22bcd4056ec Merge: ef70d192 595484e0 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 14 14:58:24 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit ef70d192555a9ef2acd6dd1caeb4f05a10a1de63 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 14 14:57:36 2023 +0300 scripts: upd readme commit e28655826c8c5ce6ddf3cc904201681286a6be87 Merge: cae3b769 a2053526 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 13 14:28:47 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit cae3b769dfa6906653b32104169ae4a08a2c3723 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 13 14:27:29 2023 +0300 scripts: rm translations js commit 77e2e3480b52a70b8ef9be8f1edf581cca2a1a3a Merge: 99e2382a c11a52d6 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 7 16:04:06 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 99e2382a161dee0bff30ae488d8b42565330d82e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 7 16:03:19 2023 +0300 scripts: add translations go
2023-03-21 17:43:48 +03:00
if err != nil {
Pull request 1789: AG-20200-translation-script-fix-upload Merge in DNS/adguard-home from AG-20200-translation-script-fix-upload to master Squashed commit of the following: commit 4d898926828dc438c29b0ae7cbad70d8dea0b8de Merge: 41ad204b 487675b9 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 13:30:36 2023 +0300 Merge branch 'master' into AG-20200-translation-script-fix-upload commit 41ad204bc3ce52ecc61e95261b9519cfc0af9abe Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 13:29:26 2023 +0300 scripts: imp more commit 5ea4821ee49638ad9011809faba0316a753a078b Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 12:38:22 2023 +0300 scripts: imp code commit 253a72fd0e195c7603883322885b7206ed434918 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 12:04:16 2023 +0300 scripts: add docs commit bfd70e338c78fd5b0292480d7f54f396593e98ca Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 10:56:05 2023 +0300 scripts: imp more commit 547b82785f210cc137903cb5b7e2ee41b2a20e59 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 28 10:08:16 2023 +0300 scripts: imp code commit a788e5ef8a3aa2633cc9fb64c83534f1d4080ef7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 20:14:55 2023 +0300 scripts: add multipart commit 39d352edf85288a51931dea5b758bc74dd08e19d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 18:35:08 2023 +0300 scripts: fix more commit bcbf155135c53789cc5c6c2c7c8b57dd471e4ea2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 27 17:47:40 2023 +0300 scripts: fix upload
2023-03-28 18:02:32 +03:00
return fmt.Errorf("client post form: %w", err)
Pull request 1763: AG-20200-translation-script Merge in DNS/adguard-home from AG-20200-translation-script to master Squashed commit of the following: commit 3113b77c0312219f8134324caa232a53c42a3988 Merge: bbd784ab f736d85e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 17:41:08 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit bbd784ab817955f3342d140644a3199d558c22b8 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 13:23:48 2023 +0300 scripts: imp code commit 7d379ab1fc2ae9858f8e7e3754de9be3d23153b6 Merge: 4f6278ad 1daabb97 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 21 12:01:16 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 4f6278adb28287205a4fc89239e7ba776a15ff7a Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Mar 17 14:27:32 2023 +0300 scripts: imp error handling commit 64e307a591cfeac1986d477a55bcc714636663bc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 15:41:39 2023 +0300 scripts: imp code commit fe06df88f2bb3fc0de83f83deea26652485a22d4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 15:23:20 2023 +0300 scripts: add docs commit 15d65a075373586fc31a595d7c831b80752d7cf2 Merge: ddd3cacd 9f7a582d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 13:04:16 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit ddd3cacd507ca861c4d9d5f7600bdcc2c3068315 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Mar 16 13:03:11 2023 +0300 scripts: imp code commit 4e8ebdc199f0c0ff4e7c7b8ae71483cca6c4d428 Merge: 73fedefa c6706445 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Mar 15 12:25:36 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 73fedefa4ceaf2273648afe5816f1903d96ba213 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Mar 15 12:25:04 2023 +0300 scripts: fix chlog commit 780b0a257b6b2e684cfe8a49e4c4d22bcd4056ec Merge: ef70d192 595484e0 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 14 14:58:24 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit ef70d192555a9ef2acd6dd1caeb4f05a10a1de63 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 14 14:57:36 2023 +0300 scripts: upd readme commit e28655826c8c5ce6ddf3cc904201681286a6be87 Merge: cae3b769 a2053526 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 13 14:28:47 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit cae3b769dfa6906653b32104169ae4a08a2c3723 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 13 14:27:29 2023 +0300 scripts: rm translations js commit 77e2e3480b52a70b8ef9be8f1edf581cca2a1a3a Merge: 99e2382a c11a52d6 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 7 16:04:06 2023 +0300 Merge branch 'master' into AG-20200-translation-script commit 99e2382a161dee0bff30ae488d8b42565330d82e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Mar 7 16:03:19 2023 +0300 scripts: add translations go
2023-03-21 17:43:48 +03:00
}
defer func() {
err = errors.WithDeferred(err, resp.Body.Close())
}()
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("status code is not ok: %q", http.StatusText(resp.StatusCode))
}
return nil
}