mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-10 09:07:48 +01:00
Add '--version' to command line
This commit is contained in:
parent
c5001f3620
commit
ca07d75405
2 changed files with 49 additions and 45 deletions
|
@ -172,15 +172,12 @@ Usage: invidious [arguments]
|
||||||
--ssl-key-file FILE SSL key file
|
--ssl-key-file FILE SSL key file
|
||||||
--ssl-cert-file FILE SSL certificate file
|
--ssl-cert-file FILE SSL certificate file
|
||||||
-h, --help Shows this help
|
-h, --help Shows this help
|
||||||
-t THREADS, --crawl-threads=THREADS
|
|
||||||
Number of threads for crawling YouTube (default: 0)
|
|
||||||
-c THREADS, --channel-threads=THREADS
|
-c THREADS, --channel-threads=THREADS
|
||||||
Number of threads for refreshing channels (default: 1)
|
Number of threads for refreshing channels (default: 1)
|
||||||
-f THREADS, --feed-threads=THREADS
|
-f THREADS, --feed-threads=THREADS
|
||||||
Number of threads for refreshing feeds (default: 1)
|
Number of threads for refreshing feeds (default: 1)
|
||||||
-v THREADS, --video-threads=THREADS
|
|
||||||
Number of threads for refreshing videos (default: 0)
|
|
||||||
-o OUTPUT, --output=OUTPUT Redirect output (default: STDOUT)
|
-o OUTPUT, --output=OUTPUT Redirect output (default: STDOUT)
|
||||||
|
-v, --version Print version
|
||||||
```
|
```
|
||||||
|
|
||||||
Or for development:
|
Or for development:
|
||||||
|
@ -188,6 +185,7 @@ Or for development:
|
||||||
```bash
|
```bash
|
||||||
$ curl -fsSLo- https://raw.githubusercontent.com/samueleaton/sentry/master/install.cr | crystal eval
|
$ curl -fsSLo- https://raw.githubusercontent.com/samueleaton/sentry/master/install.cr | crystal eval
|
||||||
$ ./sentry
|
$ ./sentry
|
||||||
|
🤖 Your SentryBot is vigilant. beep-boop...
|
||||||
```
|
```
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
|
@ -31,6 +31,47 @@ require "./invidious/*"
|
||||||
CONFIG = Config.from_yaml(File.read("config/config.yml"))
|
CONFIG = Config.from_yaml(File.read("config/config.yml"))
|
||||||
HMAC_KEY = CONFIG.hmac_key || Random::Secure.hex(32)
|
HMAC_KEY = CONFIG.hmac_key || Random::Secure.hex(32)
|
||||||
|
|
||||||
|
PG_URL = URI.new(
|
||||||
|
scheme: "postgres",
|
||||||
|
user: CONFIG.db[:user],
|
||||||
|
password: CONFIG.db[:password],
|
||||||
|
host: CONFIG.db[:host],
|
||||||
|
port: CONFIG.db[:port],
|
||||||
|
path: CONFIG.db[:dbname],
|
||||||
|
)
|
||||||
|
|
||||||
|
PG_DB = DB.open PG_URL
|
||||||
|
ARCHIVE_URL = URI.parse("https://archive.org")
|
||||||
|
LOGIN_URL = URI.parse("https://accounts.google.com")
|
||||||
|
PUBSUB_URL = URI.parse("https://pubsubhubbub.appspot.com")
|
||||||
|
REDDIT_URL = URI.parse("https://www.reddit.com")
|
||||||
|
TEXTCAPTCHA_URL = URI.parse("http://textcaptcha.com/omarroth@protonmail.com.json")
|
||||||
|
YT_URL = URI.parse("https://www.youtube.com")
|
||||||
|
CHARS_SAFE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||||
|
CURRENT_BRANCH = {{ "#{`git branch | sed -n '/\* /s///p'`.strip}" }}
|
||||||
|
CURRENT_COMMIT = {{ "#{`git rev-list HEAD --max-count=1 --abbrev-commit`.strip}" }}
|
||||||
|
CURRENT_VERSION = {{ "#{`git describe --tags --abbrev=0`.strip}" }}
|
||||||
|
|
||||||
|
SOFTWARE = {
|
||||||
|
"name" => "invidious",
|
||||||
|
"version" => "#{CURRENT_VERSION}-#{CURRENT_COMMIT}",
|
||||||
|
"branch" => "#{CURRENT_BRANCH}",
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCALES = {
|
||||||
|
"ar" => load_locale("ar"),
|
||||||
|
"de" => load_locale("de"),
|
||||||
|
"en-US" => load_locale("en-US"),
|
||||||
|
"es" => load_locale("es"),
|
||||||
|
"eu" => load_locale("eu"),
|
||||||
|
"fr" => load_locale("fr"),
|
||||||
|
"it" => load_locale("it"),
|
||||||
|
"nb_NO" => load_locale("nb_NO"),
|
||||||
|
"nl" => load_locale("nl"),
|
||||||
|
"pl" => load_locale("pl"),
|
||||||
|
"ru" => load_locale("ru"),
|
||||||
|
}
|
||||||
|
|
||||||
config = CONFIG
|
config = CONFIG
|
||||||
logger = Invidious::LogHandler.new
|
logger = Invidious::LogHandler.new
|
||||||
|
|
||||||
|
@ -56,45 +97,14 @@ Kemal.config.extra_options do |parser|
|
||||||
FileUtils.mkdir_p(File.dirname(output))
|
FileUtils.mkdir_p(File.dirname(output))
|
||||||
logger = Invidious::LogHandler.new(File.open(output, mode: "a"))
|
logger = Invidious::LogHandler.new(File.open(output, mode: "a"))
|
||||||
end
|
end
|
||||||
|
parser.on("-v", "--version", "Print version") do |output|
|
||||||
|
puts SOFTWARE.to_pretty_json
|
||||||
|
exit
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Kemal::CLI.new ARGV
|
Kemal::CLI.new ARGV
|
||||||
|
|
||||||
PG_URL = URI.new(
|
|
||||||
scheme: "postgres",
|
|
||||||
user: CONFIG.db[:user],
|
|
||||||
password: CONFIG.db[:password],
|
|
||||||
host: CONFIG.db[:host],
|
|
||||||
port: CONFIG.db[:port],
|
|
||||||
path: CONFIG.db[:dbname],
|
|
||||||
)
|
|
||||||
|
|
||||||
PG_DB = DB.open PG_URL
|
|
||||||
ARCHIVE_URL = URI.parse("https://archive.org")
|
|
||||||
LOGIN_URL = URI.parse("https://accounts.google.com")
|
|
||||||
PUBSUB_URL = URI.parse("https://pubsubhubbub.appspot.com")
|
|
||||||
REDDIT_URL = URI.parse("https://www.reddit.com")
|
|
||||||
TEXTCAPTCHA_URL = URI.parse("http://textcaptcha.com/omarroth@protonmail.com.json")
|
|
||||||
YT_URL = URI.parse("https://www.youtube.com")
|
|
||||||
CHARS_SAFE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
|
|
||||||
CURRENT_BRANCH = {{ "#{`git branch | sed -n '/\* /s///p'`.strip}" }}
|
|
||||||
CURRENT_COMMIT = {{ "#{`git rev-list HEAD --max-count=1 --abbrev-commit`.strip}" }}
|
|
||||||
CURRENT_VERSION = {{ "#{`git describe --tags --abbrev=0`.strip}" }}
|
|
||||||
|
|
||||||
LOCALES = {
|
|
||||||
"ar" => load_locale("ar"),
|
|
||||||
"de" => load_locale("de"),
|
|
||||||
"en-US" => load_locale("en-US"),
|
|
||||||
"es" => load_locale("es"),
|
|
||||||
"eu" => load_locale("eu"),
|
|
||||||
"fr" => load_locale("fr"),
|
|
||||||
"it" => load_locale("it"),
|
|
||||||
"nb_NO" => load_locale("nb_NO"),
|
|
||||||
"nl" => load_locale("nl"),
|
|
||||||
"pl" => load_locale("pl"),
|
|
||||||
"ru" => load_locale("ru"),
|
|
||||||
}
|
|
||||||
|
|
||||||
refresh_channels(PG_DB, logger, config.channel_threads, config.full_refresh)
|
refresh_channels(PG_DB, logger, config.channel_threads, config.full_refresh)
|
||||||
|
|
||||||
refresh_feeds(PG_DB, logger, config.feed_threads)
|
refresh_feeds(PG_DB, logger, config.feed_threads)
|
||||||
|
@ -109,11 +119,7 @@ if config.statistics_enabled
|
||||||
loop do
|
loop do
|
||||||
statistics = {
|
statistics = {
|
||||||
"version" => "2.0",
|
"version" => "2.0",
|
||||||
"software" => {
|
"software" => SOFTWARE,
|
||||||
"name" => "invidious",
|
|
||||||
"version" => "#{CURRENT_VERSION}-#{CURRENT_COMMIT}",
|
|
||||||
"branch" => "#{CURRENT_BRANCH}",
|
|
||||||
},
|
|
||||||
"openRegistrations" => config.registration_enabled,
|
"openRegistrations" => config.registration_enabled,
|
||||||
"usage" => {
|
"usage" => {
|
||||||
"users" => {
|
"users" => {
|
||||||
|
|
Loading…
Reference in a new issue