From eb1df96e1b2e1cb8f322a34d4f6ad69af4c171bb Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Fri, 6 Jul 2018 07:59:56 -0500 Subject: [PATCH] Remove patch and update file structure --- src/cookie_fix.cr | 29 ------------------- src/invidious.cr | 3 +- src/{ => invidious}/helpers.cr | 4 +-- src/{ => invidious}/views/channel.ecr | 0 .../views/components/subscription_video.ecr | 0 .../views/components/video.ecr | 0 src/{ => invidious}/views/error.ecr | 0 src/{ => invidious}/views/index.ecr | 0 src/{ => invidious}/views/layout.ecr | 0 src/{ => invidious}/views/login.ecr | 0 src/{ => invidious}/views/search.ecr | 0 .../views/subscription_manager.ecr | 0 src/{ => invidious}/views/subscriptions.ecr | 0 src/{ => invidious}/views/watch.ecr | 0 14 files changed, 3 insertions(+), 33 deletions(-) delete mode 100644 src/cookie_fix.cr rename src/{ => invidious}/helpers.cr (99%) rename src/{ => invidious}/views/channel.ecr (100%) rename src/{ => invidious}/views/components/subscription_video.ecr (100%) rename src/{ => invidious}/views/components/video.ecr (100%) rename src/{ => invidious}/views/error.ecr (100%) rename src/{ => invidious}/views/index.ecr (100%) rename src/{ => invidious}/views/layout.ecr (100%) rename src/{ => invidious}/views/login.ecr (100%) rename src/{ => invidious}/views/search.ecr (100%) rename src/{ => invidious}/views/subscription_manager.ecr (100%) rename src/{ => invidious}/views/subscriptions.ecr (100%) rename src/{ => invidious}/views/watch.ecr (100%) diff --git a/src/cookie_fix.cr b/src/cookie_fix.cr deleted file mode 100644 index 1c0345e0..00000000 --- a/src/cookie_fix.cr +++ /dev/null @@ -1,29 +0,0 @@ -# See https://github.com/crystal-lang/crystal/pull/5408 -module HTTP - class Cookie - module Parser - SetCookieStringFix = /^#{Regex::CookiePair}(?:;\s*#{Regex::CookieAV})*$/ - - def parse_set_cookie(header) - match = header.match(SetCookieStringFix) - return unless match - - expires = if max_age = match["max_age"]? - Time.now + max_age.to_i.seconds - else - parse_time(match["expires"]?) - end - - Cookie.new( - match["name"], match["value"], - path: match["path"]? || "/", - expires: expires, - domain: match["domain"]?, - secure: match["secure"]? != nil, - http_only: match["http_only"]? != nil, - extension: match["extension"]? - ) - end - end - end -end diff --git a/src/invidious.cr b/src/invidious.cr index 0d085478..22c91865 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -20,8 +20,7 @@ require "option_parser" require "pg" require "xml" require "yaml" -require "./cookie_fix" -require "./helpers" +require "./invidious/*" CONFIG = Config.from_yaml(File.read("config/config.yml")) diff --git a/src/helpers.cr b/src/invidious/helpers.cr similarity index 99% rename from src/helpers.cr rename to src/invidious/helpers.cr index e8408d4b..0df3f06f 100644 --- a/src/helpers.cr +++ b/src/invidious/helpers.cr @@ -10,11 +10,11 @@ macro add_mapping(mapping) end macro templated(filename) - render "src/views/#{{{filename}}}.ecr", "src/views/layout.ecr" + render "src/invidious/views/#{{{filename}}}.ecr", "src/invidious/views/layout.ecr" end macro rendered(filename) - render "src/views/#{{{filename}}}.ecr" + render "src/invidious/views/#{{{filename}}}.ecr" end class Config diff --git a/src/views/channel.ecr b/src/invidious/views/channel.ecr similarity index 100% rename from src/views/channel.ecr rename to src/invidious/views/channel.ecr diff --git a/src/views/components/subscription_video.ecr b/src/invidious/views/components/subscription_video.ecr similarity index 100% rename from src/views/components/subscription_video.ecr rename to src/invidious/views/components/subscription_video.ecr diff --git a/src/views/components/video.ecr b/src/invidious/views/components/video.ecr similarity index 100% rename from src/views/components/video.ecr rename to src/invidious/views/components/video.ecr diff --git a/src/views/error.ecr b/src/invidious/views/error.ecr similarity index 100% rename from src/views/error.ecr rename to src/invidious/views/error.ecr diff --git a/src/views/index.ecr b/src/invidious/views/index.ecr similarity index 100% rename from src/views/index.ecr rename to src/invidious/views/index.ecr diff --git a/src/views/layout.ecr b/src/invidious/views/layout.ecr similarity index 100% rename from src/views/layout.ecr rename to src/invidious/views/layout.ecr diff --git a/src/views/login.ecr b/src/invidious/views/login.ecr similarity index 100% rename from src/views/login.ecr rename to src/invidious/views/login.ecr diff --git a/src/views/search.ecr b/src/invidious/views/search.ecr similarity index 100% rename from src/views/search.ecr rename to src/invidious/views/search.ecr diff --git a/src/views/subscription_manager.ecr b/src/invidious/views/subscription_manager.ecr similarity index 100% rename from src/views/subscription_manager.ecr rename to src/invidious/views/subscription_manager.ecr diff --git a/src/views/subscriptions.ecr b/src/invidious/views/subscriptions.ecr similarity index 100% rename from src/views/subscriptions.ecr rename to src/invidious/views/subscriptions.ecr diff --git a/src/views/watch.ecr b/src/invidious/views/watch.ecr similarity index 100% rename from src/views/watch.ecr rename to src/invidious/views/watch.ecr