Page MenuHomePhabricator

No OneTemporary

diff --git a/lib/irc.ex b/lib/irc.ex
index 0fa1b79..8d04d50 100644
--- a/lib/irc.ex
+++ b/lib/irc.ex
@@ -1,49 +1,49 @@
defmodule Nola.Irc do
require Logger
def env(), do: Nola.env(:irc)
def env(key, default \\ nil), do: Keyword.get(env(), key, default)
def send_message_as(account, network, channel, text, force_puppet \\ false) do
connection = Nola.Irc.Connection.get_network(network)
if connection && (force_puppet || Nola.Irc.PuppetConnection.whereis(account, connection)) do
Nola.Irc.PuppetConnection.start_and_send_message(account, connection, channel, text)
else
user = Nola.UserTrack.find_by_account(network, account)
nick = if(user, do: user.nick, else: account.name)
Nola.Irc.Connection.broadcast_message(network, channel, "<#{nick}> #{text}")
end
end
- def admin?(%Message{sender: sender}), do: admin?(sender)
+ def admin?(%Nola.Message{sender: sender}), do: admin?(sender)
def admin?(%{nick: nick, user: user, host: host}) do
for {n, u, h} <- Nola.Irc.env(:admins, []) do
admin_part_match?(n, nick) && admin_part_match?(u, user) && admin_part_match?(h, host)
end
|> Enum.any?
end
defp admin_part_match?(:_, _), do: true
defp admin_part_match?(a, a), do: true
defp admin_part_match?(_, _), do: false
def application_childs do
import Supervisor.Spec
Nola.Irc.Connection.setup()
[
worker(Registry, [[keys: :duplicate, name: Nola.Irc.ConnectionPubSub]], id: :registr_irc_conn),
supervisor(Nola.Irc.Connection.Supervisor, [], [name: Nola.Irc.Connection.Supervisor]),
supervisor(Nola.Irc.PuppetConnection.Supervisor, [], [name: Nola.Irc.PuppetConnection.Supervisor]),
]
end
# Start plugins first to let them get on connection events.
def after_start() do
Logger.info("Starting connections")
Nola.Irc.Connection.start_all()
end
end
diff --git a/lib/nola.ex b/lib/nola.ex
index 18e5ddd..51c2150 100644
--- a/lib/nola.ex
+++ b/lib/nola.ex
@@ -1,30 +1,30 @@
defmodule Nola do
@default_brand [
- name: "Nola,
+ name: "Nola",
source_url: "https://phab.random.sh/source/Nola/",
owner: "Ashamed owner",
owner_email: "contact@my.nola.bot"
]
def env(), do: Application.get_env(:nola)
def env(key, default \\ nil), do: Application.get_env(:nola, key, default)
def brand(), do: env(:brand, @default_brand)
def brand(key), do: Keyword.get(brand(), key)
def name(), do: brand(:name)
def source_url(), do: brand(:source_url)
def data_path(suffix) do
Path.join(data_path(), suffix)
end
def data_path do
Application.get_env(:nola, :data_path)
end
def version do
Application.spec(:nola)[:vsn]
end
end
diff --git a/lib/nola/message.ex b/lib/nola/message.ex
index 4ceb9b9..b4e76da 100644
--- a/lib/nola/message.ex
+++ b/lib/nola/message.ex
@@ -1,23 +1,23 @@
-defmodule Message do
+defmodule Nola.Message do
@moduledoc """
Well, a message!
"""
@derive {Poison.Encoder, except: [:replyfun]}
defstruct [
:id,
:text,
{:transport, :irc},
:network,
:account,
:sender,
:channel,
:trigger,
:replyfun,
:at,
{:meta, %{}}
]
end
diff --git a/lib/nola/trigger.ex b/lib/nola/trigger.ex
index b6502c3..1dec9ac 100644
--- a/lib/nola/trigger.ex
+++ b/lib/nola/trigger.ex
@@ -1,12 +1,12 @@
-defmodule Trigger do
+defmodule Nola.Trigger do
@moduledoc "A `Nola.Message` parsed command/trigger."
@derive Poison.Encoder
defstruct [
:type,
:trigger,
:args
]
end
diff --git a/mix.exs b/mix.exs
index 2fd32d0..54af7a8 100644
--- a/mix.exs
+++ b/mix.exs
@@ -1,98 +1,106 @@
defmodule Nola.Mixfile do
use Mix.Project
def project do
[
app: :nola,
version: version("0.2.7"),
elixir: "~> 1.4",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
start_permanent: Mix.env == :prod,
deps: deps()
]
end
def application do
[
mod: {LSG.Application, []},
extra_applications: [:logger, :runtime_tools]
]
end
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
defp aliases do
[
"assets.deploy": ["make -C assets", "phx.digest"]
]
end
defp deps do
[
{:phoenix, "~> 1.6.0-rc.0", override: true},
{:phoenix_pubsub, "~> 2.0"},
{:phoenix_live_reload, "~> 1.0", only: :dev},
{:phoenix_html, "~> 3.0"},
{:phoenix_live_view, "~> 0.16.0"},
{:phoenix_live_dashboard, "~> 0.5"},
{:telemetry, "~> 1.0.0", override: true},
{:telemetry_metrics, "~> 0.6"},
{:telemetry_poller, "~> 0.5"},
{:plug_cowboy, "~> 2.0"},
{:cowlib, "~> 2.9.1", override: true},
{:plug, "~> 1.7"},
{:gettext, "~> 0.11"},
{:httpoison, "~> 1.8", override: true},
{:jason, "~> 1.0"},
{:poison, "~> 4.0", override: true},
{:floki, "~> 0.19.3"},
{:ecto, "~> 3.4"},
{:exirc, git: "https://git.random.sh/ircbot/exirc.git", branch: "fix-who-nick"},
{:distillery, "~> 2.0"},
{:earmark, "~> 1.2"},
{:oauther, "~> 1.1"},
{:extwitter, "~> 0.14.0"},
{:entropy_string, "~> 1.0.0"},
{:abacus, "~> 0.3.3"},
{:ex_chain, github: "eljojo/ex_chain"},
{:timex, "~> 3.6"},
{:muontrap, "~> 0.5.1"},
{:tzdata, "~> 1.0"},
{:nimble_csv, "~> 0.7.0"},
{:backoff, git: "https://github.com/ferd/backoff", branch: "master"},
{:telegram, git: "https://github.com/hrefhref/telegram.git", branch: "master"},
{:ex_aws, "~> 2.0"},
{:ex_aws_s3, "~> 2.0"},
{:gen_magic, git: "https://github.com/hrefhref/gen_magic", branch: "develop"},
{:liquex, "~> 0.3"},
{:html_entities, "0.4.0", override: true},
{:file_size, "~> 3.0"},
{:ex2ms, "~> 1.0"},
{:polyjuice_client, git: "https://git.random.sh/ircbot/polyjuice_client.git", branch: "master", override: true},
{:matrix_app_service, git: "https://git.random.sh/ircbot/matrix_app_service.ex.git", branch: "master"},
{:sentry, "~> 8.0.5"},
{:logger_json, "~> 4.3"},
{:oauth2, "~> 2.0"},
{:powerdnsex, git: "https://git.random.sh/ircbot/powerdnsex.git", branch: "master"},
{:pfx, "~> 0.7.0"},
{:flake_id, "~> 0.1.0"}
]
end
defp version(v) do
{describe, 0} = System.cmd("git", ~w(describe --dirty --broken --all --tags --long))
+
[_, rest] = String.split(describe, "/", parts: 2)
- info = String.trim(rest)
+ info = rest
+ |> String.trim()
+ |> String.replace("/", "-")
+
env = cond do
Mix.env() == :prod -> ""
true -> "." <> to_string(Mix.env())
end
- #build_date_tag = Timex.format!(DateTime.utc_now(), ".build%y%m%d@%H%M", :strftime)
- build_date_tag = ".build"
+
+ build_timestamp = DateTime.utc_now()
+ |> DateTime.to_unix()
+ |> to_string()
+
+ build_date_tag = ".build" <> build_timestamp
v <> "+" <> info <> env <> build_date_tag
end
end

File Metadata

Mime Type
text/x-diff
Expires
Fri, Mar 14, 4:13 PM (1 d, 17 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33593
Default Alt Text
(7 KB)

Event Timeline