Invidious is an alternative front-end to YouTube
Add support for partial data restore
Omar Roth0a1c84ada18b
diff --git a/src/invidious.cr b/src/invidious.crindex 199ad602..3602ed70 100644--- a/src/invidious.cr+++ b/src/invidious.cr@@ -1212,7 +1212,7 @@ post "/data_control" do |env|case part.namewhen "import_invidious"body = JSON.parse(body)- body["subscriptions"].as_a.each do |ucid|+ body["subscriptions"]?.try &.as_a.each do |ucid|ucid = ucid.as_sif !user.subscriptions.includes? ucid@@ -1228,7 +1228,7 @@ post "/data_control" do |env|endend- body["watch_history"].as_a.each do |id|+ body["watch_history"]?.try &.as_a.each do |id|id = id.as_sif !user.watched.includes? id@@ -1237,7 +1237,9 @@ post "/data_control" do |env|endend+ if body["preferences"]?PG_DB.exec("UPDATE users SET preferences = $1 WHERE email = $2", body["preferences"].to_json, user.email)+ endwhen "import_youtube"subscriptions = XML.parse(body)subscriptions.xpath_nodes(%q(//outline[@type="rss"])).each do |channel|