summaryrefslogtreecommitdiff
path: root/lib/lsg
diff options
context:
space:
mode:
authorhref <href@random.sh>2018-02-17 21:21:42 +0100
committerhref <href@random.sh>2018-02-17 21:21:42 +0100
commit50c6a09ff64cb081b27a0c30790b86873449d172 (patch)
treeba1bebfc7e367f169276692e0ac02709d62d6516 /lib/lsg
parenttxt: fix against malicious filenames (aka 'fuck you shiv') (diff)
:)
Diffstat (limited to 'lib/lsg')
-rw-r--r--lib/lsg/application.ex11
-rw-r--r--lib/lsg/icecast.ex6
2 files changed, 4 insertions, 13 deletions
diff --git a/lib/lsg/application.ex b/lib/lsg/application.ex
index 0df3c87..23db221 100644
--- a/lib/lsg/application.ex
+++ b/lib/lsg/application.ex
@@ -5,7 +5,6 @@ defmodule LSG.Application do
# for more information on OTP Applications
def start(_type, _args) do
import Supervisor.Spec
- {:ok, irc_client} = ExIRC.start_link!
# Define workers and child supervisors to be supervised
children = [
@@ -16,9 +15,7 @@ defmodule LSG.Application do
worker(Registry, [[keys: :duplicate, name: LSG.BroadcastRegistry]]),
worker(LSG.IcecastAgent, []),
worker(LSG.Icecast, []),
- worker(LSG.IRC.ConnectionHandler, [irc_client]),
- worker(LSG.IRC.LoginHandler, [irc_client]),
- ] ++ irc_handlers(irc_client)
+ ] ++ LSG.IRC.application_childs
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
@@ -33,10 +30,4 @@ defmodule LSG.Application do
:ok
end
- defp irc_handlers(irc_client) do
- import Supervisor.Spec
- for handler <- Application.get_env(:lsg, :irc)[:handlers] do
- worker(handler, [irc_client])
- end
- end
end
diff --git a/lib/lsg/icecast.ex b/lib/lsg/icecast.ex
index 21a9ea2..07dd4fc 100644
--- a/lib/lsg/icecast.ex
+++ b/lib/lsg/icecast.ex
@@ -1,7 +1,6 @@
defmodule LSG.Icecast do
use GenServer
require Logger
- @interval 2_500
@hackney_pool :default
@httpoison_opts [hackney: [pool: @hackney_pool]]
@fuse __MODULE__
@@ -42,7 +41,8 @@ defmodule LSG.Icecast do
Logger.error "Icecast HTTP Error: #{inspect error}"
state
end
- :timer.send_after(@interval, :poll)
+ interval = Application.get_env(:lsg, :icecast_poll_interval, 60_000)
+ :timer.send_after(interval, :poll)
state
end
@@ -83,7 +83,7 @@ defmodule LSG.Icecast do
end
defp request(uri, method, body \\ [], headers \\ []) do
- headers = [{"user-agent", "LSG-API[lsg.goulag.org] href@random.sh"}] ++ headers
+ headers = [{"user-agent", "LSG-API[115ans.net, sys.115ans.net] href@random.sh"}] ++ headers
options = @httpoison_opts
case :ok do #:fuse.ask(@fuse, :sync) do
:ok -> run_request(method, uri, body, headers, options)