Skip to content

Commit

Permalink
customize instance rss minutes
Browse files Browse the repository at this point in the history
  • Loading branch information
KTachibanaM committed Nov 9, 2024
1 parent 3ada8e5 commit b613e40
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
},
"customizations": {
"vscode": {
"extensions": [
"TakumiI.markdowntable"
]
}
}

// Use 'forwardPorts' to make a list of ports inside the container available locally.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ This is a forked version of Nitter ([original version](https://github.com/sekai-
| DEBUG | No | Use `1` to log debug messages. |
| RESET_NITTER_ACCOUNTS_FILE | No | Use `1` to remove the existing `/nitter-data/guest_accounts.json` file |
| INSTANCE_ENABLE_DEBUG | No | Use `1` to enable debug logging |
| INSTANCE_RSS_MINUTES | No | How long to cache RSS. Defaults to 10. |

* After the container is up, Nitter is available at port 8081 within the container if Nginx is enabled, and at port 8080 within the container if Nginx is disabled.

Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ services:
- INSTANCE_INFINITE_SCROLL=1
- INSTANCE_BASE64_MEDIA=1
- INSTANCE_HOSTNAME=localhost:8081
- INSTANCE_RSS_MINUTES=60
# - INSTANCE_HTTPS=1
# optional for setups without redis and/or ng1inx
# - DISABLE_REDIS=1
Expand Down
1 change: 1 addition & 0 deletions scripts/dump_env_and_procfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ echo INSTANCE_TITLE=$INSTANCE_TITLE >> /src/.env
echo INSTANCE_THEME=$INSTANCE_THEME >> /src/.env
echo INSTANCE_INFINITE_SCROLL=$INSTANCE_INFINITE_SCROLL >> /src/.env
echo INSTANCE_ENABLE_DEBUG=$INSTANCE_ENABLE_DEBUG >> /src/.env
echo INSTANCE_RSS_MINUTES=$INSTANCE_RSS_MINUTES >> /src/.env

echo Dumping instance guardian env...
echo INSTANCE_RSS_PASSWORD=$INSTANCE_RSS_PASSWORD >> /src/.env
Expand Down
8 changes: 6 additions & 2 deletions scripts/gen_nitter_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
THEME_PLZ_CHANGE = "[THEME_PLZ_CHANGE]"
INFINITE_SCROLL_PLZ_CHANGE = "[INFINITE_SCROLL_PLZ_CHANGE]"
ENABLE_DEBUG_PLZ_CHANGE = "[ENABLE_DEBUG_PLZ_CHANGE]"
RSS_MIUNTES_PLZ_CHANGE = "[RSS_MIUNTES_PLZ_CHANGE]"

TEMPLATE = """[Server]
hostname = "[HOSTNAME_PLZ_CHANGE]" # for generating links, change this to your own domain/ip
Expand All @@ -25,7 +26,7 @@
[Cache]
listMinutes = 240 # how long to cache list info (not the tweets, so keep it high)
rssMinutes = 10 # how long to cache rss queries
rssMinutes = [RSS_MIUNTES_PLZ_CHANGE] # how long to cache rss queries
redisHost = "[REDIS_HOST_PLZ_CHANGE]" # Change to "nitter-redis" if using docker-compose
redisPort = [REDIS_PORT_PLZ_CHANGE]
redisPassword = "[REDIS_PASSWORD_PLZ_CHANGE]"
Expand Down Expand Up @@ -91,6 +92,7 @@ def main() -> str:
theme = getenv_treat_empty_string_as_none("INSTANCE_THEME", "Nitter")
infinite_scroll = "true" if os.getenv("INSTANCE_INFINITE_SCROLL") == "1" else "false"
enable_debug = "true" if os.getenv("INSTANCE_ENABLE_DEBUG") == "1" else "false"
rss_minutes = getenv_treat_empty_string_as_none("INSTANCE_RSS_MINUTES", "10")

return TEMPLATE \
.replace(HOSTNAME_PLZ_CHANGE, hostname) \
Expand All @@ -103,7 +105,9 @@ def main() -> str:
.replace(TITLE_PLZ_CHANGE, title) \
.replace(THEME_PLZ_CHANGE, theme) \
.replace(INFINITE_SCROLL_PLZ_CHANGE, infinite_scroll) \
.replace(ENABLE_DEBUG_PLZ_CHANGE, enable_debug)
.replace(ENABLE_DEBUG_PLZ_CHANGE, enable_debug) \
.replace(RSS_MIUNTES_PLZ_CHANGE, rss_minutes)


if __name__ == "__main__":
if len(sys.argv) != 2:
Expand Down

0 comments on commit b613e40

Please sign in to comment.