forked from midou/invidious
Add support for custom playlists
This commit is contained in:
@@ -129,7 +129,7 @@ class AuthHandler < Kemal::Handler
|
||||
|
||||
error_message = {"error" => ex.message}.to_json
|
||||
env.response.status_code = 403
|
||||
env.response.puts error_message
|
||||
env.response.print error_message
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -159,7 +159,8 @@ class APIHandler < Kemal::Handler
|
||||
|
||||
env.response.output.rewind
|
||||
|
||||
if env.response.headers.includes_word?("Content-Type", "application/json")
|
||||
if env.response.output.as(IO::Memory).size != 0 &&
|
||||
env.response.headers.includes_word?("Content-Type", "application/json")
|
||||
response = JSON.parse(env.response.output)
|
||||
|
||||
if fields_text = env.params.query["fields"]?
|
||||
@@ -194,7 +195,7 @@ class APIHandler < Kemal::Handler
|
||||
end
|
||||
ensure
|
||||
env.response.output = output
|
||||
env.response.puts response
|
||||
env.response.print response
|
||||
|
||||
env.response.flush
|
||||
end
|
||||
|
@@ -598,7 +598,17 @@ def extract_shelf_items(nodeset, ucid = nil, author_name = nil)
|
||||
return items
|
||||
end
|
||||
|
||||
def analyze_table(db, logger, table_name, struct_type = nil)
|
||||
def check_enum(db, logger, enum_name, struct_type = nil)
|
||||
if !db.query_one?("SELECT true FROM pg_type WHERE typname = $1", enum_name, as: Bool)
|
||||
logger.puts("CREATE TYPE #{enum_name}")
|
||||
|
||||
db.using_connection do |conn|
|
||||
conn.as(PG::Connection).exec_all(File.read("config/sql/#{enum_name}.sql"))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def check_table(db, logger, table_name, struct_type = nil)
|
||||
# Create table if it doesn't exist
|
||||
begin
|
||||
db.exec("SELECT * FROM #{table_name} LIMIT 0")
|
||||
|
Reference in New Issue
Block a user