From a778f5a61fcb8b144c63d3ab8780da461db642cf Mon Sep 17 00:00:00 2001 From: shibao Date: Sat, 25 Feb 2023 15:47:37 -0500 Subject: [PATCH] rename to cannery --- .drone.yml | 8 +- .gitignore | 2 +- contributing.md => CONTRIBUTING.md | 16 +- Dockerfile | 4 +- readme.md => README.md | 22 +- assets/js/app.js | 2 +- config/config.exs | 22 +- config/dev.exs | 10 +- config/prod.exs | 6 +- config/runtime.exs | 24 +- config/test.exs | 10 +- docker-compose.yml | 22 +- lib/{lokal.ex => cannery.ex} | 4 +- lib/{lokal => cannery}/accounts.ex | 8 +- lib/{lokal => cannery}/accounts/email.ex | 24 +- .../accounts/email_worker.ex | 4 +- lib/{lokal => cannery}/accounts/invite.ex | 4 +- lib/{lokal => cannery}/accounts/invites.ex | 6 +- lib/{lokal => cannery}/accounts/user.ex | 10 +- .../accounts/user_notifier.ex | 2 +- lib/{lokal => cannery}/accounts/user_token.ex | 4 +- lib/{lokal => cannery}/application.ex | 24 +- lib/{lokal => cannery}/logger.ex | 2 +- lib/{lokal => cannery}/mailer.ex | 6 +- lib/{lokal => cannery}/release.ex | 4 +- lib/{lokal => cannery}/repo.ex | 4 +- lib/{lokal => cannery}/repo/migrator.ex | 8 +- lib/{lokal_web.ex => cannery_web.ex} | 26 +-- .../components/invite_card.ex | 8 +- .../components/table_component.ex | 4 +- .../components/table_component.html.heex | 0 .../components/topbar.ex | 10 +- .../components/user_card.ex | 4 +- .../controllers/email_controller.ex | 10 +- .../controllers/home_controller.ex | 4 +- .../controllers/user_auth.ex | 14 +- .../user_confirmation_controller.ex | 8 +- .../user_registration_controller.ex | 10 +- .../user_reset_password_controller.ex | 6 +- .../controllers/user_session_controller.ex | 8 +- .../controllers/user_settings_controller.ex | 10 +- lib/{lokal_web => cannery_web}/endpoint.ex | 12 +- lib/{lokal_web => cannery_web}/gettext.ex | 6 +- .../live/home_live.ex | 8 +- .../live/home_live.html.heex | 16 +- .../live/init_assigns.ex | 4 +- .../live/invite_live/form_component.ex | 8 +- .../live/invite_live/form_component.html.heex | 0 .../live/invite_live/index.ex | 14 +- .../live/invite_live/index.html.heex | 4 +- .../live/live_helpers.ex | 2 +- lib/{lokal_web => cannery_web}/router.ex | 22 +- lib/{lokal_web => cannery_web}/telemetry.ex | 14 +- .../templates/email/confirm_email.html.heex | 4 +- .../templates/email/confirm_email.txt.eex | 2 +- .../templates/email/reset_password.html.heex | 2 +- .../templates/email/reset_password.txt.eex | 0 .../templates/email/update_email.html.heex | 2 +- .../templates/email/update_email.txt.eex | 0 .../templates/error/error.html.heex | 5 +- .../templates/layout/app.html.heex | 3 +- .../templates/layout/email.html.heex | 2 +- .../templates/layout/email.txt.eex | 2 +- .../templates/layout/empty.html.heex | 0 .../templates/layout/live.html.heex | 3 +- .../templates/layout/root.html.heex | 4 +- .../templates/user_confirmation/new.html.heex | 0 .../templates/user_registration/new.html.heex | 0 .../user_reset_password/edit.html.heex | 0 .../user_reset_password/new.html.heex | 0 .../templates/user_session/new.html.heex | 0 .../templates/user_settings/edit.html.heex | 0 lib/cannery_web/views/email_view.ex | 7 + .../views/error_helpers.ex | 6 +- .../views/error_view.ex | 7 +- lib/cannery_web/views/home_view.ex | 3 + .../views/layout_view.ex | 11 +- .../views/user_confirmation_view.ex | 4 + .../views/user_registration_view.ex | 3 + .../views/user_reset_password_view.ex | 4 + lib/cannery_web/views/user_session_view.ex | 4 + lib/cannery_web/views/user_settings_view.ex | 3 + .../views/view_helpers.ex | 4 +- lib/lokal_web/views/email_view.ex | 7 - lib/lokal_web/views/home_view.ex | 3 - lib/lokal_web/views/user_confirmation_view.ex | 4 - lib/lokal_web/views/user_registration_view.ex | 3 - .../views/user_reset_password_view.ex | 4 - lib/lokal_web/views/user_session_view.ex | 4 - lib/lokal_web/views/user_settings_view.ex | 3 - mix.exs | 12 +- priv/gettext/actions.pot | 122 +++++------ priv/gettext/default.pot | 206 +++++++++--------- priv/gettext/emails.pot | 114 +++++----- priv/gettext/en/LC_MESSAGES/actions.po | 122 +++++------ priv/gettext/en/LC_MESSAGES/default.po | 206 +++++++++--------- priv/gettext/en/LC_MESSAGES/emails.po | 114 +++++----- priv/gettext/en/LC_MESSAGES/errors.po | 80 +++---- priv/gettext/en/LC_MESSAGES/prompts.po | 74 +++---- priv/gettext/errors.pot | 80 +++---- priv/gettext/prompts.pot | 74 +++---- ...0210814225804_create_users_auth_tables.exs | 2 +- .../20210904211727_create_invites.exs | 2 +- .../migrations/20220213042345_add_oban.exs | 2 +- .../20220505233700_add_locale_setting.exs | 2 +- .../20230204191547_record_invites.exs | 2 +- priv/repo/seeds.exs | 2 +- .../accounts/invites_test.exs | 10 +- test/{lokal => cannery}/accounts_test.exs | 8 +- .../controllers/home_controller_test.exs | 6 +- .../controllers/user_auth_test.exs | 16 +- .../user_confirmation_controller_test.exs | 8 +- .../user_registration_controller_test.exs | 6 +- .../user_reset_password_controller_test.exs | 8 +- .../user_session_controller_test.exs | 8 +- .../user_settings_controller_test.exs | 8 +- .../live/invite_live_test.exs | 8 +- test/cannery_web/live/page_live_test.exs | 11 + .../views/error_view_test.exs | 10 +- test/cannery_web/views/home_view_test.exs | 3 + .../views/layout_view_test.exs | 4 +- test/lokal_web/live/page_live_test.exs | 11 - test/lokal_web/views/home_view_test.exs | 3 - test/support/channel_case.ex | 10 +- test/support/conn_case.ex | 20 +- test/support/data_case.ex | 10 +- test/support/fixtures.ex | 4 +- test/test_helper.exs | 2 +- 128 files changed, 999 insertions(+), 998 deletions(-) rename contributing.md => CONTRIBUTING.md (89%) rename readme.md => README.md (73%) rename lib/{lokal.ex => cannery.ex} (70%) rename lib/{lokal => cannery}/accounts.ex (98%) rename lib/{lokal => cannery}/accounts/email.ex (61%) rename lib/{lokal => cannery}/accounts/email_worker.ex (81%) rename lib/{lokal => cannery}/accounts/invite.ex (96%) rename lib/{lokal => cannery}/accounts/invites.ex (98%) rename lib/{lokal => cannery}/accounts/user.ex (97%) rename lib/{lokal => cannery}/accounts/user_notifier.ex (97%) rename lib/{lokal => cannery}/accounts/user_token.ex (98%) rename lib/{lokal => cannery}/application.ex (69%) rename lib/{lokal => cannery}/logger.ex (98%) rename lib/{lokal => cannery}/mailer.ex (91%) rename lib/{lokal => cannery}/release.ex (92%) rename lib/{lokal => cannery}/repo.ex (53%) rename lib/{lokal => cannery}/repo/migrator.ex (58%) rename lib/{lokal_web.ex => cannery_web.ex} (79%) rename lib/{lokal_web => cannery_web}/components/invite_card.ex (93%) rename lib/{lokal_web => cannery_web}/components/table_component.ex (97%) rename lib/{lokal_web => cannery_web}/components/table_component.html.heex (100%) rename lib/{lokal_web => cannery_web}/components/topbar.ex (94%) rename lib/{lokal_web => cannery_web}/components/user_card.ex (94%) rename lib/{lokal_web => cannery_web}/controllers/email_controller.ex (63%) rename lib/{lokal_web => cannery_web}/controllers/home_controller.ex (64%) rename lib/{lokal_web => cannery_web}/controllers/user_auth.ex (94%) rename lib/{lokal_web => cannery_web}/controllers/user_confirmation_controller.ex (92%) rename lib/{lokal_web => cannery_web}/controllers/user_registration_controller.ex (92%) rename lib/{lokal_web => cannery_web}/controllers/user_reset_password_controller.ex (94%) rename lib/{lokal_web => cannery_web}/controllers/user_session_controller.ex (82%) rename lib/{lokal_web => cannery_web}/controllers/user_settings_controller.ex (95%) rename lib/{lokal_web => cannery_web}/endpoint.ex (86%) rename lib/{lokal_web => cannery_web}/gettext.ex (86%) rename lib/{lokal_web => cannery_web}/live/home_live.ex (73%) rename lib/{lokal_web => cannery_web}/live/home_live.html.heex (87%) rename lib/{lokal_web => cannery_web}/live/init_assigns.ex (88%) rename lib/{lokal_web => cannery_web}/live/invite_live/form_component.ex (92%) rename lib/{lokal_web => cannery_web}/live/invite_live/form_component.html.heex (100%) rename lib/{lokal_web => cannery_web}/live/invite_live/index.ex (94%) rename lib/{lokal_web => cannery_web}/live/invite_live/index.html.heex (97%) rename lib/{lokal_web => cannery_web}/live/live_helpers.ex (98%) rename lib/{lokal_web => cannery_web}/router.ex (86%) rename lib/{lokal_web => cannery_web}/telemetry.ex (90%) rename lib/{lokal_web => cannery_web}/templates/email/confirm_email.html.heex (77%) rename lib/{lokal_web => cannery_web}/templates/email/confirm_email.txt.eex (86%) rename lib/{lokal_web => cannery_web}/templates/email/reset_password.html.heex (93%) rename lib/{lokal_web => cannery_web}/templates/email/reset_password.txt.eex (100%) rename lib/{lokal_web => cannery_web}/templates/email/update_email.html.heex (86%) rename lib/{lokal_web => cannery_web}/templates/email/update_email.txt.eex (100%) rename lib/{lokal_web => cannery_web}/templates/error/error.html.heex (83%) rename lib/{lokal_web => cannery_web}/templates/layout/app.html.heex (79%) rename lib/{lokal_web => cannery_web}/templates/layout/email.html.heex (87%) rename lib/{lokal_web => cannery_web}/templates/layout/email.txt.eex (64%) rename lib/{lokal_web => cannery_web}/templates/layout/empty.html.heex (100%) rename lib/{lokal_web => cannery_web}/templates/layout/live.html.heex (90%) rename lib/{lokal_web => cannery_web}/templates/layout/root.html.heex (85%) rename lib/{lokal_web => cannery_web}/templates/user_confirmation/new.html.heex (100%) rename lib/{lokal_web => cannery_web}/templates/user_registration/new.html.heex (100%) rename lib/{lokal_web => cannery_web}/templates/user_reset_password/edit.html.heex (100%) rename lib/{lokal_web => cannery_web}/templates/user_reset_password/new.html.heex (100%) rename lib/{lokal_web => cannery_web}/templates/user_session/new.html.heex (100%) rename lib/{lokal_web => cannery_web}/templates/user_settings/edit.html.heex (100%) create mode 100644 lib/cannery_web/views/email_view.ex rename lib/{lokal_web => cannery_web}/views/error_helpers.ex (93%) rename lib/{lokal_web => cannery_web}/views/error_view.ex (73%) create mode 100644 lib/cannery_web/views/home_view.ex rename lib/{lokal_web => cannery_web}/views/layout_view.ex (62%) create mode 100644 lib/cannery_web/views/user_confirmation_view.ex create mode 100644 lib/cannery_web/views/user_registration_view.ex create mode 100644 lib/cannery_web/views/user_reset_password_view.ex create mode 100644 lib/cannery_web/views/user_session_view.ex create mode 100644 lib/cannery_web/views/user_settings_view.ex rename lib/{lokal_web => cannery_web}/views/view_helpers.ex (95%) delete mode 100644 lib/lokal_web/views/email_view.ex delete mode 100644 lib/lokal_web/views/home_view.ex delete mode 100644 lib/lokal_web/views/user_confirmation_view.ex delete mode 100644 lib/lokal_web/views/user_registration_view.ex delete mode 100644 lib/lokal_web/views/user_reset_password_view.ex delete mode 100644 lib/lokal_web/views/user_session_view.ex delete mode 100644 lib/lokal_web/views/user_settings_view.ex rename test/{lokal => cannery}/accounts/invites_test.exs (97%) rename test/{lokal => cannery}/accounts_test.exs (99%) rename test/{lokal_web => cannery_web}/controllers/home_controller_test.exs (54%) rename test/{lokal_web => cannery_web}/controllers/user_auth_test.exs (94%) rename test/{lokal_web => cannery_web}/controllers/user_confirmation_controller_test.exs (96%) rename test/{lokal_web => cannery_web}/controllers/user_registration_controller_test.exs (92%) rename test/{lokal_web => cannery_web}/controllers/user_reset_password_controller_test.exs (96%) rename test/{lokal_web => cannery_web}/controllers/user_session_controller_test.exs (94%) rename test/{lokal_web => cannery_web}/controllers/user_settings_controller_test.exs (97%) rename test/{lokal_web => cannery_web}/live/invite_live_test.exs (95%) create mode 100644 test/cannery_web/live/page_live_test.exs rename test/{lokal_web => cannery_web}/views/error_view_test.exs (58%) create mode 100644 test/cannery_web/views/home_view_test.exs rename test/{lokal_web => cannery_web}/views/layout_view_test.exs (71%) delete mode 100644 test/lokal_web/live/page_live_test.exs delete mode 100644 test/lokal_web/views/home_view_test.exs diff --git a/.drone.yml b/.drone.yml index 037f8ab..5fa686e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,6 +1,6 @@ kind: pipeline type: docker -name: lokal +name: cannery steps: - name: restore-cache @@ -19,7 +19,7 @@ steps: - name: test image: elixir:1.14.1-alpine environment: - TEST_DATABASE_URL: ecto://postgres:postgres@database/lokal_test + TEST_DATABASE_URL: ecto://postgres:postgres@database/cannery_test HOST: testing.example.tld MIX_HOME: /drone/src/.mix MIX_ARCHIVES: /drone/src/.mix/archives @@ -39,7 +39,7 @@ steps: image: thegeeklab/drone-docker-buildx privileged: true settings: - repo: shibaobun/lokal + repo: shibaobun/cannery purge: true compress: true platforms: linux/amd64,linux/arm/v7 @@ -56,7 +56,7 @@ steps: image: thegeeklab/drone-docker-buildx privileged: true settings: - repo: shibaobun/lokal + repo: shibaobun/cannery purge: true compress: true platforms: linux/amd64,linux/arm/v7 diff --git a/.gitignore b/.gitignore index 4f6ce1e..5c54ee4 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,7 @@ erl_crash.dump *.ez # Ignore package tarball (built via "mix hex.build"). -lokal-*.tar +cannery-*.tar # If NPM crashes, it generates a log, let's ignore it too. npm-debug.log diff --git a/contributing.md b/CONTRIBUTING.md similarity index 89% rename from contributing.md rename to CONTRIBUTING.md index 7ffed2f..25ee8c1 100644 --- a/contributing.md +++ b/CONTRIBUTING.md @@ -77,21 +77,21 @@ Check them out! For development, I recommend setting environment variables with [direnv](https://direnv.net). -By default, Lokal will always bind to all external IPv4 and IPv6 addresses in +By default, Cannery will always bind to all external IPv4 and IPv6 addresses in `dev` and `prod` mode, respectively. If you would like to use different values, they will need to be overridden in `config/dev.exs` and `config/runtime.exs` for `dev` and `prod` modes, respectively. ## `MIX_ENV=dev` -In `dev` mode, Lokal will listen for these environment variables at runtime. +In `dev` mode, Cannery will listen for these environment variables at runtime. - `HOST`: External url to generate links with. Set this especially if you're behind a reverse proxy. Defaults to `localhost`. External URLs will always be generated with `https://` and port `443`. - `PORT`: Internal port to bind to. Defaults to `4000`. - `DATABASE_URL`: Controls the database url to connect to. Defaults to - `ecto://postgres:postgres@localhost/lokal_dev`. + `ecto://postgres:postgres@localhost/cannery_dev`. - `ECTO_IPV6`: Controls if Ecto should use IPv6 to connect to PostgreSQL. Defaults to `false`. - `POOL_SIZE`: Controls the pool size to use with PostgreSQL. Defaults to `10`. @@ -100,20 +100,20 @@ In `dev` mode, Lokal will listen for these environment variables at runtime. ## `MIX_ENV=test` -In `test` mode (or in the Docker container), Lokal will listen for the same environment variables as dev mode, but also include the following at runtime: +In `test` mode (or in the Docker container), Cannery will listen for the same environment variables as dev mode, but also include the following at runtime: - `TEST_DATABASE_URL`: REPLACES `DATABASE_URL`. Controls the database url to - connect to. Defaults to `ecto://postgres:postgres@localhost/lokal_test`. + connect to. Defaults to `ecto://postgres:postgres@localhost/cannery_test`. - `MIX_TEST_PARTITION`: Only used if `TEST_DATABASE_URL` is not specified. Appended to the default database url if you would like to partition your test databases. Defaults to not set. ## `MIX_ENV=prod` -In `prod` mode (or in the Docker container), Lokal will listen for the same environment variables as dev mode, but also include the following at runtime: +In `prod` mode (or in the Docker container), Cannery will listen for the same environment variables as dev mode, but also include the following at runtime: - `SECRET_KEY_BASE`: Secret key base used to sign cookies. Must be generated - with `docker run -it shibaobun/lokal mix phx.gen.secret` and set for server to start. + with `docker run -it shibaobun/cannery mix phx.gen.secret` and set for server to start. - `SMTP_HOST`: The url for your SMTP email provider. Must be set - `SMTP_PORT`: The port for your SMTP relay. Defaults to `587`. - `SMTP_USERNAME`: The username for your SMTP relay. Must be set! @@ -121,4 +121,4 @@ In `prod` mode (or in the Docker container), Lokal will listen for the same envi - `SMTP_SSL`: Set to `true` to enable SSL for emails. Defaults to `false`. - `EMAIL_FROM`: Sets the sender email in sent emails. Defaults to `no-reply@HOST` where `HOST` was previously defined. -- `EMAIL_NAME`: Sets the sender name in sent emails. Defaults to "Lokal". +- `EMAIL_NAME`: Sets the sender name in sent emails. Defaults to "Cannery". diff --git a/Dockerfile b/Dockerfile index 80d8b66..3c28a3e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,10 +45,10 @@ RUN chown nobody:nobody /app USER nobody:nobody -COPY --from=build --chown=nobody:nobody /app/_build/prod/rel/lokal ./ +COPY --from=build --chown=nobody:nobody /app/_build/prod/rel/cannery ./ COPY --from=build --chown=nobody:nobody /app/priv /app/priv RUN chmod +x /app/priv/random.sh ENV HOME=/app -CMD ["bin/lokal", "start"] +CMD ["bin/cannery", "start"] diff --git a/readme.md b/README.md similarity index 73% rename from readme.md rename to README.md index 5f71063..1d2606f 100644 --- a/readme.md +++ b/README.md @@ -1,6 +1,6 @@ -# Lokal +# Cannery -Lokal is a local business aggregation site helping you to shop locally by +Cannery is a local business aggregation site helping you to shop locally by providing a one-stop-shop for your local community. Set your profile and start shopping today! @@ -15,10 +15,10 @@ shopping today! # Installation 1. Install [Docker Compose](https://docs.docker.com/compose/install/) or alternatively [Docker Desktop](https://docs.docker.com/desktop/) on your machine. -1. Copy the example [docker-compose.yml](https://gitea.bubbletea.dev/shibao/lokal/src/branch/stable/docker-compose.yml). into your local machine where you want. +1. Copy the example [docker-compose.yml](https://gitea.bubbletea.dev/shibao/cannery/src/branch/stable/docker-compose.yml). into your local machine where you want. Bind mounts are created in the same directory by default. 1. Set the configuration variables in `docker-compose.yml`. You'll need to run - `docker run -it shibaobun/lokal /app/priv/random.sh` to generate a new + `docker run -it shibaobun/cannery /app/priv/random.sh` to generate a new secret key base. 1. Use `docker-compose up` or `docker-compose up -d` to start the container! @@ -26,19 +26,19 @@ The first created user will be created as an admin. # Configuration -You can use the following environment variables to configure Lokal in -[docker-compose.yml](https://gitea.bubbletea.dev/shibao/lokal/src/branch/stable/docker-compose.yml). +You can use the following environment variables to configure Cannery in +[docker-compose.yml](https://gitea.bubbletea.dev/shibao/cannery/src/branch/stable/docker-compose.yml). - `HOST`: External url to generate links with. Must be set with your hosted - domain name! I.e. `lokal.mywebsite.tld` + domain name! I.e. `cannery.mywebsite.tld` - `PORT`: Internal port to bind to. Defaults to `4000`. Must be reverse proxied! - `DATABASE_URL`: Controls the database url to connect to. Defaults to - `ecto://postgres:postgres@lokal-db/lokal`. + `ecto://postgres:postgres@cannery-db/cannery`. - `ECTO_IPV6`: If set to `true`, Ecto should use ipv6 to connect to PostgreSQL. Defaults to `false`. - `POOL_SIZE`: Controls the pool size to use with PostgreSQL. Defaults to `10`. - `SECRET_KEY_BASE`: Secret key base used to sign cookies. Must be generated - with `docker run -it shibaobun/lokal mix phx.gen.secret` and set for server to start. + with `docker run -it shibaobun/cannery mix phx.gen.secret` and set for server to start. - `REGISTRATION`: Controls if user sign-up should be invite only or set to public. Set to `public` to enable public registration. Defaults to `invite`. - `LOCALE`: Sets a custom default locale. Defaults to `en_US`. @@ -49,9 +49,9 @@ You can use the following environment variables to configure Lokal in - `SMTP_SSL`: Set to `true` to enable SSL for emails. Defaults to `false`. - `EMAIL_FROM`: Sets the sender email in sent emails. Defaults to `no-reply@HOST` where `HOST` was previously defined. -- `EMAIL_NAME`: Sets the sender name in sent emails. Defaults to "Lokal". +- `EMAIL_NAME`: Sets the sender name in sent emails. Defaults to "Cannery". --- [![Build -Status](https://drone.bubbletea.dev/api/badges/shibao/lokal/status.svg?ref=refs/heads/dev)](https://drone.bubbletea.dev/shibao/lokal) +Status](https://drone.bubbletea.dev/api/badges/shibao/cannery/status.svg?ref=refs/heads/dev)](https://drone.bubbletea.dev/shibao/cannery) diff --git a/assets/js/app.js b/assets/js/app.js index bb1b470..efba3d0 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -60,7 +60,7 @@ liveSocket.connect() window.liveSocket = liveSocket // Copy to clipboard -window.addEventListener('lokal:clipcopy', (event) => { +window.addEventListener('cannery:clipcopy', (event) => { if ('clipboard' in navigator) { const text = event.target.textContent navigator.clipboard.writeText(text) diff --git a/config/config.exs b/config/config.exs index 2f42758..ae084c7 100644 --- a/config/config.exs +++ b/config/config.exs @@ -7,24 +7,24 @@ # General application configuration import Config -config :lokal, - ecto_repos: [Lokal.Repo], +config :cannery, + ecto_repos: [Cannery.Repo], generators: [binary_id: true] -config :lokal, Lokal.Accounts, registration: System.get_env("REGISTRATION", "invite") +config :cannery, Cannery.Accounts, registration: System.get_env("REGISTRATION", "invite") # Configures the endpoint -config :lokal, LokalWeb.Endpoint, +config :cannery, CanneryWeb.Endpoint, url: [scheme: "https", host: System.get_env("HOST") || "localhost", port: "443"], http: [port: String.to_integer(System.get_env("PORT") || "4000")], secret_key_base: "KH59P0iZixX5gP/u+zkxxG8vAAj6vgt0YqnwEB5JP5K+E567SsqkCz69uWShjE7I", - render_errors: [view: LokalWeb.ErrorView, accepts: ~w(html json), layout: false], - pubsub_server: Lokal.PubSub, + render_errors: [view: CanneryWeb.ErrorView, accepts: ~w(html json), layout: false], + pubsub_server: Cannery.PubSub, live_view: [signing_salt: "zOLgd3lr"] -config :lokal, Lokal.Application, automigrate: false +config :cannery, Cannery.Application, automigrate: false -config :lokal, :generators, +config :cannery, :generators, migration: true, binary_id: true, sample_binary_id: "11111111-1111-1111-1111-111111111111" @@ -36,7 +36,7 @@ config :lokal, :generators, # # For production it's recommended to configure a different adapter # at the `config/runtime.exs`. -config :lokal, Lokal.Mailer, adapter: Swoosh.Adapters.Local +config :cannery, Cannery.Mailer, adapter: Swoosh.Adapters.Local # Swoosh API client is needed for adapters other than SMTP. config :swoosh, :api_client, false @@ -45,8 +45,8 @@ config :swoosh, :api_client, false config :gettext, :default_locale, "en_US" # Configure Oban -config :lokal, Oban, - repo: Lokal.Repo, +config :cannery, Oban, + repo: Cannery.Repo, plugins: [Oban.Plugins.Pruner], queues: [default: 10, mailers: 20] diff --git a/config/dev.exs b/config/dev.exs index 0a42474..0aa76cc 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -1,7 +1,7 @@ import Config # Configure your database -config :lokal, Lokal.Repo, +config :cannery, Cannery.Repo, show_sensitive_data_on_connection_error: true, pool_size: 10 @@ -11,7 +11,7 @@ config :lokal, Lokal.Repo, # The watchers configuration can be used to run external # watchers to your application. For example, we use it # with esbuild to bundle .js and .css sources. -config :lokal, LokalWeb.Endpoint, +config :cannery, CanneryWeb.Endpoint, check_origin: false, code_reloader: true, debug_errors: true, @@ -54,13 +54,13 @@ config :lokal, LokalWeb.Endpoint, # different ports. # Watch static and templates for browser reloading. -config :lokal, LokalWeb.Endpoint, +config :cannery, CanneryWeb.Endpoint, live_reload: [ patterns: [ ~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$", ~r"priv/gettext/.*(po)$", - ~r"lib/lokal_web/(live|views)/.*(ex)$", - ~r"lib/lokal_web/templates/.*(eex)$" + ~r"lib/cannery_web/(live|views)/.*(ex)$", + ~r"lib/cannery_web/templates/.*(eex)$" ] ] diff --git a/config/prod.exs b/config/prod.exs index 6bdebd1..d2e23eb 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -9,7 +9,7 @@ import Config # manifest is generated by the `mix phx.digest` task, # which you should run after static files are built and # before starting your production server. -config :lokal, LokalWeb.Endpoint, cache_static_manifest: "priv/static/cache_manifest.json" +config :cannery, CanneryWeb.Endpoint, cache_static_manifest: "priv/static/cache_manifest.json" # Do not print debug messages in production config :logger, level: :info @@ -19,7 +19,7 @@ config :logger, level: :info # To get SSL working, you will need to add the `https` key # to the previous section and set your `:url` port to 443: # -# config :lokal, LokalWeb.Endpoint, +# config :cannery, CanneryWeb.Endpoint, # ..., # url: [host: "example.com", port: 443], # https: [ @@ -43,7 +43,7 @@ config :logger, level: :info # We also recommend setting `force_ssl` in your endpoint, ensuring # no data is ever sent via http, always redirecting to https: # -# config :lokal, LokalWeb.Endpoint, +# config :cannery, CanneryWeb.Endpoint, # force_ssl: [hsts: true] # # Check `Plug.SSL` for all available options in `force_ssl`. diff --git a/config/runtime.exs b/config/runtime.exs index ddba190..1cb6581 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -9,7 +9,7 @@ import Config # Start the phoenix server if environment is set and running in a release if System.get_env("PHX_SERVER") && System.get_env("RELEASE_NAME") do - config :lokal, LokalWeb.Endpoint, server: true + config :cannery, CanneryWeb.Endpoint, server: true end # Set default locale @@ -21,28 +21,28 @@ database_url = if config_env() == :test do System.get_env( "TEST_DATABASE_URL", - "ecto://postgres:postgres@localhost/lokal_test#{System.get_env("MIX_TEST_PARTITION")}" + "ecto://postgres:postgres@localhost/cannery_test#{System.get_env("MIX_TEST_PARTITION")}" ) else - System.get_env("DATABASE_URL", "ecto://postgres:postgres@lokal-db/lokal") + System.get_env("DATABASE_URL", "ecto://postgres:postgres@cannery-db/cannery") end host = System.get_env("HOST") || - raise "No hostname set! Must be the domain and tld like `lokal.bubbletea.dev`." + raise "No hostname set! Must be the domain and tld like `cannery.bubbletea.dev`." interface = if config_env() in [:dev, :test], do: {0, 0, 0, 0}, else: {0, 0, 0, 0, 0, 0, 0, 0} -config :lokal, Lokal.Repo, +config :cannery, Cannery.Repo, # ssl: true, url: database_url, pool_size: String.to_integer(System.get_env("POOL_SIZE", "10")), socket_options: maybe_ipv6 -config :lokal, LokalWeb.Endpoint, +config :cannery, CanneryWeb.Endpoint, url: [scheme: "https", host: host, port: 443], http: [ # See the documentation on https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html @@ -53,7 +53,7 @@ config :lokal, LokalWeb.Endpoint, server: true if config_env() in [:dev, :prod] do - config :lokal, Lokal.Accounts, registration: System.get_env("REGISTRATION", "invite") + config :cannery, Cannery.Accounts, registration: System.get_env("REGISTRATION", "invite") end if config_env() == :prod do @@ -69,13 +69,13 @@ if config_env() == :prod do You can generate one by calling: mix phx.gen.secret """ - config :lokal, LokalWeb.Endpoint, secret_key_base: secret_key_base + config :cannery, CanneryWeb.Endpoint, secret_key_base: secret_key_base # Automatically apply migrations - config :lokal, Lokal.Application, automigrate: true + config :cannery, Cannery.Application, automigrate: true # Set up SMTP settings - config :lokal, Lokal.Mailer, + config :cannery, Cannery.Mailer, adapter: Swoosh.Adapters.SMTP, relay: System.get_env("SMTP_HOST") || raise("No SMTP_HOST set!"), port: System.get_env("SMTP_PORT", "587"), @@ -83,14 +83,14 @@ if config_env() == :prod do password: System.get_env("SMTP_PASSWORD") || raise("No SMTP_PASSWORD set!"), ssl: System.get_env("SMTP_SSL") == "true", email_from: System.get_env("EMAIL_FROM", "no-reply@#{System.get_env("HOST")}"), - email_name: System.get_env("EMAIL_NAME", "Lokal") + email_name: System.get_env("EMAIL_NAME", "Cannery") # ## Using releases # # If you are doing OTP releases, you need to instruct Phoenix # to start each relevant endpoint: # - # config :lokal, LokalWeb.Endpoint, server: true + # config :cannery, CanneryWeb.Endpoint, server: true # # Then you can assemble a release by calling `mix release`. # See `mix help release` for more information. diff --git a/config/test.exs b/config/test.exs index 2011229..caed05b 100644 --- a/config/test.exs +++ b/config/test.exs @@ -8,22 +8,22 @@ config :bcrypt_elixir, :log_rounds, 1 # The MIX_TEST_PARTITION environment variable can be used # to provide built-in test partitioning in CI environment. # Run `mix help test` for more information. -config :lokal, Lokal.Repo, +config :cannery, Cannery.Repo, pool: Ecto.Adapters.SQL.Sandbox, pool_size: 10 # We don't run a server during test. If one is required, # you can enable the server option below. -config :lokal, LokalWeb.Endpoint, +config :cannery, CanneryWeb.Endpoint, http: [ip: {0, 0, 0, 0}, port: 4002], secret_key_base: "S3qq9QtUdsFtlYej+HTjAVN95uP5i5tf2sPYINWSQfCKJghFj2B1+wTAoljZyHOK", server: false # In test we don't send emails. -config :lokal, Lokal.Mailer, adapter: Swoosh.Adapters.Test +config :cannery, Cannery.Mailer, adapter: Swoosh.Adapters.Test # Don't require invites for signups -config :lokal, Lokal.Accounts, registration: "public" +config :cannery, Cannery.Accounts, registration: "public" # Print only warnings and errors during test config :logger, level: :warn @@ -32,4 +32,4 @@ config :logger, level: :warn config :phoenix, :plug_init_mode, :runtime # Disable Oban -config :lokal, Oban, queues: false, plugins: false +config :cannery, Oban, queues: false, plugins: false diff --git a/docker-compose.yml b/docker-compose.yml index 00dc048..22beb4a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,16 +1,16 @@ version: '3' services: - lokal: + cannery: build: context: . - container_name: lokal + container_name: cannery restart: always environment: # HOST must be set! # - HOST=your.domain.com - - DATABASE_URL=ecto://postgres:postgres@lokal-db/lokal - # Use `docker run -it shibaobun/lokal /app/priv/random.sh` to generate a secret key base + - DATABASE_URL=ecto://postgres:postgres@cannery-db/cannery + # Use `docker run -it shibaobun/cannery /app/priv/random.sh` to generate a secret key base # - SECRET_KEY_BASE=change-me-this-is-really-important-seriously-change-it # uncomment to enable public sign ups, not recommended # - REGISTRATION=public @@ -24,21 +24,21 @@ services: # optional, default is false # - SMTP_SSL=false # optional, default is format below - # - EMAIL_FROM=no-reply@lokal.example.tld - # optional, default is "Lokal" - # - EMAIL_NAME=Lokal + # - EMAIL_FROM=no-reply@cannery.example.tld + # optional, default is "Cannery" + # - EMAIL_NAME=Cannery expose: - "4000" depends_on: - - lokal-db + - cannery-db - lokal-db: + cannery-db: image: postgres:13 - container_name: lokal-db + container_name: cannery-db environment: - POSTGRES_USER="postgres" - POSTGRES_PASSWORD="postgres" - - POSTGRES_DB="lokal" + - POSTGRES_DB="cannery" restart: always volumes: - ./data:/var/lib/postgresql/data diff --git a/lib/lokal.ex b/lib/cannery.ex similarity index 70% rename from lib/lokal.ex rename to lib/cannery.ex index f9e54e4..c36d001 100644 --- a/lib/lokal.ex +++ b/lib/cannery.ex @@ -1,6 +1,6 @@ -defmodule Lokal do +defmodule Cannery do @moduledoc """ - Lokal keeps the contexts that define your domain + Cannery keeps the contexts that define your domain and business logic. Contexts are also responsible for managing your data, regardless diff --git a/lib/lokal/accounts.ex b/lib/cannery/accounts.ex similarity index 98% rename from lib/lokal/accounts.ex rename to lib/cannery/accounts.ex index f3e9de3..0adb6d2 100644 --- a/lib/lokal/accounts.ex +++ b/lib/cannery/accounts.ex @@ -1,11 +1,11 @@ -defmodule Lokal.Accounts do +defmodule Cannery.Accounts do @moduledoc """ The Accounts context. """ import Ecto.Query, warn: false - alias Lokal.{Mailer, Repo} - alias Lokal.Accounts.{Invite, Invites, User, UserToken} + alias Cannery.{Mailer, Repo} + alias Cannery.Accounts.{Invite, Invites, User, UserToken} alias Ecto.{Changeset, Multi} alias Oban.Job @@ -385,7 +385,7 @@ defmodule Lokal.Accounts do """ @spec allow_registration?() :: boolean() def allow_registration? do - Application.get_env(:lokal, Lokal.Accounts)[:registration] == "public" or + Application.get_env(:cannery, Cannery.Accounts)[:registration] == "public" or list_users_by_role(:admin) |> Enum.empty?() end diff --git a/lib/lokal/accounts/email.ex b/lib/cannery/accounts/email.ex similarity index 61% rename from lib/lokal/accounts/email.ex rename to lib/cannery/accounts/email.ex index 7c38e0a..f0c41c8 100644 --- a/lib/lokal/accounts/email.ex +++ b/lib/cannery/accounts/email.ex @@ -1,16 +1,16 @@ -defmodule Lokal.Email do +defmodule Cannery.Email do @moduledoc """ Emails that can be sent using Swoosh. You can find the base email templates at - `lib/Lokal_web/templates/layout/email.html.heex` for html emails and - `lib/Lokal_web/templates/layout/email.txt.heex` for text emails. + `lib/Cannery_web/templates/layout/email.html.heex` for html emails and + `lib/Cannery_web/templates/layout/email.txt.heex` for text emails. """ - use Phoenix.Swoosh, view: LokalWeb.EmailView, layout: {LokalWeb.LayoutView, :email} - import LokalWeb.Gettext - alias Lokal.Accounts.User - alias LokalWeb.EmailView + use Phoenix.Swoosh, view: CanneryWeb.EmailView, layout: {CanneryWeb.LayoutView, :email} + import CanneryWeb.Gettext + alias Cannery.Accounts.User + alias CanneryWeb.EmailView @typedoc """ Represents an HTML and text body email that can be sent @@ -19,29 +19,29 @@ defmodule Lokal.Email do @spec base_email(User.t(), String.t()) :: t() defp base_email(%User{email: email}, subject) do - from = Application.get_env(:Lokal, Lokal.Mailer)[:email_from] || "noreply@localhost" - name = Application.get_env(:Lokal, Lokal.Mailer)[:email_name] + from = Application.get_env(:Cannery, Cannery.Mailer)[:email_from] || "noreply@localhost" + name = Application.get_env(:Cannery, Cannery.Mailer)[:email_name] new() |> to(email) |> from({name, from}) |> subject(subject) end @spec generate_email(key :: String.t(), User.t(), attrs :: map()) :: t() def generate_email("welcome", user, %{"url" => url}) do user - |> base_email(dgettext("emails", "Confirm your Lokal account")) + |> base_email(dgettext("emails", "Confirm your Cannery account")) |> render_body("confirm_email.html", %{user: user, url: url}) |> text_body(EmailView.render("confirm_email.txt", %{user: user, url: url})) end def generate_email("reset_password", user, %{"url" => url}) do user - |> base_email(dgettext("emails", "Reset your Lokal password")) + |> base_email(dgettext("emails", "Reset your Cannery password")) |> render_body("reset_password.html", %{user: user, url: url}) |> text_body(EmailView.render("reset_password.txt", %{user: user, url: url})) end def generate_email("update_email", user, %{"url" => url}) do user - |> base_email(dgettext("emails", "Update your Lokal email")) + |> base_email(dgettext("emails", "Update your Cannery email")) |> render_body("update_email.html", %{user: user, url: url}) |> text_body(EmailView.render("update_email.txt", %{user: user, url: url})) end diff --git a/lib/lokal/accounts/email_worker.ex b/lib/cannery/accounts/email_worker.ex similarity index 81% rename from lib/lokal/accounts/email_worker.ex rename to lib/cannery/accounts/email_worker.ex index fc94144..bc8eee5 100644 --- a/lib/lokal/accounts/email_worker.ex +++ b/lib/cannery/accounts/email_worker.ex @@ -1,10 +1,10 @@ -defmodule Lokal.EmailWorker do +defmodule Cannery.EmailWorker do @moduledoc """ Oban worker that dispatches emails """ use Oban.Worker, queue: :mailers, tags: ["email"] - alias Lokal.{Accounts, Email, Mailer} + alias Cannery.{Accounts, Email, Mailer} @impl Oban.Worker def perform(%Oban.Job{args: %{"email" => email, "user_id" => user_id, "attrs" => attrs}}) do diff --git a/lib/lokal/accounts/invite.ex b/lib/cannery/accounts/invite.ex similarity index 96% rename from lib/lokal/accounts/invite.ex rename to lib/cannery/accounts/invite.ex index 35951a8..0db4f7a 100644 --- a/lib/lokal/accounts/invite.ex +++ b/lib/cannery/accounts/invite.ex @@ -1,4 +1,4 @@ -defmodule Lokal.Accounts.Invite do +defmodule Cannery.Accounts.Invite do @moduledoc """ An invite, created by an admin to allow someone to join their instance. An invite can be enabled or disabled, and can have an optional number of uses if @@ -7,8 +7,8 @@ defmodule Lokal.Accounts.Invite do use Ecto.Schema import Ecto.Changeset + alias Cannery.Accounts.User alias Ecto.{Association, Changeset, UUID} - alias Lokal.Accounts.User @primary_key {:id, :binary_id, autogenerate: true} @foreign_key_type :binary_id diff --git a/lib/lokal/accounts/invites.ex b/lib/cannery/accounts/invites.ex similarity index 98% rename from lib/lokal/accounts/invites.ex rename to lib/cannery/accounts/invites.ex index 06fd39c..7f8e955 100644 --- a/lib/lokal/accounts/invites.ex +++ b/lib/cannery/accounts/invites.ex @@ -1,12 +1,12 @@ -defmodule Lokal.Accounts.Invites do +defmodule Cannery.Accounts.Invites do @moduledoc """ The Invites context. """ import Ecto.Query, warn: false alias Ecto.Multi - alias Lokal.Accounts.{Invite, User} - alias Lokal.Repo + alias Cannery.Accounts.{Invite, User} + alias Cannery.Repo @invite_token_length 20 diff --git a/lib/lokal/accounts/user.ex b/lib/cannery/accounts/user.ex similarity index 97% rename from lib/lokal/accounts/user.ex rename to lib/cannery/accounts/user.ex index e75d84c..2662599 100644 --- a/lib/lokal/accounts/user.ex +++ b/lib/cannery/accounts/user.ex @@ -1,13 +1,13 @@ -defmodule Lokal.Accounts.User do +defmodule Cannery.Accounts.User do @moduledoc """ - A Lokal user + A Cannery user """ use Ecto.Schema import Ecto.Changeset - import LokalWeb.Gettext + import CanneryWeb.Gettext alias Ecto.{Association, Changeset, UUID} - alias Lokal.Accounts.{Invite, User} + alias Cannery.Accounts.{Invite, User} @derive {Jason.Encoder, only: [ @@ -99,7 +99,7 @@ defmodule Lokal.Accounts.User do message: dgettext("errors", "must have the @ sign and no spaces") ) |> validate_length(:email, max: 160) - |> unsafe_validate_unique(:email, Lokal.Repo) + |> unsafe_validate_unique(:email, Cannery.Repo) |> unique_constraint(:email) end diff --git a/lib/lokal/accounts/user_notifier.ex b/lib/cannery/accounts/user_notifier.ex similarity index 97% rename from lib/lokal/accounts/user_notifier.ex rename to lib/cannery/accounts/user_notifier.ex index 10a9c6d..8c57f77 100644 --- a/lib/lokal/accounts/user_notifier.ex +++ b/lib/cannery/accounts/user_notifier.ex @@ -1,4 +1,4 @@ -defmodule Lokal.Accounts.UserNotifier do +defmodule Cannery.Accounts.UserNotifier do @moduledoc """ Contains templates and messages for user messages """ diff --git a/lib/lokal/accounts/user_token.ex b/lib/cannery/accounts/user_token.ex similarity index 98% rename from lib/lokal/accounts/user_token.ex rename to lib/cannery/accounts/user_token.ex index 5cc012d..9d4ebb2 100644 --- a/lib/lokal/accounts/user_token.ex +++ b/lib/cannery/accounts/user_token.ex @@ -1,12 +1,12 @@ -defmodule Lokal.Accounts.UserToken do +defmodule Cannery.Accounts.UserToken do @moduledoc """ Schema for a user's session token """ use Ecto.Schema import Ecto.Query + alias Cannery.Accounts.User alias Ecto.{Association, UUID} - alias Lokal.Accounts.User @hash_algorithm :sha256 @rand_size 32 diff --git a/lib/lokal/application.ex b/lib/cannery/application.ex similarity index 69% rename from lib/lokal/application.ex rename to lib/cannery/application.ex index 93f9644..05075f0 100644 --- a/lib/lokal/application.ex +++ b/lib/cannery/application.ex @@ -1,27 +1,27 @@ -defmodule Lokal.Application do +defmodule Cannery.Application do # See https://hexdocs.pm/elixir/Application.html # for more information on OTP Applications @moduledoc false use Application - alias Lokal.Logger + alias Cannery.Logger @impl true def start(_type, _args) do children = [ # Start the Ecto repository - Lokal.Repo, + Cannery.Repo, # Start the Telemetry supervisor - LokalWeb.Telemetry, + CanneryWeb.Telemetry, # Start the PubSub system - {Phoenix.PubSub, name: Lokal.PubSub}, + {Phoenix.PubSub, name: Cannery.PubSub}, # Start the Endpoint (http/https) - LokalWeb.Endpoint, + CanneryWeb.Endpoint, # Add Oban {Oban, oban_config()}, - Lokal.Repo.Migrator - # Start a worker by calling: Lokal.Worker.start_link(arg) - # {Lokal.Worker, arg} + Cannery.Repo.Migrator + # Start a worker by calling: Cannery.Worker.start_link(arg) + # {Cannery.Worker, arg} ] # Oban events logging https://hexdocs.pm/oban/Oban.html#module-reporting-errors @@ -39,7 +39,7 @@ defmodule Lokal.Application do # See https://hexdocs.pm/elixir/Supervisor.html # for other strategies and supported options - opts = [strategy: :one_for_one, name: Lokal.Supervisor] + opts = [strategy: :one_for_one, name: Cannery.Supervisor] Supervisor.start_link(children, opts) end @@ -47,11 +47,11 @@ defmodule Lokal.Application do # whenever the application is updated. @impl true def config_change(changed, _new, removed) do - LokalWeb.Endpoint.config_change(changed, removed) + CanneryWeb.Endpoint.config_change(changed, removed) :ok end defp oban_config do - Application.fetch_env!(:lokal, Oban) + Application.fetch_env!(:cannery, Oban) end end diff --git a/lib/lokal/logger.ex b/lib/cannery/logger.ex similarity index 98% rename from lib/lokal/logger.ex rename to lib/cannery/logger.ex index 0e32b43..2b8c5e8 100644 --- a/lib/lokal/logger.ex +++ b/lib/cannery/logger.ex @@ -1,4 +1,4 @@ -defmodule Lokal.Logger do +defmodule Cannery.Logger do @moduledoc """ Custom logger for telemetry events diff --git a/lib/lokal/mailer.ex b/lib/cannery/mailer.ex similarity index 91% rename from lib/lokal/mailer.ex rename to lib/cannery/mailer.ex index 792696f..d3737ff 100644 --- a/lib/lokal/mailer.ex +++ b/lib/cannery/mailer.ex @@ -1,4 +1,4 @@ -defmodule Lokal.Mailer do +defmodule Cannery.Mailer do @moduledoc """ Mailer adapter for emails @@ -6,8 +6,8 @@ defmodule Lokal.Mailer do json with Jason, which restricts the use of structs. """ - use Swoosh.Mailer, otp_app: :lokal - alias Lokal.{Accounts.User, EmailWorker} + use Swoosh.Mailer, otp_app: :cannery + alias Cannery.{Accounts.User, EmailWorker} alias Oban.Job @doc """ diff --git a/lib/lokal/release.ex b/lib/cannery/release.ex similarity index 92% rename from lib/lokal/release.ex rename to lib/cannery/release.ex index 0726cc5..0ea10c1 100644 --- a/lib/lokal/release.ex +++ b/lib/cannery/release.ex @@ -1,9 +1,9 @@ -defmodule Lokal.Release do +defmodule Cannery.Release do @moduledoc """ Contains mix tasks that can used in generated releases """ - @app :lokal + @app :cannery def rollback(repo, version) do load_app() diff --git a/lib/lokal/repo.ex b/lib/cannery/repo.ex similarity index 53% rename from lib/lokal/repo.ex rename to lib/cannery/repo.ex index bd4a401..bead59d 100644 --- a/lib/lokal/repo.ex +++ b/lib/cannery/repo.ex @@ -1,5 +1,5 @@ -defmodule Lokal.Repo do +defmodule Cannery.Repo do use Ecto.Repo, - otp_app: :lokal, + otp_app: :cannery, adapter: Ecto.Adapters.Postgres end diff --git a/lib/lokal/repo/migrator.ex b/lib/cannery/repo/migrator.ex similarity index 58% rename from lib/lokal/repo/migrator.ex rename to lib/cannery/repo/migrator.ex index b1892c8..8b5cda9 100644 --- a/lib/lokal/repo/migrator.ex +++ b/lib/cannery/repo/migrator.ex @@ -1,4 +1,4 @@ -defmodule Lokal.Repo.Migrator do +defmodule Cannery.Repo.Migrator do @moduledoc """ Genserver to automatically perform all migration on app start """ @@ -15,11 +15,11 @@ defmodule Lokal.Repo.Migrator do end def migrate! do - path = Application.app_dir(:lokal, "priv/repo/migrations") - Ecto.Migrator.run(Lokal.Repo, path, :up, all: true) + path = Application.app_dir(:cannery, "priv/repo/migrations") + Ecto.Migrator.run(Cannery.Repo, path, :up, all: true) end defp automigrate_enabled? do - Application.get_env(:lokal, Lokal.Application, automigrate: false)[:automigrate] + Application.get_env(:cannery, Cannery.Application, automigrate: false)[:automigrate] end end diff --git a/lib/lokal_web.ex b/lib/cannery_web.ex similarity index 79% rename from lib/lokal_web.ex rename to lib/cannery_web.ex index ff65685..8ab5b45 100644 --- a/lib/lokal_web.ex +++ b/lib/cannery_web.ex @@ -1,12 +1,12 @@ -defmodule LokalWeb do +defmodule CanneryWeb 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 LokalWeb, :controller - use LokalWeb, :view + use CanneryWeb, :controller + use CanneryWeb, :view The definitions below will be executed for every view, controller, etc, so keep them short and clean, focused @@ -19,19 +19,19 @@ defmodule LokalWeb do def controller do quote do - use Phoenix.Controller, namespace: LokalWeb + use Phoenix.Controller, namespace: CanneryWeb import Plug.Conn - import LokalWeb.Gettext - alias LokalWeb.Router.Helpers, as: Routes + import CanneryWeb.Gettext + alias CanneryWeb.Router.Helpers, as: Routes end end def view do quote do use Phoenix.View, - root: "lib/lokal_web/templates", - namespace: LokalWeb + root: "lib/cannery_web/templates", + namespace: CanneryWeb # Import convenience functions from controllers import Phoenix.Controller, @@ -45,9 +45,9 @@ defmodule LokalWeb do def live_view do quote do use Phoenix.LiveView, - layout: {LokalWeb.LayoutView, "live.html"} + layout: {CanneryWeb.LayoutView, "live.html"} - on_mount LokalWeb.InitAssigns + on_mount CanneryWeb.InitAssigns unquote(view_helpers()) end end @@ -82,7 +82,7 @@ defmodule LokalWeb do quote do use Phoenix.Channel # credo:disable-for-next-line Credo.Check.Consistency.MultiAliasImportRequireUse - import LokalWeb.Gettext + import CanneryWeb.Gettext end end @@ -95,9 +95,9 @@ defmodule LokalWeb do # Import LiveView and .heex helpers (live_render, link, <.form>, etc) # Import basic rendering functionality (render, render_layout, etc) import Phoenix.{Component, View} - import LokalWeb.{ErrorHelpers, Gettext, LiveHelpers, ViewHelpers} + import CanneryWeb.{ErrorHelpers, Gettext, LiveHelpers, ViewHelpers} - alias LokalWeb.Router.Helpers, as: Routes + alias CanneryWeb.Router.Helpers, as: Routes end end diff --git a/lib/lokal_web/components/invite_card.ex b/lib/cannery_web/components/invite_card.ex similarity index 93% rename from lib/lokal_web/components/invite_card.ex rename to lib/cannery_web/components/invite_card.ex index 6dd0af6..d57c183 100644 --- a/lib/lokal_web/components/invite_card.ex +++ b/lib/cannery_web/components/invite_card.ex @@ -1,11 +1,11 @@ -defmodule LokalWeb.Components.InviteCard do +defmodule CanneryWeb.Components.InviteCard do @moduledoc """ Display card for an invite """ - use LokalWeb, :component - alias Lokal.Accounts.{Invite, Invites, User} - alias LokalWeb.Endpoint + use CanneryWeb, :component + alias Cannery.Accounts.{Invite, Invites, User} + alias CanneryWeb.Endpoint attr :invite, Invite, required: true attr :current_user, User, required: true diff --git a/lib/lokal_web/components/table_component.ex b/lib/cannery_web/components/table_component.ex similarity index 97% rename from lib/lokal_web/components/table_component.ex rename to lib/cannery_web/components/table_component.ex index cdd0d6c..7b4de9b 100644 --- a/lib/lokal_web/components/table_component.ex +++ b/lib/cannery_web/components/table_component.ex @@ -1,4 +1,4 @@ -defmodule LokalWeb.Components.TableComponent do +defmodule CanneryWeb.Components.TableComponent do @moduledoc """ Livecomponent that presents a resortable table @@ -19,7 +19,7 @@ defmodule LokalWeb.Components.TableComponent do content. """ - use LokalWeb, :live_component + use CanneryWeb, :live_component alias Phoenix.LiveView.Socket @impl true diff --git a/lib/lokal_web/components/table_component.html.heex b/lib/cannery_web/components/table_component.html.heex similarity index 100% rename from lib/lokal_web/components/table_component.html.heex rename to lib/cannery_web/components/table_component.html.heex diff --git a/lib/lokal_web/components/topbar.ex b/lib/cannery_web/components/topbar.ex similarity index 94% rename from lib/lokal_web/components/topbar.ex rename to lib/cannery_web/components/topbar.ex index 5dbe49a..4746450 100644 --- a/lib/lokal_web/components/topbar.ex +++ b/lib/cannery_web/components/topbar.ex @@ -1,12 +1,12 @@ -defmodule LokalWeb.Components.Topbar do +defmodule CanneryWeb.Components.Topbar do @moduledoc """ Component that renders a topbar with user functions/links """ - use LokalWeb, :component + use CanneryWeb, :component - alias Lokal.Accounts - alias LokalWeb.{Endpoint, HomeLive} + alias Cannery.Accounts + alias CanneryWeb.{Endpoint, HomeLive} def topbar(assigns) do assigns = @@ -20,7 +20,7 @@ defmodule LokalWeb.Components.Topbar do navigate={Routes.live_path(Endpoint, HomeLive)} class="mx-2 my-1 leading-5 text-xl text-white hover:underline" > - <%= gettext("Lokal") %> + <%= gettext("Cannery") %> <%= if @title_content do %> diff --git a/lib/lokal_web/components/user_card.ex b/lib/cannery_web/components/user_card.ex similarity index 94% rename from lib/lokal_web/components/user_card.ex rename to lib/cannery_web/components/user_card.ex index 2c3e11a..03c48f5 100644 --- a/lib/lokal_web/components/user_card.ex +++ b/lib/cannery_web/components/user_card.ex @@ -1,9 +1,9 @@ -defmodule LokalWeb.Components.UserCard do +defmodule CanneryWeb.Components.UserCard do @moduledoc """ Display card for a user """ - use LokalWeb, :component + use CanneryWeb, :component def user_card(assigns) do ~H""" diff --git a/lib/lokal_web/controllers/email_controller.ex b/lib/cannery_web/controllers/email_controller.ex similarity index 63% rename from lib/lokal_web/controllers/email_controller.ex rename to lib/cannery_web/controllers/email_controller.ex index 497cae0..6b8da4e 100644 --- a/lib/lokal_web/controllers/email_controller.ex +++ b/lib/cannery_web/controllers/email_controller.ex @@ -1,16 +1,16 @@ -defmodule LokalWeb.EmailController do +defmodule CanneryWeb.EmailController do @moduledoc """ A dev controller used to develop on emails """ - use LokalWeb, :controller - alias Lokal.Accounts.User + use CanneryWeb, :controller + alias Cannery.Accounts.User - plug :put_layout, {LokalWeb.LayoutView, :email} + plug :put_layout, {CanneryWeb.LayoutView, :email} @sample_assigns %{ email: %{subject: "Example subject"}, - url: "https://lokal.bubbletea.dev/sample_url", + url: "https://cannery.bubbletea.dev/sample_url", user: %User{email: "sample@email.com"} } diff --git a/lib/lokal_web/controllers/home_controller.ex b/lib/cannery_web/controllers/home_controller.ex similarity index 64% rename from lib/lokal_web/controllers/home_controller.ex rename to lib/cannery_web/controllers/home_controller.ex index 3f3b44b..36b570a 100644 --- a/lib/lokal_web/controllers/home_controller.ex +++ b/lib/cannery_web/controllers/home_controller.ex @@ -1,9 +1,9 @@ -defmodule LokalWeb.HomeController do +defmodule CanneryWeb.HomeController do @moduledoc """ Controller for home page """ - use LokalWeb, :controller + use CanneryWeb, :controller def index(conn, _params) do render(conn, "index.html") diff --git a/lib/lokal_web/controllers/user_auth.ex b/lib/cannery_web/controllers/user_auth.ex similarity index 94% rename from lib/lokal_web/controllers/user_auth.ex rename to lib/cannery_web/controllers/user_auth.ex index 6620f5f..c3d01d6 100644 --- a/lib/lokal_web/controllers/user_auth.ex +++ b/lib/cannery_web/controllers/user_auth.ex @@ -1,20 +1,20 @@ -defmodule LokalWeb.UserAuth do +defmodule CanneryWeb.UserAuth do @moduledoc """ Functions for user session and authentication """ import Plug.Conn import Phoenix.Controller - import LokalWeb.Gettext - alias Lokal.{Accounts, Accounts.User} - alias LokalWeb.HomeLive - alias LokalWeb.Router.Helpers, as: Routes + import CanneryWeb.Gettext + alias Cannery.{Accounts, Accounts.User} + alias CanneryWeb.HomeLive + alias CanneryWeb.Router.Helpers, as: Routes # Make the remember me cookie valid for 60 days. # If you want bump or reduce this value, also change # the token expiry itself in UserToken. @max_age 60 * 60 * 24 * 60 - @remember_me_cookie "_lokal_web_user_remember_me" + @remember_me_cookie "_cannery_web_user_remember_me" @remember_me_options [sign: true, max_age: @max_age, same_site: "Lax"] @doc """ @@ -99,7 +99,7 @@ defmodule LokalWeb.UserAuth do user_token && Accounts.delete_session_token(user_token) if live_socket_id = get_session(conn, :live_socket_id) do - LokalWeb.Endpoint.broadcast(live_socket_id, "disconnect", %{}) + CanneryWeb.Endpoint.broadcast(live_socket_id, "disconnect", %{}) end conn diff --git a/lib/lokal_web/controllers/user_confirmation_controller.ex b/lib/cannery_web/controllers/user_confirmation_controller.ex similarity index 92% rename from lib/lokal_web/controllers/user_confirmation_controller.ex rename to lib/cannery_web/controllers/user_confirmation_controller.ex index c03782f..d33cfd7 100644 --- a/lib/lokal_web/controllers/user_confirmation_controller.ex +++ b/lib/cannery_web/controllers/user_confirmation_controller.ex @@ -1,8 +1,8 @@ -defmodule LokalWeb.UserConfirmationController do - use LokalWeb, :controller +defmodule CanneryWeb.UserConfirmationController do + use CanneryWeb, :controller - import LokalWeb.Gettext - alias Lokal.Accounts + import CanneryWeb.Gettext + alias Cannery.Accounts def new(conn, _params) do render(conn, "new.html", page_title: gettext("Confirm your account")) diff --git a/lib/lokal_web/controllers/user_registration_controller.ex b/lib/cannery_web/controllers/user_registration_controller.ex similarity index 92% rename from lib/lokal_web/controllers/user_registration_controller.ex rename to lib/cannery_web/controllers/user_registration_controller.ex index 11e5f5f..6e231eb 100644 --- a/lib/lokal_web/controllers/user_registration_controller.ex +++ b/lib/cannery_web/controllers/user_registration_controller.ex @@ -1,8 +1,8 @@ -defmodule LokalWeb.UserRegistrationController do - use LokalWeb, :controller - import LokalWeb.Gettext - alias Lokal.{Accounts, Accounts.Invites} - alias LokalWeb.{Endpoint, HomeLive} +defmodule CanneryWeb.UserRegistrationController do + use CanneryWeb, :controller + import CanneryWeb.Gettext + alias Cannery.{Accounts, Accounts.Invites} + alias CanneryWeb.{Endpoint, HomeLive} def new(conn, %{"invite" => invite_token}) do if Invites.valid_invite_token?(invite_token) do diff --git a/lib/lokal_web/controllers/user_reset_password_controller.ex b/lib/cannery_web/controllers/user_reset_password_controller.ex similarity index 94% rename from lib/lokal_web/controllers/user_reset_password_controller.ex rename to lib/cannery_web/controllers/user_reset_password_controller.ex index 0028bda..9f2242f 100644 --- a/lib/lokal_web/controllers/user_reset_password_controller.ex +++ b/lib/cannery_web/controllers/user_reset_password_controller.ex @@ -1,7 +1,7 @@ -defmodule LokalWeb.UserResetPasswordController do - use LokalWeb, :controller +defmodule CanneryWeb.UserResetPasswordController do + use CanneryWeb, :controller - alias Lokal.Accounts + alias Cannery.Accounts plug :get_user_by_reset_password_token when action in [:edit, :update] diff --git a/lib/lokal_web/controllers/user_session_controller.ex b/lib/cannery_web/controllers/user_session_controller.ex similarity index 82% rename from lib/lokal_web/controllers/user_session_controller.ex rename to lib/cannery_web/controllers/user_session_controller.ex index 23b6b84..dbb901b 100644 --- a/lib/lokal_web/controllers/user_session_controller.ex +++ b/lib/cannery_web/controllers/user_session_controller.ex @@ -1,8 +1,8 @@ -defmodule LokalWeb.UserSessionController do - use LokalWeb, :controller +defmodule CanneryWeb.UserSessionController do + use CanneryWeb, :controller - alias Lokal.Accounts - alias LokalWeb.UserAuth + alias Cannery.Accounts + alias CanneryWeb.UserAuth def new(conn, _params) do render(conn, "new.html", error_message: nil, page_title: gettext("Log in")) diff --git a/lib/lokal_web/controllers/user_settings_controller.ex b/lib/cannery_web/controllers/user_settings_controller.ex similarity index 95% rename from lib/lokal_web/controllers/user_settings_controller.ex rename to lib/cannery_web/controllers/user_settings_controller.ex index b6be99e..10e69f4 100644 --- a/lib/lokal_web/controllers/user_settings_controller.ex +++ b/lib/cannery_web/controllers/user_settings_controller.ex @@ -1,8 +1,8 @@ -defmodule LokalWeb.UserSettingsController do - use LokalWeb, :controller - import LokalWeb.Gettext - alias Lokal.Accounts - alias LokalWeb.{HomeLive, UserAuth} +defmodule CanneryWeb.UserSettingsController do + use CanneryWeb, :controller + import CanneryWeb.Gettext + alias Cannery.Accounts + alias CanneryWeb.{HomeLive, UserAuth} plug :assign_email_and_password_changesets diff --git a/lib/lokal_web/endpoint.ex b/lib/cannery_web/endpoint.ex similarity index 86% rename from lib/lokal_web/endpoint.ex rename to lib/cannery_web/endpoint.ex index 06e4baa..eb2ca68 100644 --- a/lib/lokal_web/endpoint.ex +++ b/lib/cannery_web/endpoint.ex @@ -1,12 +1,12 @@ -defmodule LokalWeb.Endpoint do - use Phoenix.Endpoint, otp_app: :lokal +defmodule CanneryWeb.Endpoint do + use Phoenix.Endpoint, otp_app: :cannery # The session will be stored in the cookie and signed, # this means its contents can be read but not tampered with. # Set :encryption_salt if you would also like to encrypt it. @session_options [ store: :cookie, - key: "_lokal_key", + key: "_cannery_key", signing_salt: "fxAnJltS" ] @@ -18,7 +18,7 @@ defmodule LokalWeb.Endpoint do # when deploying your static files in production. plug Plug.Static, at: "/", - from: :lokal, + from: :cannery, gzip: false, only: ~w(css fonts images js favicon.ico robots.txt) @@ -28,7 +28,7 @@ defmodule LokalWeb.Endpoint do socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket plug Phoenix.LiveReloader plug Phoenix.CodeReloader - plug Phoenix.Ecto.CheckRepoStatus, otp_app: :lokal + plug Phoenix.Ecto.CheckRepoStatus, otp_app: :cannery end plug Phoenix.LiveDashboard.RequestLogger, @@ -46,5 +46,5 @@ defmodule LokalWeb.Endpoint do plug Plug.MethodOverride plug Plug.Head plug Plug.Session, @session_options - plug LokalWeb.Router + plug CanneryWeb.Router end diff --git a/lib/lokal_web/gettext.ex b/lib/cannery_web/gettext.ex similarity index 86% rename from lib/lokal_web/gettext.ex rename to lib/cannery_web/gettext.ex index d7921d1..062b92b 100644 --- a/lib/lokal_web/gettext.ex +++ b/lib/cannery_web/gettext.ex @@ -1,11 +1,11 @@ -defmodule LokalWeb.Gettext do +defmodule CanneryWeb.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 LokalWeb.Gettext + import CanneryWeb.Gettext # Simple translation gettext("Here is the string to translate") @@ -20,5 +20,5 @@ defmodule LokalWeb.Gettext do See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage. """ - use Gettext, otp_app: :lokal + use Gettext, otp_app: :cannery end diff --git a/lib/lokal_web/live/home_live.ex b/lib/cannery_web/live/home_live.ex similarity index 73% rename from lib/lokal_web/live/home_live.ex rename to lib/cannery_web/live/home_live.ex index fb45bcd..b1f8e16 100644 --- a/lib/lokal_web/live/home_live.ex +++ b/lib/cannery_web/live/home_live.ex @@ -1,11 +1,11 @@ -defmodule LokalWeb.HomeLive do +defmodule CanneryWeb.HomeLive do @moduledoc """ Liveview for the home page """ - use LokalWeb, :live_view - alias Lokal.Accounts - alias LokalWeb.Endpoint + use CanneryWeb, :live_view + alias Cannery.Accounts + alias CanneryWeb.Endpoint @version Mix.Project.config()[:version] diff --git a/lib/lokal_web/live/home_live.html.heex b/lib/cannery_web/live/home_live.html.heex similarity index 87% rename from lib/lokal_web/live/home_live.html.heex rename to lib/cannery_web/live/home_live.html.heex index f156a70..60962c1 100644 --- a/lib/lokal_web/live/home_live.html.heex +++ b/lib/cannery_web/live/home_live.html.heex @@ -1,6 +1,6 @@

