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:
parent
bda2fac885
commit
697a1baf73
5 changed files with 7 additions and 7 deletions
|
@ -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 = ""
|
||||
|
|
|
@ -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", "")
|
||||
|
|
|
@ -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, ""
|
||||
|
|
|
@ -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"}"""
|
|
@ -268,7 +268,7 @@ type
|
|||
base64Media*: bool
|
||||
minTokens*: int
|
||||
enableRss*: bool
|
||||
enableApi*: bool
|
||||
enableJson*: bool
|
||||
enableDebug*: bool
|
||||
proxy*: string
|
||||
proxyAuth*: string
|
||||
|
|
Loading…
Reference in a new issue