From 080d9a8dc72a1d932dcda07bb93d21fdcc98496a Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Thu, 7 Oct 2021 21:55:21 +0200 Subject: [PATCH] move theme converter function to a separate file --- src/invidious/helpers/utils.cr | 13 ------------- src/invidious/user/converters.cr | 12 ++++++++++++ 2 files changed, 12 insertions(+), 13 deletions(-) create mode 100644 src/invidious/user/converters.cr diff --git a/src/invidious/helpers/utils.cr b/src/invidious/helpers/utils.cr index 68ba76f9..af5f553b 100644 --- a/src/invidious/helpers/utils.cr +++ b/src/invidious/helpers/utils.cr @@ -397,19 +397,6 @@ def parse_range(range) return 0_i64, nil end -def convert_theme(theme) - case theme - when "true" - "dark" - when "false" - "light" - when "", nil - nil - else - theme - end -end - def fetch_random_instance begin instance_api_client = make_client(URI.parse("https://api.invidious.io")) diff --git a/src/invidious/user/converters.cr b/src/invidious/user/converters.cr new file mode 100644 index 00000000..dcbf8c53 --- /dev/null +++ b/src/invidious/user/converters.cr @@ -0,0 +1,12 @@ +def convert_theme(theme) + case theme + when "true" + "dark" + when "false" + "light" + when "", nil + nil + else + theme + end +end