1
0
Fork 0
mirror of https://github.com/zedeus/nitter.git synced 2025-04-21 08:24:05 +00:00

refactor: rename json to jsonapi

This commit is contained in:
guanbinrui 2025-03-31 15:30:25 +08:00
parent 697a1baf73
commit eb2ae6571a
5 changed files with 8 additions and 8 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
enableJson = true # set this to false to disable the JSON API
enableJsonApi = 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),
enableJson: cfg.get("Config", "enableJson", true),
enableJsonApi: cfg.get("Config", "enableJsonApi", 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, json, rss, list, debug,
preferences, timeline, status, media, search, jsonapi, 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 json, ""
extend jsonapi, ""
extend rss, ""
extend status, ""
extend search, ""

View file

@ -1,8 +1,8 @@
import router_utils, timeline
proc createJsonRouter*(cfg: Config) =
router api:
proc createJsonApiRouter*(cfg: Config) =
router jsonapi:
get "/hello":
cond cfg.enableJson
cond cfg.enableJsonApi
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
enableJson*: bool
enableJsonApi*: bool
enableDebug*: bool
proxy*: string
proxyAuth*: string