Add site contacts/FAQ and accept AWG 2.0 / naive pastes in Add config.
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>
This commit is contained in:
@@ -632,6 +632,9 @@ type ImportResult struct {
|
||||
|
||||
func (m *Manager) ImportSubscription(rawURL string) (ImportResult, error) {
|
||||
rawURL = strings.TrimSpace(rawURL)
|
||||
if rawURL == "" {
|
||||
return ImportResult{}, fmt.Errorf("пустой URL или конфигурация")
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 45*time.Second)
|
||||
defer cancel()
|
||||
|
||||
@@ -650,11 +653,25 @@ func (m *Manager) ImportSubscription(rawURL string) (ImportResult, error) {
|
||||
return m.applySubscription(ctx, res, used, &s)
|
||||
}
|
||||
|
||||
res, err := subscription.Fetch(ctx, rawURL)
|
||||
if err != nil {
|
||||
return ImportResult{}, err
|
||||
// Remote subscription / hosted config file (http(s) without user:pass@).
|
||||
if linknorm.LooksLikeSubscriptionURL(rawURL) {
|
||||
res, err := subscription.Fetch(ctx, rawURL)
|
||||
if err != nil {
|
||||
return ImportResult{}, err
|
||||
}
|
||||
return m.applySubscription(ctx, res, rawURL, nil)
|
||||
}
|
||||
return m.applySubscription(ctx, res, rawURL, nil)
|
||||
|
||||
// Direct paste into «Добавить конфигурацию»: awg://, AWG 2.0 .conf / JSON,
|
||||
// naive share links, Clash YAML body, multi-line link lists — no HTTP fetch.
|
||||
res, err := subscription.ParseBodyDetailed(rawURL)
|
||||
if err != nil || res == nil || len(res.Items) == 0 {
|
||||
if err != nil {
|
||||
return ImportResult{}, fmt.Errorf("%w — либо вставьте http(s) URL конфигурации, либо ссылку/тело AWG, naive, hy2, vless…", err)
|
||||
}
|
||||
return ImportResult{}, fmt.Errorf("не удалось распознать конфигурацию — нужен http(s) URL либо ссылка/тело (AWG, naive, hy2, vless…)")
|
||||
}
|
||||
return m.applySubscription(ctx, res, "", nil)
|
||||
}
|
||||
|
||||
// ImportRemnawave fetches configs using saved / provided panel settings.
|
||||
|
||||
Reference in New Issue
Block a user