summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md10
-rw-r--r--config/sql/channel_videos.sql2
-rw-r--r--config/sql/nonces.sql18
-rw-r--r--config/sql/session_ids.sql2
-rw-r--r--src/invidious.cr15
-rw-r--r--src/invidious/users.cr4
6 files changed, 31 insertions, 20 deletions
diff --git a/README.md b/README.md
index 4adae9e6..ae91b47a 100644
--- a/README.md
+++ b/README.md
@@ -36,6 +36,8 @@ Onion links:
## Installation
+See [Invidious-Updater](https://github.com/tmiland/Invidious-Updater) for a self-contained script that can automatically install and update Invidious.
+
### Docker:
#### Build and start cluster:
@@ -116,6 +118,7 @@ $ exit
```
#### systemd service
+
```bash
$ sudo cp /home/invidious/invidious/invidious.service /etc/systemd/system/invidious.service
$ sudo systemctl enable invidious.service
@@ -148,7 +151,8 @@ $ crystal build src/invidious.cr --release
```
## Update Invidious
-You can find information about how to update in the wiki: [Updating](https://github.com/omarroth/invidious/wiki/Updating).
+
+You can see how to update Invidious [here](https://github.com/omarroth/invidious/wiki/Updating).
## Usage:
@@ -180,10 +184,12 @@ $ ./sentry
```
## Documentation
+
[Documentation](https://github.com/omarroth/invidious/wiki) can be found in the wiki.
## Extensions
-Extensions for Invidious and for integrating Invidious into other projects [are in the wiki](https://github.com/omarroth/invidious/wiki/Extensions)
+
+[Extensions](https://github.com/omarroth/invidious/wiki/Extensions) can be found in the wiki, as well as documentation for integrating it into other projects.
## Made with Invidious
diff --git a/config/sql/channel_videos.sql b/config/sql/channel_videos.sql
index 98567780..279fad29 100644
--- a/config/sql/channel_videos.sql
+++ b/config/sql/channel_videos.sql
@@ -31,6 +31,6 @@ CREATE INDEX channel_videos_published_idx
CREATE INDEX channel_videos_ucid_idx
ON public.channel_videos
- USING hash
+ USING btree
(ucid COLLATE pg_catalog."default");
diff --git a/config/sql/nonces.sql b/config/sql/nonces.sql
index d2ec5be6..7b8ce9f2 100644
--- a/config/sql/nonces.sql
+++ b/config/sql/nonces.sql
@@ -5,10 +5,18 @@
CREATE TABLE public.nonces
(
nonce text,
- expire timestamp with time zone
-)
-WITH (
- OIDS=FALSE
+ expire timestamp with time zone,
+ CONSTRAINT nonces_id_key UNIQUE (nonce)
);
-GRANT ALL ON TABLE public.nonces TO kemal; \ No newline at end of file
+GRANT ALL ON TABLE public.nonces TO kemal;
+
+-- Index: public.nonces_nonce_idx
+
+-- DROP INDEX public.nonces_nonce_idx;
+
+CREATE INDEX nonces_nonce_idx
+ ON public.nonces
+ USING btree
+ (nonce COLLATE pg_catalog."default");
+
diff --git a/config/sql/session_ids.sql b/config/sql/session_ids.sql
index aa689577..afbabb67 100644
--- a/config/sql/session_ids.sql
+++ b/config/sql/session_ids.sql
@@ -10,7 +10,7 @@ CREATE TABLE public.session_ids
CONSTRAINT session_ids_pkey PRIMARY KEY (id)
);
-GRANT ALL ON TABLE public.channel_videos TO kemal;
+GRANT ALL ON TABLE public.session_ids TO kemal;
-- Index: public.session_ids_id_idx
diff --git a/src/invidious.cr b/src/invidious.cr
index 169c4f12..285d4394 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -1028,7 +1028,7 @@ post "/login" do |env|
user, sid = create_user(sid, email, password)
user_array = user.to_a
- user_array[5] = user_array[5].to_json
+ user_array[4] = user_array[4].to_json
args = arg_array(user_array)
PG_DB.exec("INSERT INTO users VALUES (#{args})", user_array)
@@ -1375,10 +1375,8 @@ get "/subscription_manager" do |env|
subscriptions = [] of InvidiousChannel
user.subscriptions.each do |ucid|
- begin
- subscriptions << get_channel(ucid, PG_DB, false, false)
- rescue ex
- next
+ if channel = PG_DB.query_one?("SELECT * FROM channels WHERE id = $1", ucid, as: InvidiousChannel)
+ subscriptions << channel
end
end
subscriptions.sort_by! { |channel| channel.author.downcase }
@@ -3950,14 +3948,13 @@ end
error 500 do |env|
error_message = <<-END_HTML
- Looks like you've found a bug in Invidious. Feel free to open a new issue
- <a href="https://github.com/omarroth/invidious/issues/github.com/omarroth/invidious">
+ Looks like you've found a bug in Invidious. Feel free to open a new issue
+ <a href="https://github.com/omarroth/invidious/issues">
here
</a>
or send an email to
<a href="mailto:omarroth@protonmail.com">
- omarroth@protonmail.com
- </a>.
+ omarroth@protonmail.com</a>.
END_HTML
templated "error"
end
diff --git a/src/invidious/users.cr b/src/invidious/users.cr
index 67125654..072638ba 100644
--- a/src/invidious/users.cr
+++ b/src/invidious/users.cr
@@ -132,7 +132,7 @@ def get_user(sid, headers, db, refresh = true)
user, sid = fetch_user(sid, headers, db)
user_array = user.to_a
- user_array[5] = user_array[5].to_json
+ user_array[4] = user_array[4].to_json
args = arg_array(user_array)
db.exec("INSERT INTO users VALUES (#{args}) \
@@ -154,7 +154,7 @@ def get_user(sid, headers, db, refresh = true)
user, sid = fetch_user(sid, headers, db)
user_array = user.to_a
- user_array[5] = user_array[5].to_json
+ user_array[4] = user_array[4].to_json
args = arg_array(user.to_a)
db.exec("INSERT INTO users VALUES (#{args}) \