summaryrefslogtreecommitdiff
path: root/lib/lsg_web
diff options
context:
space:
mode:
authorJordan Bracco <href@random.sh>2022-12-17 13:47:11 +0000
committerJordan Bracco <href@random.sh>2022-12-20 19:29:41 +0100
commitfd4afd7c7acd9b5fda75b628a7e19d0149d8b889 (patch)
treedf571d49fa9dc9c3cd58c94033b9fc81c7b7f8ec /lib/lsg_web
parentRename to Nola, pt. 1. Refs T77 (diff)
Nola rename cont. pt. 2. Refs T77.
`find lib -name "*.ex" -type f | xargs sed -i '' 's/LSG/Nola/g'`
Diffstat (limited to 'lib/lsg_web')
-rw-r--r--lib/lsg_web/channels/user_socket.ex6
-rw-r--r--lib/lsg_web/components/component.ex2
-rw-r--r--lib/lsg_web/components/event_component.ex10
-rw-r--r--lib/lsg_web/components/message_component.ex4
-rw-r--r--lib/lsg_web/context_plug.ex6
-rw-r--r--lib/lsg_web/controllers/alcoolog_controller.ex44
-rw-r--r--lib/lsg_web/controllers/gpt_controller.ex14
-rw-r--r--lib/lsg_web/controllers/icecast_see_controller.ex8
-rw-r--r--lib/lsg_web/controllers/irc_auth_sse_controller.ex6
-rw-r--r--lib/lsg_web/controllers/irc_controller.ex12
-rw-r--r--lib/lsg_web/controllers/network_controller.ex6
-rw-r--r--lib/lsg_web/controllers/open_id_controller.ex8
-rw-r--r--lib/lsg_web/controllers/page_controller.ex12
-rw-r--r--lib/lsg_web/controllers/sms_controller.ex6
-rw-r--r--lib/lsg_web/controllers/untappd_controller.ex4
-rw-r--r--lib/lsg_web/endpoint.ex4
-rw-r--r--lib/lsg_web/gettext.ex4
-rw-r--r--lib/lsg_web/live/chat_live.ex6
-rw-r--r--lib/lsg_web/lsg_web.ex26
-rw-r--r--lib/lsg_web/router.ex14
-rw-r--r--lib/lsg_web/views/alcoolog_view.ex4
-rw-r--r--lib/lsg_web/views/error_helpers.ex6
-rw-r--r--lib/lsg_web/views/error_view.ex4
-rw-r--r--lib/lsg_web/views/irc_view.ex4
-rw-r--r--lib/lsg_web/views/layout_view.ex8
-rw-r--r--lib/lsg_web/views/network_view.ex4
-rw-r--r--lib/lsg_web/views/open_id_view.ex4
-rw-r--r--lib/lsg_web/views/page_view.ex4
28 files changed, 120 insertions, 120 deletions
diff --git a/lib/lsg_web/channels/user_socket.ex b/lib/lsg_web/channels/user_socket.ex
index 691a26c..eadd4e0 100644
--- a/lib/lsg_web/channels/user_socket.ex
+++ b/lib/lsg_web/channels/user_socket.ex
@@ -1,8 +1,8 @@
-defmodule LSGWeb.UserSocket do
+defmodule NolaWeb.UserSocket do
use Phoenix.Socket
## Channels
- # channel "room:*", LSGWeb.RoomChannel
+ # channel "room:*", NolaWeb.RoomChannel
## Transports
#transport :websocket, Phoenix.Transports.WebSocket
@@ -30,7 +30,7 @@ defmodule LSGWeb.UserSocket do
# Would allow you to broadcast a "disconnect" event and terminate
# all active sockets and channels for a given user:
#
- # LSGWeb.Endpoint.broadcast("user_socket:#{user.id}", "disconnect", %{})
+ # NolaWeb.Endpoint.broadcast("user_socket:#{user.id}", "disconnect", %{})
#
# Returning `nil` makes this socket anonymous.
def id(_socket), do: nil
diff --git a/lib/lsg_web/components/component.ex b/lib/lsg_web/components/component.ex
index d504129..fff8263 100644
--- a/lib/lsg_web/components/component.ex
+++ b/lib/lsg_web/components/component.ex
@@ -1,4 +1,4 @@
-defmodule LSGWeb.Component do
+defmodule NolaWeb.Component do
use Phoenix.Component
@date_time_default_format "%F %H:%M"
diff --git a/lib/lsg_web/components/event_component.ex b/lib/lsg_web/components/event_component.ex
index fa81d19..8af3c67 100644
--- a/lib/lsg_web/components/event_component.ex
+++ b/lib/lsg_web/components/event_component.ex
@@ -1,4 +1,4 @@
-defmodule LSGWeb.EventComponent do
+defmodule NolaWeb.EventComponent do
use Phoenix.Component
def content(assigns = %{event: %{type: :day_changed}}) do
@@ -10,7 +10,7 @@ defmodule LSGWeb.EventComponent do
def content(assigns = %{event: %{type: :quit}}) do
~H"""
- <LSGWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} />
+ <NolaWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} />
has quit:
<span class="reason"><%= @reason %></span>
"""
@@ -18,7 +18,7 @@ defmodule LSGWeb.EventComponent do
def content(assigns = %{event: %{type: :part}}) do
~H"""
- <LSGWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} />
+ <NolaWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} />
has left:
<span class="reason"><%= @reason %></span>
"""
@@ -28,13 +28,13 @@ defmodule LSGWeb.EventComponent do
~H"""
<span class="old-nick"><%= @old_nick %></span>
is now known as
- <LSGWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} />
+ <NolaWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} />
"""
end
def content(assigns = %{event: %{type: :join}}) do
~H"""
- <LSGWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} />
+ <NolaWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} />
joined
"""
end
diff --git a/lib/lsg_web/components/message_component.ex b/lib/lsg_web/components/message_component.ex
index 5997754..5d0386b 100644
--- a/lib/lsg_web/components/message_component.ex
+++ b/lib/lsg_web/components/message_component.ex
@@ -1,9 +1,9 @@
-defmodule LSGWeb.MessageComponent do
+defmodule NolaWeb.MessageComponent do
use Phoenix.Component
def content(assigns) do
~H"""
- <LSGWeb.Component.naive_date_time_utc datetime={@message.at} format="time-24-with-seconds" />
+ <NolaWeb.Component.naive_date_time_utc datetime={@message.at} format="time-24-with-seconds" />
<div class="inline-block font-bold flex-none cursor-default"><%= @message.sender.nick %></div>
<div class="inline-block flex-grow cursor-default"><%= @text %></div>
"""
diff --git a/lib/lsg_web/context_plug.ex b/lib/lsg_web/context_plug.ex
index aaf851e..ebededa 100644
--- a/lib/lsg_web/context_plug.ex
+++ b/lib/lsg_web/context_plug.ex
@@ -1,4 +1,4 @@
-defmodule LSGWeb.ContextPlug do
+defmodule NolaWeb.ContextPlug do
import Plug.Conn
import Phoenix.Controller
@@ -31,7 +31,7 @@ defmodule LSGWeb.ContextPlug do
conns = IRC.Connection.get_network(network)
chan = if c = Map.get(conn.params, "chan") do
- LSGWeb.reformat_chan(c)
+ NolaWeb.reformat_chan(c)
end
chan_conn = IRC.Connection.get_network(network, chan)
@@ -66,7 +66,7 @@ defmodule LSGWeb.ContextPlug do
auth_required ->
conn
|> put_status(403)
- |> render(LSGWeb.AlcoologView, "auth.html", bot: bot, no_header: true, network: network)
+ |> render(NolaWeb.AlcoologView, "auth.html", bot: bot, no_header: true, network: network)
|> halt()
(network && !conns) ->
conn
diff --git a/lib/lsg_web/controllers/alcoolog_controller.ex b/lib/lsg_web/controllers/alcoolog_controller.ex
index 6542f15..3081762 100644
--- a/lib/lsg_web/controllers/alcoolog_controller.ex
+++ b/lib/lsg_web/controllers/alcoolog_controller.ex
@@ -1,12 +1,12 @@
-defmodule LSGWeb.AlcoologController do
- use LSGWeb, :controller
+defmodule NolaWeb.AlcoologController do
+ use NolaWeb, :controller
require Logger
- plug LSGWeb.ContextPlug when action not in [:token]
- plug LSGWeb.ContextPlug, [restrict: :public] when action in [:token]
+ plug NolaWeb.ContextPlug when action not in [:token]
+ plug NolaWeb.ContextPlug, [restrict: :public] when action in [:token]
def token(conn, %{"token" => token}) do
- case LSG.Token.lookup(token) do
+ case Nola.Token.lookup(token) do
{:ok, {:alcoolog, :index, network, channel}} -> index(conn, nil, network, channel)
err ->
Logger.debug("AlcoologControler: token #{inspect err} invalid")
@@ -21,8 +21,8 @@ defmodule LSGWeb.AlcoologController do
days = String.to_integer(Map.get(params, "days", "180"))
friend? = Enum.member?(IRC.Membership.friends(account), profile_account.id)
if friend? do
- stats = LSG.IRC.AlcoologPlugin.get_full_statistics(profile_account.id)
- history = for {{nick, ts}, points, active, cl, deg, type, descr, meta} <- LSG.IRC.AlcoologPlugin.nick_history(profile_account) do
+ stats = Nola.IRC.AlcoologPlugin.get_full_statistics(profile_account.id)
+ history = for {{nick, ts}, points, active, cl, deg, type, descr, meta} <- Nola.IRC.AlcoologPlugin.nick_history(profile_account) do
%{
at: ts |> DateTime.from_unix!(:millisecond),
points: points,
@@ -50,7 +50,7 @@ defmodule LSGWeb.AlcoologController do
profile_account = IRC.Account.find_always_by_nick(network, nick, nick)
friend? = Enum.member?(IRC.Membership.friends(account), profile_account.id)
if friend? do
- stats = LSG.IRC.AlcoologPlugin.get_full_statistics(profile_account.id)
+ stats = Nola.IRC.AlcoologPlugin.get_full_statistics(profile_account.id)
conn
|> put_resp_content_type("application/json")
@@ -67,7 +67,7 @@ defmodule LSGWeb.AlcoologController do
friend? = Enum.member?(IRC.Membership.friends(account), profile_account.id)
count = String.to_integer(Map.get(params, "days", "180"))
if friend? do
- data = LSG.IRC.AlcoologPlugin.user_over_time_gl(profile_account, count)
+ data = Nola.IRC.AlcoologPlugin.user_over_time_gl(profile_account, count)
delay = count*((24 * 60)*60)
now = DateTime.utc_now()
start_date = DateTime.utc_now()
@@ -101,7 +101,7 @@ defmodule LSGWeb.AlcoologController do
friend? = Enum.member?(IRC.Membership.friends(account), profile_account.id)
count = String.to_integer(Map.get(params, "days", "180"))
if friend? do
- data = LSG.IRC.AlcoologPlugin.user_over_time(profile_account, count)
+ data = Nola.IRC.AlcoologPlugin.user_over_time(profile_account, count)
delay = count*((24 * 60)*60)
now = DateTime.utc_now()
start_date = DateTime.utc_now()
@@ -132,7 +132,7 @@ defmodule LSGWeb.AlcoologController do
profile_account = IRC.Account.find_always_by_nick(network, nick, nick)
friend? = Enum.member?(IRC.Membership.friends(account), profile_account.id)
if friend? do
- history = for {{nick, ts}, points, active, cl, deg, type, descr, meta} <- LSG.IRC.AlcoologPlugin.nick_history(profile_account) do
+ history = for {{nick, ts}, points, active, cl, deg, type, descr, meta} <- Nola.IRC.AlcoologPlugin.nick_history(profile_account) do
%{
at: ts |> DateTime.from_unix!(:millisecond) |> DateTime.to_iso8601(),
points: points,
@@ -145,7 +145,7 @@ defmodule LSGWeb.AlcoologController do
}
end
last = List.last(history)
- {_, active} = LSG.IRC.AlcoologPlugin.user_stats(profile_account)
+ {_, active} = Nola.IRC.AlcoologPlugin.user_stats(profile_account)
last = %{last | active: active, at: DateTime.utc_now() |> DateTime.to_iso8601()}
history = history ++ [last]
@@ -163,7 +163,7 @@ defmodule LSGWeb.AlcoologController do
profile_account = IRC.Account.find_always_by_nick(network, nick, nick)
friend? = Enum.member?(IRC.Membership.friends(account), profile_account.id)
if friend? do
- history = for {_, date, value} <- LSG.IRC.AlcoologAnnouncerPlugin.log(profile_account) do
+ history = for {_, date, value} <- Nola.IRC.AlcoologAnnouncerPlugin.log(profile_account) do
%{date: DateTime.to_iso8601(date), value: value}
end
conn
@@ -177,7 +177,7 @@ defmodule LSGWeb.AlcoologController do
end
def index(conn = %{assigns: %{account: account}}, %{"network" => network, "chan" => channel}) do
- index(conn, account, network, LSGWeb.reformat_chan(channel))
+ index(conn, account, network, NolaWeb.reformat_chan(channel))
end
def index(conn = %{assigns: %{account: account}}, _) do
@@ -187,7 +187,7 @@ defmodule LSGWeb.AlcoologController do
#def index(conn, params) do
# network = Map.get(params, "network")
# chan = if c = Map.get(params, "chan") do
- # LSGWeb.reformat_chan(c)
+ # NolaWeb.reformat_chan(c)
# end
# irc_conn = if network do
# IRC.Connection.get_network(network, chan)
@@ -223,12 +223,12 @@ defmodule LSGWeb.AlcoologController do
members = IRC.Membership.expanded_members_or_friends(account, network, channel)
members_ids = Enum.map(members, fn({account, _, nick}) -> account.id end)
member_names = Enum.reduce(members, %{}, fn({account, _, nick}, acc) -> Map.put(acc, account.id, nick) end)
- drinks = :ets.select(LSG.IRC.AlcoologPlugin.ETS, match)
+ drinks = :ets.select(Nola.IRC.AlcoologPlugin.ETS, match)
|> Enum.filter(fn({{account, _}, _vol, _cur, _cl, _deg, _name, _cmt, _meta}) -> Enum.member?(members_ids, account) end)
|> Enum.map(fn({{account, _}, _, _, _, _, _, _, _} = object) -> {object, Map.get(member_names, account)} end)
|> Enum.sort_by(fn({{{_, ts}, _, _, _, _, _, _, _}, _}) -> ts end, &>/2)
- stats = LSG.IRC.AlcoologPlugin.get_channel_statistics(account, network, channel)
+ stats = Nola.IRC.AlcoologPlugin.get_channel_statistics(account, network, channel)
top = Enum.reduce(drinks, %{}, fn({{{account_id, _}, vol, _, _, _, _, _, _}, _}, acc) ->
nick = Map.get(member_names, account_id)
@@ -245,7 +245,7 @@ defmodule LSGWeb.AlcoologController do
def index_gls_json(conn = %{assigns: %{account: account}}, %{"network" => network, "chan" => channel}) do
count = 30
- channel = LSGWeb.reformat_chan(channel)
+ channel = NolaWeb.reformat_chan(channel)
members = IRC.Membership.expanded_members_or_friends(account, network, channel)
members_ids = Enum.map(members, fn({account, _, nick}) -> account.id end)
member_names = Enum.reduce(members, %{}, fn({account, _, nick}, acc) -> Map.put(acc, account.id, nick) end)
@@ -266,7 +266,7 @@ defmodule LSGWeb.AlcoologController do
|> Enum.into(Map.new)
gls = Enum.reduce(members, filled, fn({account, _, _}, gls) ->
- Enum.reduce(LSG.IRC.AlcoologPlugin.user_over_time_gl(account, count), gls, fn({date, gl}, gls) ->
+ Enum.reduce(Nola.IRC.AlcoologPlugin.user_over_time_gl(account, count), gls, fn({date, gl}, gls) ->
u = Map.get(gls, date, %{})
|> Map.put(Map.get(member_names, account.id, account.id), gl)
Map.put(gls, date, u)
@@ -302,12 +302,12 @@ defmodule LSGWeb.AlcoologController do
def minisync(conn, %{"user_id" => user_id, "key" => key, "value" => value}) do
account = IRC.Account.get(user_id)
if account do
- ds = LSG.IRC.AlcoologPlugin.data_state()
- meta = LSG.IRC.AlcoologPlugin.get_user_meta(ds, account.id)
+ ds = Nola.IRC.AlcoologPlugin.data_state()
+ meta = Nola.IRC.AlcoologPlugin.get_user_meta(ds, account.id)
case Float.parse(value) do
{val, _} ->
new_meta = Map.put(meta, String.to_existing_atom(key), val)
- LSG.IRC.AlcoologPlugin.put_user_meta(ds, account.id, new_meta)
+ Nola.IRC.AlcoologPlugin.put_user_meta(ds, account.id, new_meta)
_ ->
conn
|> put_status(:unprocessable_entity)
diff --git a/lib/lsg_web/controllers/gpt_controller.ex b/lib/lsg_web/controllers/gpt_controller.ex
index acf9b27..038b235 100644
--- a/lib/lsg_web/controllers/gpt_controller.ex
+++ b/lib/lsg_web/controllers/gpt_controller.ex
@@ -1,14 +1,14 @@
-defmodule LSGWeb.GptController do
- use LSGWeb, :controller
+defmodule NolaWeb.GptController do
+ use NolaWeb, :controller
require Logger
- plug LSGWeb.ContextPlug
+ plug NolaWeb.ContextPlug
def result(conn, params = %{"id" => result_id}) do
- case LSG.IRC.GptPlugin.get_result(result_id) do
+ case Nola.IRC.GptPlugin.get_result(result_id) do
{:ok, result} ->
network = Map.get(params, "network")
- channel = if c = Map.get(params, "chan"), do: LSGWeb.reformat_chan(c)
+ channel = if c = Map.get(params, "chan"), do: NolaWeb.reformat_chan(c)
render(conn, "result.html", network: network, channel: channel, result: result)
{:error, :not_found} ->
conn
@@ -18,10 +18,10 @@ defmodule LSGWeb.GptController do
end
def prompt(conn, params = %{"id" => prompt_id}) do
- case LSG.IRC.GptPlugin.get_prompt(prompt_id) do
+ case Nola.IRC.GptPlugin.get_prompt(prompt_id) do
{:ok, prompt} ->
network = Map.get(params, "network")
- channel = if c = Map.get(params, "chan"), do: LSGWeb.reformat_chan(c)
+ channel = if c = Map.get(params, "chan"), do: NolaWeb.reformat_chan(c)
render(conn, "prompt.html", network: network, channel: channel, prompt: prompt)
{:error, :not_found} ->
conn
diff --git a/lib/lsg_web/controllers/icecast_see_controller.ex b/lib/lsg_web/controllers/icecast_see_controller.ex
index 1eecca1..877ad4e 100644
--- a/lib/lsg_web/controllers/icecast_see_controller.ex
+++ b/lib/lsg_web/controllers/icecast_see_controller.ex
@@ -1,5 +1,5 @@
-defmodule LSGWeb.IcecastSseController do
- use LSGWeb, :controller
+defmodule NolaWeb.IcecastSseController do
+ use NolaWeb, :controller
require Logger
@ping_interval 20_000
@@ -11,13 +11,13 @@ defmodule LSGWeb.IcecastSseController do
|> send_chunked(200)
|> subscribe
|> send_sse_message("ping", "ping")
- |> send_sse_message("icecast", LSG.IcecastAgent.get)
+ |> send_sse_message("icecast", Nola.IcecastAgent.get)
|> sse_loop
end
def subscribe(conn) do
:timer.send_interval(@ping_interval, {:event, :ping})
- {:ok, _} = Registry.register(LSG.BroadcastRegistry, "icecast", [])
+ {:ok, _} = Registry.register(Nola.BroadcastRegistry, "icecast", [])
conn
end
diff --git a/lib/lsg_web/controllers/irc_auth_sse_controller.ex b/lib/lsg_web/controllers/irc_auth_sse_controller.ex
index f370d97..62ee2b5 100644
--- a/lib/lsg_web/controllers/irc_auth_sse_controller.ex
+++ b/lib/lsg_web/controllers/irc_auth_sse_controller.ex
@@ -1,5 +1,5 @@
-defmodule LSGWeb.IrcAuthSseController do
- use LSGWeb, :controller
+defmodule NolaWeb.IrcAuthSseController do
+ use NolaWeb, :controller
require Logger
@ping_interval 20_000
@@ -36,7 +36,7 @@ defmodule LSGWeb.IrcAuthSseController do
{:event, :expire} -> {"expire", "expire", true}
{:irc, :text, %{account: account, text: token} = m} ->
if String.downcase(String.trim(token)) == conn.assigns.token do
- path = LSG.AuthToken.new_path(account.id, conn.assigns.perks)
+ path = Nola.AuthToken.new_path(account.id, conn.assigns.perks)
m.replyfun.("ok!")
{"authenticated", path, true}
else
diff --git a/lib/lsg_web/controllers/irc_controller.ex b/lib/lsg_web/controllers/irc_controller.ex
index d518481..90d9853 100644
--- a/lib/lsg_web/controllers/irc_controller.ex
+++ b/lib/lsg_web/controllers/irc_controller.ex
@@ -1,11 +1,11 @@
-defmodule LSGWeb.IrcController do
- use LSGWeb, :controller
+defmodule NolaWeb.IrcController do
+ use NolaWeb, :controller
- plug LSGWeb.ContextPlug
+ plug NolaWeb.ContextPlug
def index(conn, params) do
network = Map.get(params, "network")
- channel = if c = Map.get(params, "chan"), do: LSGWeb.reformat_chan(c)
+ channel = if c = Map.get(params, "chan"), do: NolaWeb.reformat_chan(c)
commands = for mod <- Enum.uniq([IRC.Account.AccountPlugin] ++ IRC.Plugin.enabled()) do
if is_atom(mod) do
identifier = Module.split(mod) |> List.last |> String.replace("Plugin", "") |> Macro.underscore
@@ -42,7 +42,7 @@ defmodule LSGWeb.IrcController do
defp do_txt(conn, nil) do
- doc = LSG.IRC.TxtPlugin.irc_doc()
+ doc = Nola.IRC.TxtPlugin.irc_doc()
data = data()
main = Enum.filter(data, fn({trigger, _}) -> !String.contains?(trigger, ".") end) |> Enum.into(Map.new)
system = Enum.filter(data, fn({trigger, _}) -> String.contains?(trigger, ".") end) |> Enum.into(Map.new)
@@ -55,7 +55,7 @@ defmodule LSGWeb.IrcController do
defp do_txt(conn, txt) do
data = data()
base_url = cond do
- conn.assigns[:chan] -> "/#{conn.assigns.network}/#{LSGWeb.format_chan(conn.assigns.chan)}"
+ conn.assigns[:chan] -> "/#{conn.assigns.network}/#{NolaWeb.format_chan(conn.assigns.chan)}"
true -> "/-"
end
if lines = Map.get(data, txt) do
diff --git a/lib/lsg_web/controllers/network_controller.ex b/lib/lsg_web/controllers/network_controller.ex
index 537c2f6..800294f 100644
--- a/lib/lsg_web/controllers/network_controller.ex
+++ b/lib/lsg_web/controllers/network_controller.ex
@@ -1,6 +1,6 @@
-defmodule LSGWeb.NetworkController do
- use LSGWeb, :controller
- plug LSGWeb.ContextPlug
+defmodule NolaWeb.NetworkController do
+ use NolaWeb, :controller
+ plug NolaWeb.ContextPlug
def index(conn, %{"network" => network}) do
conn
diff --git a/lib/lsg_web/controllers/open_id_controller.ex b/lib/lsg_web/controllers/open_id_controller.ex
index d5af318..94166eb 100644
--- a/lib/lsg_web/controllers/open_id_controller.ex
+++ b/lib/lsg_web/controllers/open_id_controller.ex
@@ -1,6 +1,6 @@
-defmodule LSGWeb.OpenIdController do
- use LSGWeb, :controller
- plug LSGWeb.ContextPlug, restrict: :public
+defmodule NolaWeb.OpenIdController do
+ use NolaWeb, :controller
+ plug NolaWeb.ContextPlug, restrict: :public
require Logger
def login(conn, _) do
@@ -58,7 +58,7 @@ defmodule LSGWeb.OpenIdController do
site: config[:base_url],
authorize_url: config[:authorize_url],
token_url: config[:token_url],
- redirect_uri: Routes.open_id_url(LSGWeb.Endpoint, :callback)
+ redirect_uri: Routes.open_id_url(NolaWeb.Endpoint, :callback)
])
end
end
diff --git a/lib/lsg_web/controllers/page_controller.ex b/lib/lsg_web/controllers/page_controller.ex
index 94c9c70..2ac4d0a 100644
--- a/lib/lsg_web/controllers/page_controller.ex
+++ b/lib/lsg_web/controllers/page_controller.ex
@@ -1,12 +1,12 @@
-defmodule LSGWeb.PageController do
- use LSGWeb, :controller
+defmodule NolaWeb.PageController do
+ use NolaWeb, :controller
- plug LSGWeb.ContextPlug when action not in [:token]
- plug LSGWeb.ContextPlug, [restrict: :public] when action in [:token]
+ plug NolaWeb.ContextPlug when action not in [:token]
+ plug NolaWeb.ContextPlug, [restrict: :public] when action in [:token]
def token(conn, %{"token" => token}) do
with \
- {:ok, account, perks} <- LSG.AuthToken.lookup(token)
+ {:ok, account, perks} <- Nola.AuthToken.lookup(token)
do
IO.puts("Authenticated account #{inspect account}")
conn = put_session(conn, :account, account)
@@ -33,7 +33,7 @@ defmodule LSGWeb.PageController do
end
def irc(conn, _) do
- bot_helps = for mod <- LSG.IRC.env(:handlers) do
+ bot_helps = for mod <- Nola.IRC.env(:handlers) do
mod.irc_doc()
end
render conn, "irc.html", bot_helps: bot_helps
diff --git a/lib/lsg_web/controllers/sms_controller.ex b/lib/lsg_web/controllers/sms_controller.ex
index 00c6352..575655c 100644
--- a/lib/lsg_web/controllers/sms_controller.ex
+++ b/lib/lsg_web/controllers/sms_controller.ex
@@ -1,9 +1,9 @@
-defmodule LSGWeb.SmsController do
- use LSGWeb, :controller
+defmodule NolaWeb.SmsController do
+ use NolaWeb, :controller
require Logger
def ovh_callback(conn, %{"senderid" => from, "message" => message}) do
- spawn(fn() -> LSG.IRC.SmsPlugin.incoming(from, String.trim(message)) end)
+ spawn(fn() -> Nola.IRC.SmsPlugin.incoming(from, String.trim(message)) end)
text(conn, "")
end
diff --git a/lib/lsg_web/controllers/untappd_controller.ex b/lib/lsg_web/controllers/untappd_controller.ex
index 1c3ceb1..d3a540d 100644
--- a/lib/lsg_web/controllers/untappd_controller.ex
+++ b/lib/lsg_web/controllers/untappd_controller.ex
@@ -1,5 +1,5 @@
-defmodule LSGWeb.UntappdController do
- use LSGWeb, :controller
+defmodule NolaWeb.UntappdController do
+ use NolaWeb, :controller
def callback(conn, %{"code" => code}) do
with \
diff --git a/lib/lsg_web/endpoint.ex b/lib/lsg_web/endpoint.ex
index bfd53c8..d8bf962 100644
--- a/lib/lsg_web/endpoint.ex
+++ b/lib/lsg_web/endpoint.ex
@@ -1,4 +1,4 @@
-defmodule LSGWeb.Endpoint do
+defmodule NolaWeb.Endpoint do
use Sentry.PlugCapture
use Phoenix.Endpoint, otp_app: :lsg
@@ -43,7 +43,7 @@ defmodule LSGWeb.Endpoint do
# Set :encryption_salt if you would also like to encrypt it.
plug Plug.Session, @session_options
- plug LSGWeb.Router
+ plug NolaWeb.Router
@doc """
Callback invoked for dynamically configuring the endpoint.
diff --git a/lib/lsg_web/gettext.ex b/lib/lsg_web/gettext.ex
index f38a57d..e9a46e9 100644
--- a/lib/lsg_web/gettext.ex
+++ b/lib/lsg_web/gettext.ex
@@ -1,11 +1,11 @@
-defmodule LSGWeb.Gettext do
+defmodule NolaWeb.Gettext do
@moduledoc """
A module providing Internationalization with a gettext-based API.
By using [Gettext](https://hexdocs.pm/gettext),
your module gains a set of macros for translations, for example:
- import LSGWeb.Gettext
+ import NolaWeb.Gettext
# Simple translation
gettext "Here is the string to translate"
diff --git a/lib/lsg_web/live/chat_live.ex b/lib/lsg_web/live/chat_live.ex
index e84d880..276b362 100644
--- a/lib/lsg_web/live/chat_live.ex
+++ b/lib/lsg_web/live/chat_live.ex
@@ -1,10 +1,10 @@
-defmodule LSGWeb.ChatLive do
+defmodule NolaWeb.ChatLive do
use Phoenix.LiveView
use Phoenix.HTML
require Logger
def mount(%{"network" => network, "chan" => chan}, %{"account" => account_id}, socket) do
- chan = LSGWeb.reformat_chan(chan)
+ chan = NolaWeb.reformat_chan(chan)
connection = IRC.Connection.get_network(network, chan)
account = IRC.Account.get(account_id)
membership = IRC.Membership.of_account(IRC.Account.get("DRgpD4fLf8PDJMLp8Dtb"))
@@ -22,7 +22,7 @@ defmodule LSGWeb.ChatLive do
Map.put(acc, id, user)
end)
- backlog = case LSG.IRC.BufferPlugin.select_buffer(connection.network, chan) do
+ backlog = case Nola.IRC.BufferPlugin.select_buffer(connection.network, chan) do
{backlog, _} ->
{backlog, _} = Enum.reduce(backlog, {backlog, nil}, &reduce_contextual_event/2)
Enum.reverse(backlog)
diff --git a/lib/lsg_web/lsg_web.ex b/lib/lsg_web/lsg_web.ex
index 3d9ab9a..da622c7 100644
--- a/lib/lsg_web/lsg_web.ex
+++ b/lib/lsg_web/lsg_web.ex
@@ -1,12 +1,12 @@
-defmodule LSGWeb do
+defmodule NolaWeb do
@moduledoc """
The entrypoint for defining your web interface, such
as controllers, views, channels and so on.
This can be used in your application as:
- use LSGWeb, :controller
- use LSGWeb, :view
+ use NolaWeb, :controller
+ use NolaWeb, :view
The definitions below will be executed for every view,
controller, etc, so keep them short and clean, focused
@@ -45,18 +45,18 @@ defmodule LSGWeb do
def controller do
quote do
- use Phoenix.Controller, namespace: LSGWeb
+ use Phoenix.Controller, namespace: NolaWeb
import Plug.Conn
- import LSGWeb.Router.Helpers
- import LSGWeb.Gettext
- alias LSGWeb.Router.Helpers, as: Routes
+ import NolaWeb.Router.Helpers
+ import NolaWeb.Gettext
+ alias NolaWeb.Router.Helpers, as: Routes
end
end
def view do
quote do
use Phoenix.View, root: "lib/lsg_web/templates",
- namespace: LSGWeb
+ namespace: NolaWeb
# Import convenience functions from controllers
import Phoenix.Controller, only: [get_flash: 2, view_module: 1]
@@ -64,13 +64,13 @@ defmodule LSGWeb do
# Use all HTML functionality (forms, tags, etc)
use Phoenix.HTML
- import LSGWeb.Router.Helpers
- import LSGWeb.ErrorHelpers
- import LSGWeb.Gettext
+ import NolaWeb.Router.Helpers
+ import NolaWeb.ErrorHelpers
+ import NolaWeb.Gettext
import Phoenix.LiveView.Helpers
- alias LSGWeb.Router.Helpers, as: Routes
+ alias NolaWeb.Router.Helpers, as: Routes
end
end
@@ -86,7 +86,7 @@ defmodule LSGWeb do
def channel do
quote do
use Phoenix.Channel
- import LSGWeb.Gettext
+ import NolaWeb.Gettext
end
end
diff --git a/lib/lsg_web/router.ex b/lib/lsg_web/router.ex
index 5cc0d4a..5658fda 100644
--- a/lib/lsg_web/router.ex
+++ b/lib/lsg_web/router.ex
@@ -1,5 +1,5 @@
-defmodule LSGWeb.Router do
- use LSGWeb, :router
+defmodule NolaWeb.Router do
+ use NolaWeb, :router
pipeline :browser do
plug :accepts, ["html", "txt"]
@@ -8,7 +8,7 @@ defmodule LSGWeb.Router do
plug :fetch_live_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
- plug :put_root_layout, {LSGWeb.LayoutView, :root}
+ plug :put_root_layout, {NolaWeb.LayoutView, :root}
end
pipeline :api do
@@ -17,17 +17,17 @@ defmodule LSGWeb.Router do
pipeline :matrix_app_service do
plug :accepts, ["json"]
- plug LSG.Matrix.Plug.Auth
- plug LSG.Matrix.Plug.SetConfig
+ plug Nola.Matrix.Plug.Auth
+ plug Nola.Matrix.Plug.SetConfig
end
- scope "/api", LSGWeb do
+ scope "/api", NolaWeb do
pipe_through :api
get "/irc-auth.sse", IrcAuthSseController, :sse
post "/sms/callback/Ovh", SmsController, :ovh_callback, as: :sms
end
- scope "/", LSGWeb do
+ scope "/", NolaWeb do
pipe_through :browser
get "/", PageController, :index
diff --git a/lib/lsg_web/views/alcoolog_view.ex b/lib/lsg_web/views/alcoolog_view.ex
index ed3c9b4..ad52472 100644
--- a/lib/lsg_web/views/alcoolog_view.ex
+++ b/lib/lsg_web/views/alcoolog_view.ex
@@ -1,5 +1,5 @@
-defmodule LSGWeb.AlcoologView do
- use LSGWeb, :view
+defmodule NolaWeb.AlcoologView do
+ use NolaWeb, :view
require Integer
end
diff --git a/lib/lsg_web/views/error_helpers.ex b/lib/lsg_web/views/error_helpers.ex
index 47906f2..25214bd 100644
--- a/lib/lsg_web/views/error_helpers.ex
+++ b/lib/lsg_web/views/error_helpers.ex
@@ -1,4 +1,4 @@
-defmodule LSGWeb.ErrorHelpers do
+defmodule NolaWeb.ErrorHelpers do
@moduledoc """
Conveniences for translating and building error messages.
"""
@@ -32,9 +32,9 @@ defmodule LSGWeb.ErrorHelpers do
# dgettext "errors", "is invalid"
#
if count = opts[:count] do
- Gettext.dngettext(LSGWeb.Gettext, "errors", msg, msg, count, opts)
+ Gettext.dngettext(NolaWeb.Gettext, "errors", msg, msg, count, opts)
else
- Gettext.dgettext(LSGWeb.Gettext, "errors", msg, opts)
+ Gettext.dgettext(NolaWeb.Gettext, "errors", msg, opts)
end
end
end
diff --git a/lib/lsg_web/views/error_view.ex b/lib/lsg_web/views/error_view.ex
index 1a7a92d..5cad939 100644
--- a/lib/lsg_web/views/error_view.ex
+++ b/lib/lsg_web/views/error_view.ex
@@ -1,5 +1,5 @@
-defmodule LSGWeb.ErrorView do
- use LSGWeb, :view
+defmodule NolaWeb.ErrorView do
+ use NolaWeb, :view
def render("404.html", _assigns) do
"Page not found"
diff --git a/lib/lsg_web/views/irc_view.ex b/lib/lsg_web/views/irc_view.ex
index 36a9bc4..331d91f 100644
--- a/lib/lsg_web/views/irc_view.ex
+++ b/lib/lsg_web/views/irc_view.ex
@@ -1,3 +1,3 @@
-defmodule LSGWeb.IrcView do
- use LSGWeb, :view
+defmodule NolaWeb.IrcView do
+ use NolaWeb, :view
end
diff --git a/lib/lsg_web/views/layout_view.ex b/lib/lsg_web/views/layout_view.ex
index 720281d..2bffc6f 100644
--- a/lib/lsg_web/views/layout_view.ex
+++ b/lib/lsg_web/views/layout_view.ex
@@ -1,9 +1,9 @@
-defmodule LSGWeb.LayoutView do
- use LSGWeb, :view
+defmodule NolaWeb.LayoutView do
+ use NolaWeb, :view
def liquid_markdown(conn, text) do
context_path = cond do
- conn.assigns[:chan] -> "/#{conn.assigns[:network]}/#{LSGWeb.format_chan(conn.assigns[:chan])}"
+ conn.assigns[:chan] -> "/#{conn.assigns[:network]}/#{NolaWeb.format_chan(conn.assigns[:chan])}"
conn.assigns[:network] -> "/#{conn.assigns[:network]}/-"
true -> "/-"
end
@@ -24,7 +24,7 @@ defmodule LSGWeb.LayoutView do
conn.assigns[:chan] ->
"#{conn.assigns.chan} @ #{conn.assigns.network}"
conn.assigns[:network] -> conn.assigns.network
- true -> Keyword.get(LSG.name())
+ true -> Keyword.get(Nola.name())
end
breadcrumb_title = Enum.map(Map.get(conn.assigns, :breadcrumbs)||[], fn({title, _href}) -> title end)
diff --git a/lib/lsg_web/views/network_view.ex b/lib/lsg_web/views/network_view.ex
index c369ce6..7a24db1 100644
--- a/lib/lsg_web/views/network_view.ex
+++ b/lib/lsg_web/views/network_view.ex
@@ -1,4 +1,4 @@
-defmodule LSGWeb.NetworkView do
- use LSGWeb, :view
+defmodule NolaWeb.NetworkView do
+ use NolaWeb, :view
end
diff --git a/lib/lsg_web/views/open_id_view.ex b/lib/lsg_web/views/open_id_view.ex
index 64d4430..bd8089b 100644
--- a/lib/lsg_web/views/open_id_view.ex
+++ b/lib/lsg_web/views/open_id_view.ex
@@ -1,4 +1,4 @@
-defmodule LSGWeb.OpenIdView do
- use LSGWeb, :view
+defmodule NolaWeb.OpenIdView do
+ use NolaWeb, :view
end
diff --git a/lib/lsg_web/views/page_view.ex b/lib/lsg_web/views/page_view.ex
index 90c384c..1bfaadd 100644
--- a/lib/lsg_web/views/page_view.ex
+++ b/lib/lsg_web/views/page_view.ex
@@ -1,3 +1,3 @@
-defmodule LSGWeb.PageView do
- use LSGWeb, :view
+defmodule NolaWeb.PageView do
+ use NolaWeb, :view
end