Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for favorites tab #47

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert " Changes to be committed:"
This reverts commit 8b5fc71.
  • Loading branch information
rotorot0 committed Mar 11, 2024
commit 88df7d169cbf09521612228275c1f79349d4b586
1 change: 0 additions & 1 deletion nitter.example.conf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ tokenCount = 10

#cookieHeader = "ct0=XXXXXXXXXXXXXXXXX; auth_token=XXXXXXXXXXXXXX" # authentication cookie of a logged in account, required for the likes tab and NSFW content
#xCsrfToken = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" # required for the likes tab and NSFW content
#bearerToken = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" # required for likes

# Change default preferences here, see src/prefs_impl.nim for a complete list
[Preferences]
Expand Down
8 changes: 2 additions & 6 deletions src/apiutils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,8 @@ proc getOauthHeader(url, oauthToken, oauthTokenSecret: string): string =

return getOauth1RequestHeader(params)["authorization"]

proc genHeaders* (url, oauthToken, oauthTokenSecret: string): HttpHeaders =
var header: string
if "favorites" in url:
header = cfg.bearerToken
else:
header = getOauthHeader(url, oauthToken, oauthTokenSecret)
proc genHeaders*(url, oauthToken, oauthTokenSecret: string): HttpHeaders =
let header = getOauthHeader(url, oauthToken, oauthTokenSecret)

result = newHttpHeaders({
"connection": "keep-alive",
Expand Down
3 changes: 1 addition & 2 deletions src/config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ proc getConfig*(path: string): (Config, parseCfg.Config) =
proxy: cfg.get("Config", "proxy", ""),
proxyAuth: cfg.get("Config", "proxyAuth", ""),
cookieHeader: cfg.get("Config", "cookieHeader", ""),
xCsrfToken: cfg.get("Config", "xCsrfToken", ""),
bearerToken: cfg.get("Config", "bearerToken","")
xCsrfToken: cfg.get("Config", "xCsrfToken", "")
)

return (conf, cfg)
Expand Down
1 change: 0 additions & 1 deletion src/types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ type

cookieHeader*: string
xCsrfToken*: string
bearerToken*: string

Rss* = object
feed*, cursor*: string
Expand Down
2 changes: 1 addition & 1 deletion src/views/search.nim
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ proc renderProfileTabs*(query: Query; username: string; cfg: Config): VNode =
a(href=(link & "/with_replies")): text "Tweets & Replies"
li(class=query.getTabClass(media)):
a(href=(link & "/media")): text "Media"
if len(cfg.xCsrfToken) != 0 and len(cfg.cookieHeader) != 0 and len(cfg.bearerToken) != 0:
if len(cfg.xCsrfToken) != 0 and len(cfg.cookieHeader) != 0:
li(class=query.getTabClass(favorites)):
a(href=(link & "/favorites")): text "Likes"
li(class=query.getTabClass(tweets)):
Expand Down