mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
feat: add telegram proxy support (#1764)
* Add support for reverse proxy of telegram API * Add Telegram API proxy hint --------- Co-authored-by: Athurg Feng <athurg@gooth.org>
This commit is contained in:
@ -182,6 +182,14 @@ func (upsert SystemSettingUpsert) Validate() error {
|
||||
if upsert.Value == "" {
|
||||
return nil
|
||||
}
|
||||
// Robot Token with Reverse Proxy shoule like `http.../bot<token>`
|
||||
if strings.HasPrefix(upsert.Value, "http") {
|
||||
slashIndex := strings.LastIndexAny(upsert.Value, "/")
|
||||
if strings.HasPrefix(upsert.Value[slashIndex:], "/bot") {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("token start with `http` must end with `/bot<token>`")
|
||||
}
|
||||
fragments := strings.Split(upsert.Value, ":")
|
||||
if len(fragments) != 2 {
|
||||
return fmt.Errorf(systemSettingUnmarshalError, settingName)
|
||||
|
Reference in New Issue
Block a user