1
0
Fork 0
mirror of https://github.com/zedeus/nitter.git synced 2025-04-21 16:34:12 +00:00

chore: rename api router to json router

This commit is contained in:
guanbinrui 2025-03-31 15:25:20 +08:00
parent bda2fac885
commit 697a1baf73
5 changed files with 7 additions and 7 deletions

View file

@ -23,7 +23,7 @@ redisMaxConnections = 30
hmacKey = "secretkey" # random key for cryptographic signing of video urls
base64Media = false # use base64 encoding for proxied media urls
enableRSS = true # set this to false to disable RSS feeds
enableApi = true # set this to false to disable the JSON API
enableJson = true # set this to false to disable the JSON API
enableDebug = false # enable request logs and debug endpoints (/.sessions)
proxy = "" # http/https url, SOCKS proxies are not supported
proxyAuth = ""

View file

@ -38,7 +38,7 @@ proc getConfig*(path: string): (Config, parseCfg.Config) =
base64Media: cfg.get("Config", "base64Media", false),
minTokens: cfg.get("Config", "tokenCount", 10),
enableRss: cfg.get("Config", "enableRSS", true),
enableApi: cfg.get("Config", "enableApi", true),
enableJson: cfg.get("Config", "enableJson", true),
enableDebug: cfg.get("Config", "enableDebug", false),
proxy: cfg.get("Config", "proxy", ""),
proxyAuth: cfg.get("Config", "proxyAuth", "")

View file

@ -9,7 +9,7 @@ import jester
import types, config, prefs, formatters, redis_cache, http_pool, auth
import views/[general, about]
import routes/[
preferences, timeline, status, media, search, api, rss, list, debug,
preferences, timeline, status, media, search, json, rss, list, debug,
unsupported, embed, resolver, router_utils]
const instancesUrl = "https://github.com/zedeus/nitter/wiki/Instances"
@ -102,7 +102,7 @@ routes:
resp Http429, showError(
&"Instance has no auth tokens, or is fully rate limited.<br>Use {link} or try again later.", cfg)
extend api, ""
extend json, ""
extend rss, ""
extend status, ""
extend search, ""

View file

@ -1,8 +1,8 @@
import router_utils, timeline
proc createApiRouter*(cfg: Config) =
proc createJsonRouter*(cfg: Config) =
router api:
get "/hello":
cond cfg.enableApi
cond cfg.enableJson
let headers = ["Content-Type": "application/json; charset=utf-8"]
resp Http200, headers, """{"message": "Hello, world"}"""

View file

@ -268,7 +268,7 @@ type
base64Media*: bool
minTokens*: int
enableRss*: bool
enableApi*: bool
enableJson*: bool
enableDebug*: bool
proxy*: string
proxyAuth*: string