- <%= gettext("Welcome to Lokal") %> + <%= gettext("Welcome to Cannery") %>

@@ -16,7 +16,7 @@ <%= gettext("Easy to Use:") %>

- <%= gettext("Lokal lets you easily shop from your local community") %> + <%= gettext("Cannery lets you easily shop from your local community") %>

  • @@ -53,7 +53,7 @@

    <%= if @admins |> Enum.empty?() do %> <.link href={Routes.user_registration_path(Endpoint, :new)} class="hover:underline"> - <%= dgettext("prompts", "Register to setup Lokal") %> + <%= dgettext("prompts", "Register to setup Cannery") %> <% else %>

    @@ -68,7 +68,7 @@
  • <%= gettext("Registration:") %>

    - <%= case Application.get_env(:lokal, Lokal.Accounts)[:registration] do + <%= case Application.get_env(:cannery, Cannery.Accounts)[:registration] do "public" -> gettext("Public Signups") _ -> gettext("Invite Only") end %> @@ -78,7 +78,7 @@

  • <%= gettext("Version:") %> <.link - href="https://gitea.bubbletea.dev/shibao/lokal/src/branch/stable/CHANGELOG.md" + href="https://gitea.bubbletea.dev/shibao/cannery/src/branch/stable/CHANGELOG.md" class="flex flex-row justify-center items-center space-x-2 hover:underline" target="_blank" rel="noopener noreferrer" @@ -101,7 +101,7 @@
  • <.link class="flex flex-row justify-center items-center space-x-2 hover:underline" - href="https://gitea.bubbletea.dev/shibao/lokal" + href="https://gitea.bubbletea.dev/shibao/cannery" target="_blank" rel="noopener noreferrer" > @@ -112,7 +112,7 @@
  • <.link class="flex flex-row justify-center items-center space-x-2 hover:underline" - href="https://weblate.bubbletea.dev/engage/lokal" + href="https://weblate.bubbletea.dev/engage/cannery" target="_blank" rel="noopener noreferrer" > @@ -123,7 +123,7 @@
  • <.link class="flex flex-row justify-center items-center space-x-2 hover:underline" - href="https://gitea.bubbletea.dev/shibao/lokal/issues/new" + href="https://gitea.bubbletea.dev/shibao/cannery/issues/new" target="_blank" rel="noopener noreferrer" > diff --git a/lib/lokal_web/live/init_assigns.ex b/lib/cannery_web/live/init_assigns.ex similarity index 88% rename from lib/lokal_web/live/init_assigns.ex rename to lib/cannery_web/live/init_assigns.ex index 9c5bcb7..9931327 100644 --- a/lib/lokal_web/live/init_assigns.ex +++ b/lib/cannery_web/live/init_assigns.ex @@ -1,9 +1,9 @@ -defmodule LokalWeb.InitAssigns do +defmodule CanneryWeb.InitAssigns do @moduledoc """ Ensures common `assigns` are applied to all LiveViews attaching this hook. """ import Phoenix.Component - alias Lokal.Accounts + alias Cannery.Accounts def on_mount(:default, _params, %{"locale" => locale, "user_token" => user_token}, socket) do Gettext.put_locale(locale) diff --git a/lib/lokal_web/live/invite_live/form_component.ex b/lib/cannery_web/live/invite_live/form_component.ex similarity index 92% rename from lib/lokal_web/live/invite_live/form_component.ex rename to lib/cannery_web/live/invite_live/form_component.ex index 274a4fc..f04782c 100644 --- a/lib/lokal_web/live/invite_live/form_component.ex +++ b/lib/cannery_web/live/invite_live/form_component.ex @@ -1,11 +1,11 @@ -defmodule LokalWeb.InviteLive.FormComponent do +defmodule CanneryWeb.InviteLive.FormComponent do @moduledoc """ - Livecomponent that can update or create an Lokal.Accounts.Invite + Livecomponent that can update or create an Cannery.Accounts.Invite """ - use LokalWeb, :live_component + use CanneryWeb, :live_component alias Ecto.Changeset - alias Lokal.Accounts.{Invite, Invites, User} + alias Cannery.Accounts.{Invite, Invites, User} alias Phoenix.LiveView.Socket @impl true diff --git a/lib/lokal_web/live/invite_live/form_component.html.heex b/lib/cannery_web/live/invite_live/form_component.html.heex similarity index 100% rename from lib/lokal_web/live/invite_live/form_component.html.heex rename to lib/cannery_web/live/invite_live/form_component.html.heex diff --git a/lib/lokal_web/live/invite_live/index.ex b/lib/cannery_web/live/invite_live/index.ex similarity index 94% rename from lib/lokal_web/live/invite_live/index.ex rename to lib/cannery_web/live/invite_live/index.ex index 20ca622..1f3fdf2 100644 --- a/lib/lokal_web/live/invite_live/index.ex +++ b/lib/cannery_web/live/invite_live/index.ex @@ -1,13 +1,13 @@ -defmodule LokalWeb.InviteLive.Index do +defmodule CanneryWeb.InviteLive.Index do @moduledoc """ - Liveview to show a Lokal.Accounts.Invite index + Liveview to show a Cannery.Accounts.Invite index """ - use LokalWeb, :live_view - import LokalWeb.Components.{InviteCard, UserCard} - alias Lokal.Accounts - alias Lokal.Accounts.{Invite, Invites} - alias LokalWeb.{Endpoint, HomeLive} + use CanneryWeb, :live_view + import CanneryWeb.Components.{InviteCard, UserCard} + alias Cannery.Accounts + alias Cannery.Accounts.{Invite, Invites} + alias CanneryWeb.{Endpoint, HomeLive} alias Phoenix.LiveView.JS @impl true diff --git a/lib/lokal_web/live/invite_live/index.html.heex b/lib/cannery_web/live/invite_live/index.html.heex similarity index 97% rename from lib/lokal_web/live/invite_live/index.html.heex rename to lib/cannery_web/live/invite_live/index.html.heex index 45434bb..2739fb6 100644 --- a/lib/lokal_web/live/invite_live/index.html.heex +++ b/lib/cannery_web/live/invite_live/index.html.heex @@ -24,7 +24,7 @@ @@ -138,7 +138,7 @@ <.modal :if={@live_action in [:new, :edit]} return_to={Routes.invite_index_path(Endpoint, :index)}> <.live_component - module={LokalWeb.InviteLive.FormComponent} + module={CanneryWeb.InviteLive.FormComponent} id={@invite.id || :new} title={@page_title} action={@live_action} diff --git a/lib/lokal_web/live/live_helpers.ex b/lib/cannery_web/live/live_helpers.ex similarity index 98% rename from lib/lokal_web/live/live_helpers.ex rename to lib/cannery_web/live/live_helpers.ex index 77f3458..733361f 100644 --- a/lib/lokal_web/live/live_helpers.ex +++ b/lib/cannery_web/live/live_helpers.ex @@ -1,4 +1,4 @@ -defmodule LokalWeb.LiveHelpers do +defmodule CanneryWeb.LiveHelpers do @moduledoc """ Contains resuable methods for all liveviews """ diff --git a/lib/lokal_web/router.ex b/lib/cannery_web/router.ex similarity index 86% rename from lib/lokal_web/router.ex rename to lib/cannery_web/router.ex index c99d995..0a25153 100644 --- a/lib/lokal_web/router.ex +++ b/lib/cannery_web/router.ex @@ -1,13 +1,13 @@ -defmodule LokalWeb.Router do - use LokalWeb, :router +defmodule CanneryWeb.Router do + use CanneryWeb, :router import Phoenix.LiveDashboard.Router - import LokalWeb.UserAuth + import CanneryWeb.UserAuth pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash - plug :put_root_layout, {LokalWeb.LayoutView, :root} + plug :put_root_layout, {CanneryWeb.LayoutView, :root} plug :protect_from_forgery plug :put_secure_browser_headers plug :fetch_current_user @@ -34,7 +34,7 @@ defmodule LokalWeb.Router do plug :accepts, ["json"] end - scope "/", LokalWeb do + scope "/", CanneryWeb do pipe_through :browser live "/", HomeLive @@ -42,7 +42,7 @@ defmodule LokalWeb.Router do ## Authentication routes - scope "/", LokalWeb do + scope "/", CanneryWeb do pipe_through [:browser, :redirect_if_user_is_authenticated] get "/users/register", UserRegistrationController, :new @@ -55,7 +55,7 @@ defmodule LokalWeb.Router do put "/users/reset_password/:token", UserResetPasswordController, :update end - scope "/", LokalWeb do + scope "/", CanneryWeb do pipe_through [:browser, :require_authenticated_user] get "/users/settings", UserSettingsController, :edit @@ -64,17 +64,17 @@ defmodule LokalWeb.Router do get "/users/settings/confirm_email/:token", UserSettingsController, :confirm_email end - scope "/", LokalWeb do + scope "/", CanneryWeb do pipe_through [:browser, :require_authenticated_user, :require_admin] - live_dashboard "/dashboard", metrics: LokalWeb.Telemetry, ecto_repos: [Lokal.Repo] + live_dashboard "/dashboard", metrics: CanneryWeb.Telemetry, ecto_repos: [Cannery.Repo] live "/invites", InviteLive.Index, :index live "/invites/new", InviteLive.Index, :new live "/invites/:id/edit", InviteLive.Index, :edit end - scope "/", LokalWeb do + scope "/", CanneryWeb do pipe_through [:browser] delete "/users/log_out", UserSessionController, :delete @@ -95,7 +95,7 @@ defmodule LokalWeb.Router do end scope "/dev" do - get "/preview/:id", LokalWeb.EmailController, :preview + get "/preview/:id", CanneryWeb.EmailController, :preview end end end diff --git a/lib/lokal_web/telemetry.ex b/lib/cannery_web/telemetry.ex similarity index 90% rename from lib/lokal_web/telemetry.ex rename to lib/cannery_web/telemetry.ex index 1966629..15a2dc8 100644 --- a/lib/lokal_web/telemetry.ex +++ b/lib/cannery_web/telemetry.ex @@ -1,4 +1,4 @@ -defmodule LokalWeb.Telemetry do +defmodule CanneryWeb.Telemetry do @moduledoc """ Collects telemetry """ @@ -35,23 +35,23 @@ defmodule LokalWeb.Telemetry do ), # Database Metrics - summary("lokal.repo.query.total_time", + summary("cannery.repo.query.total_time", unit: {:native, :millisecond}, description: "The sum of the other measurements" ), - summary("lokal.repo.query.decode_time", + summary("cannery.repo.query.decode_time", unit: {:native, :millisecond}, description: "The time spent decoding the data received from the database" ), - summary("lokal.repo.query.query_time", + summary("cannery.repo.query.query_time", unit: {:native, :millisecond}, description: "The time spent executing the query" ), - summary("lokal.repo.query.queue_time", + summary("cannery.repo.query.queue_time", unit: {:native, :millisecond}, description: "The time spent waiting for a database connection" ), - summary("lokal.repo.query.idle_time", + summary("cannery.repo.query.idle_time", unit: {:native, :millisecond}, description: "The time the connection spent waiting before being checked out for the query" @@ -93,7 +93,7 @@ defmodule LokalWeb.Telemetry do [ # A module, function and arguments to be invoked periodically. # This function must call :telemetry.execute/3 and a metric must be added above. - # {LokalWeb, :count_users, []} + # {CanneryWeb, :count_users, []} ] end end diff --git a/lib/lokal_web/templates/email/confirm_email.html.heex b/lib/cannery_web/templates/email/confirm_email.html.heex similarity index 77% rename from lib/lokal_web/templates/email/confirm_email.html.heex rename to lib/cannery_web/templates/email/confirm_email.html.heex index 5568a9b..ff6afc3 100644 --- a/lib/lokal_web/templates/email/confirm_email.html.heex +++ b/lib/cannery_web/templates/email/confirm_email.html.heex @@ -6,7 +6,7 @@
    - <%= dgettext("emails", "Welcome to Lokal") %> + <%= dgettext("emails", "Welcome to Cannery") %>
    @@ -19,5 +19,5 @@
    - <%= dgettext("emails", "If you didn't create an account at Lokal, please ignore this.") %> + <%= dgettext("emails", "If you didn't create an account at Cannery, please ignore this.") %>
  • diff --git a/lib/lokal_web/templates/email/confirm_email.txt.eex b/lib/cannery_web/templates/email/confirm_email.txt.eex similarity index 86% rename from lib/lokal_web/templates/email/confirm_email.txt.eex rename to lib/cannery_web/templates/email/confirm_email.txt.eex index 987f414..ab03d87 100644 --- a/lib/lokal_web/templates/email/confirm_email.txt.eex +++ b/lib/cannery_web/templates/email/confirm_email.txt.eex @@ -1,7 +1,7 @@ <%= dgettext("emails", "Hi %{email},", email: @user.email) %> -<%= dgettext("emails", "Welcome to Lokal") %> +<%= dgettext("emails", "Welcome to Cannery") %> <%= dgettext("emails", "You can confirm your account by visiting the URL below:") %> diff --git a/lib/lokal_web/templates/email/reset_password.html.heex b/lib/cannery_web/templates/email/reset_password.html.heex similarity index 93% rename from lib/lokal_web/templates/email/reset_password.html.heex rename to lib/cannery_web/templates/email/reset_password.html.heex index 87c46e2..e983b93 100644 --- a/lib/lokal_web/templates/email/reset_password.html.heex +++ b/lib/cannery_web/templates/email/reset_password.html.heex @@ -13,5 +13,5 @@
    - <%= dgettext("emails", "If you didn't request this change from Lokal, please ignore this.") %> + <%= dgettext("emails", "If you didn't request this change from Cannery, please ignore this.") %> diff --git a/lib/lokal_web/templates/email/reset_password.txt.eex b/lib/cannery_web/templates/email/reset_password.txt.eex similarity index 100% rename from lib/lokal_web/templates/email/reset_password.txt.eex rename to lib/cannery_web/templates/email/reset_password.txt.eex diff --git a/lib/lokal_web/templates/email/update_email.html.heex b/lib/cannery_web/templates/email/update_email.html.heex similarity index 86% rename from lib/lokal_web/templates/email/update_email.html.heex rename to lib/cannery_web/templates/email/update_email.html.heex index dc9a001..f32b527 100644 --- a/lib/lokal_web/templates/email/update_email.html.heex +++ b/lib/cannery_web/templates/email/update_email.html.heex @@ -15,6 +15,6 @@ <%= dgettext( "emails", - "If you didn't request this change from Lokal, please ignore this." + "If you didn't request this change from Cannery, please ignore this." ) %> diff --git a/lib/lokal_web/templates/email/update_email.txt.eex b/lib/cannery_web/templates/email/update_email.txt.eex similarity index 100% rename from lib/lokal_web/templates/email/update_email.txt.eex rename to lib/cannery_web/templates/email/update_email.txt.eex diff --git a/lib/lokal_web/templates/error/error.html.heex b/lib/cannery_web/templates/error/error.html.heex similarity index 83% rename from lib/lokal_web/templates/error/error.html.heex rename to lib/cannery_web/templates/error/error.html.heex index 923cf2f..1bead0b 100644 --- a/lib/lokal_web/templates/error/error.html.heex +++ b/lib/cannery_web/templates/error/error.html.heex @@ -5,7 +5,7 @@ - <%= dgettext("errors", "Error") %> | <%= gettext("Lokal") %> + <%= dgettext("errors", "Error") %> | <%= gettext("Cannery") %>