diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100755 index 000000000..0572a8c68 --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,49 @@ +#!/bin/sh + +# checks for filenames with non-ASCII characters +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=$(git hash-object -t tree /dev/null) +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --type=bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff-index --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi + +# runs pseudo-lint on staged files +git diff --name-only --cached | grep -E ".*\.(ex|exs)$" | xargs mix format --check-formatted + +PSEUDOLINT_STATUS=$? +if [ "$PSEUDOLINT_STATUS" != "0" ]; then + echo 'run `mix format` then use `git add` to restage the formatted file' + exit $PSEUDOLINT_STATUS +fi diff --git a/.github/workflows/hc-pkgcaller.yml b/.github/workflows/hc-pkgcaller.yml index 85e6a473e..702f36af8 100644 --- a/.github/workflows/hc-pkgcaller.yml +++ b/.github/workflows/hc-pkgcaller.yml @@ -1,11 +1,11 @@ name: hc-pkg on: - workflow_dispatch: - + workflow_dispatch: + jobs: hcpkgrelease: - uses: mozilla/hubs-ops/.github/workflows/HcPkgPreReleaseGitops.yaml@master + uses: Hubs-Foundation/hubs-ops/.github/workflows/HcPkgPreReleaseGitops.yaml@master with: main: master releaseTrackingBranch: polycosm - qaTestBranch: qa-test \ No newline at end of file + qaTestBranch: qa-test diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index f08ea51da..32c6cc18c 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -85,12 +85,17 @@ jobs: - elixir: '1.17' otp: '27.3' + - elixir: '1.18' + otp: '25.1' + - elixir: '1.18' + otp: '28.0' + os: - 'ubuntu-22.04' - 'ubuntu-24.04' exclude: - - versions: # current + - versions: # current versions; already tested above elixir: '1.16' otp: '25.3' @@ -142,23 +147,35 @@ jobs: pseudo-lint: - continue-on-error: true # TODO: use `mix format` & check in files, then set this false + continue-on-error: false # `mix format` MUST be run before committing strategy: fail-fast: false matrix: versions: - - elixir: '1.14' - otp: '24.3' - - - elixir: '1.15' - otp: '24.3' +# - elixir: '1.14' +# otp: '24.3' +# +# - elixir: '1.15' +# otp: '24.3' - elixir: '1.16' otp: '24.3' +# - elixir: '1.16' +# otp: '25.1' + - elixir: '1.17' otp: '25.3' +# - elixir: '1.18' +# otp: '25.1' + +# - elixir: '1.17' +# otp: '25.0' + + - elixir: '1.18' + otp: '28.0' + runs-on: 'ubuntu-24.04' steps: diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 498baa3fb..f6a5496ab 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,15 +1,9 @@ # Community Participation Guidelines -This repository is governed by Mozilla's code of conduct and etiquette guidelines. +This repository is governed by the Hubs Foundation's code of conduct and etiquette guidelines. For more details, please read the -[Mozilla Community Participation Guidelines](https://www.mozilla.org/about/governance/policies/participation/). +[Hubs Community Participation Guidelines](https://github.com/Hubs-Foundation/hubs/blob/master/CODE_OF_CONDUCT.md). ## How to Report -For more information on how to report violations of the Community Participation Guidelines, please read our '[How to Report](https://www.mozilla.org/about/governance/policies/participation/reporting/)' page. +For more information on how to report violations of the Community Participation Guidelines, please read our '[How to Report](https://github.com/Hubs-Foundation/hubs/blob/master/CODE_OF_CONDUCT.md)' page. - diff --git a/Jenkinsfile b/Jenkinsfile index 748410fc2..1c4e54e72 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,7 +17,7 @@ pipeline { stage('build') { steps { sh ''' - /usr/bin/script --return -c \\\\"sudo /usr/bin/hab-docker-studio -k mozillareality run /bin/bash scripts/build.sh\\\\" /dev/null + /usr/bin/script --return -c \\\\"sudo /usr/bin/hab-docker-studio -k Hubs-Foundation run /bin/bash scripts/build.sh\\\\" /dev/null ''' sh 'sudo /usr/bin/hab-pkg-upload $(ls -t results/*.hart | head -n 1)' @@ -58,9 +58,9 @@ pipeline { def text = ( "** *${jobName}* " + "\n" + - " " + + " " + "Reticulum -> ${retPoolIcon} `${retPool}`: ```${gitSha} ${gitMessage}```\n" + - " - to push:\n" + + " - to push:\n" + "`/mr ret deploy ${retVersion} ${retPool}`" ) sendSlackMessage(text, "#mr-builds", ":gift:", slackURL); @@ -73,7 +73,7 @@ pipeline { def text = ( "** *${jobName}* " + "\n" + - " " + + " " + "${packageIdent} built and uploaded - to promote:\n" + "`/mr promote-ret-qa ${packageIdent}`" ) diff --git a/README.md b/README.md index 60f53678c..f2d747acb 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Reticulum -Note: **Due to our small team size, we don't support setting up Reticulum locally due to restrictions on developer credentials. Although relatively difficult and new territory, you're welcome to set up this up yourself. In addition to running Reticulum locally, you'll need to also run [Hubs](https://github.com/mozilla/hubs) and [Dialog](https://github.com/mozilla/dialog) locally because the developer Dialog server is locked down and your local Reticulum will not connect properly)** +Note: **Due to our small team size, we don't support setting up Reticulum locally due to restrictions on developer credentials. Although relatively difficult and new territory, you're welcome to set up this up yourself. In addition to running Reticulum locally, you'll need to also run [Hubs](https://github.com/Hubs-Foundation/hubs) and [Dialog](https://github.com/Hubs-Foundation/dialog) locally because the developer Dialog server is locked down and your local Reticulum will not connect properly)** -Reference [this discussion thread](https://github.com/mozilla/hubs/discussions/3323) for more information. +Reference [this discussion thread](https://github.com/Hubs-Foundation/hubs/discussions/3323) for more information. A hybrid game networking and web API server, focused on Social Mixed Reality. @@ -37,7 +37,14 @@ https://hexdocs.pm/phoenix/installation.html https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html -### 2. Setup Reticulum: +### 2. Enable git hooks + +Run +```shell +. scripts/setup.sh +``` + +### 3. Setup Reticulum: Run the following commands at the root of the reticulum directory: @@ -48,7 +55,7 @@ Run the following commands at the root of the reticulum directory: - If you receive an error that the `ret_dev` database does not exist, (using psql again) enter `create database ret_dev;` 3. From the project directory `mkdir -p storage/dev` -### 3. Start Reticulum +### 4. Start Reticulum Run `scripts/run.sh` if you have the hubs secret repo cloned. Otherwise `iex -S mix phx.server` @@ -79,7 +86,7 @@ Example: Clone the Hubs repository and install the npm dependencies. ```bash -git clone https://github.com/mozilla/hubs.git +git clone https://github.com/Hubs-Foundation/hubs.git cd hubs npm ci ``` diff --git a/bin/README.md b/bin/README.md index e06c44a0b..f99279943 100644 --- a/bin/README.md +++ b/bin/README.md @@ -1,5 +1,5 @@ bin/ ==== These scripts allow you to run common commands inside the -[Hubs Compose](https://github.com/mozilla/hubs-compose) Reticulum container +[Hubs Compose](https://github.com/Hubs-Foundation/hubs-compose) Reticulum container from your own shell diff --git a/config/dev.exs b/config/dev.exs index 2da1f4fc3..b4f6f14db 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -156,7 +156,7 @@ config :ret, RetWeb.Plugs.AddCSP, font_src: asset_hosts, style_src: asset_hosts, connect_src: - "https://#{host}:8080 https://sentry.prod.mozaws.net #{asset_hosts} #{websocket_hosts} https://www.mozilla.org", + "https://#{host}:8080 #{asset_hosts} #{websocket_hosts} https://hubsfoundation.org", img_src: asset_hosts, media_src: asset_hosts, manifest_src: asset_hosts @@ -174,7 +174,7 @@ config :ret, Ret.Guardian, ttl: {12, :weeks} config :web_push_encryption, :vapid_details, - subject: "mailto:admin@mozilla.com", + subject: "mailto:admin@hubsfoundation.org", public_key: "BAb03820kHYuqIvtP6QuCKZRshvv_zp5eDtqkuwCUAxASBZMQbFZXzv8kjYOuLGF16A3k8qYnIN10_4asB-Aw7w", # This config value is for local development only. diff --git a/config/test.exs b/config/test.exs index 9c1cf1b9c..975ed277e 100644 --- a/config/test.exs +++ b/config/test.exs @@ -51,7 +51,7 @@ config :sentry, config :ret, Ret.Repo.Migrations.AdminSchemaInit, postgrest_password: "password" config :ret, Ret.Locking, lock_timeout_ms: 1000 * 60 * 15 -config :ret, Ret.Account, admin_email: "admin@mozilla.com" +config :ret, Ret.Account, admin_email: "admin@hubsfoundation.org" config :ret, RetWeb.HubChannel, enable_terminate_actions: false diff --git a/habitat/plan.sh b/habitat/plan.sh index 1ef763165..d02bda512 100644 --- a/habitat/plan.sh +++ b/habitat/plan.sh @@ -1,8 +1,8 @@ pkg_name=reticulum -pkg_origin=mozillareality +pkg_origin=hubsfoundation pkg_version="1.0.1" -pkg_maintainer="Mozilla Mixed Reality " -pkg_upstream_url="http://github.com/mozilla/reticulum" +pkg_maintainer="Hubs Foundation " +pkg_upstream_url="http://github.com/Hubs-Foundation/reticulum" pkg_license=('MPL-2.0') pkg_deps=( core/coreutils/8.30/20190115012313 @@ -12,8 +12,8 @@ pkg_deps=( pkg_build_deps=( core/coreutils/8.30/20190115012313 core/git/2.23.0 - mozillareality/erlang/23.3.4.18 - mozillareality/elixir/1.14.3 + hubsfoundation/erlang/23.3.4.18 + hubsfoundation/elixir/1.14.3 ) pkg_exports=( [port]=phx.port diff --git a/lib/ret/media_resolver.ex b/lib/ret/media_resolver.ex index 43d162e14..00b9b3e05 100644 --- a/lib/ret/media_resolver.ex +++ b/lib/ret/media_resolver.ex @@ -81,7 +81,6 @@ defmodule Ret.MediaResolver do |> resolved()} end - # Necessary short circuit around google.com root_host to skip YT-DL check for Poly def resolve(%MediaResolverQuery{url: %URI{host: "api.icosa.gallery"}} = query, root_host) do rate_limited_resolve(query, root_host, @icosa_rate_limit, fn -> resolve_non_video(query, root_host) @@ -338,7 +337,7 @@ defmodule Ret.MediaResolver do defp resolve_non_video( %MediaResolverQuery{ - url: %URI{host: "api.icosa.gallery", path: "/v1/assets/" <> asset_id} = uri + url: %URI{host: "api.icosa.gallery", path: "/v1/assets/" <> asset_id} }, "icosa.gallery" ) do diff --git a/lib/ret/storage_used.ex b/lib/ret/storage_used.ex index bbe6e5f63..53931bf57 100644 --- a/lib/ret/storage_used.ex +++ b/lib/ret/storage_used.ex @@ -29,7 +29,7 @@ defmodule Ret.StorageUsed do line = lines |> String.split("\n") |> Enum.at(1) {:ok, [_FS, _kb, used, _Avail], _RestStr} = - :io_lib.fread('~s~d~d~d', line |> to_charlist) + :io_lib.fread(~c"~s~d~d~d", line |> to_charlist) {:ok, [{:storage_used, used}]} diff --git a/lib/ret_web/controllers/api/v1/slack_controller.ex b/lib/ret_web/controllers/api/v1/slack_controller.ex index 26e253025..e956abd24 100644 --- a/lib/ret_web/controllers/api/v1/slack_controller.ex +++ b/lib/ret_web/controllers/api/v1/slack_controller.ex @@ -6,7 +6,7 @@ defmodule RetWeb.Api.V1.SlackController do plug RetWeb.Plugs.RateLimit @slack_api_base "https://slack.com" - @help_prefix "Hi! I'm the Hubs bot. I connect Slack channels with rooms on Hubs (https://hubs.mozilla.com/). Type `/hubs help` for more information." + @help_prefix "Hi! I'm the Hubs bot. I connect Slack channels with rooms on Hubs (https://hubsfoundation.org/). Type `/hubs help` for more information." @help_text "Command reference:\n\n" <> "🦆 `/hubs help` - Shows the help text you're reading right now.\n" <> "🦆 `/hubs create` - Creates a default Hubs room and puts its URL into the channel topic. " <> diff --git a/lib/ret_web/controllers/api/v1/whats_new_controller.ex b/lib/ret_web/controllers/api/v1/whats_new_controller.ex index a1da8fbe6..936daf548 100644 --- a/lib/ret_web/controllers/api/v1/whats_new_controller.ex +++ b/lib/ret_web/controllers/api/v1/whats_new_controller.ex @@ -31,10 +31,10 @@ defmodule RetWeb.Api.V1.WhatsNewController do do: [] defp fetch_pull_requests("hubs" = _source, cursor, token), - do: fetch_pull_requests("mozilla", "hubs", cursor, token) + do: fetch_pull_requests("Hubs-Foundation", "hubs", cursor, token) defp fetch_pull_requests("spoke" = _source, cursor, token), - do: fetch_pull_requests("mozilla", "spoke", cursor, token) + do: fetch_pull_requests("Hubs-Foundation", "spoke", cursor, token) defp fetch_pull_requests(_source, _cursor, _token), do: [] diff --git a/lib/ret_web/controllers/page_controller.ex b/lib/ret_web/controllers/page_controller.ex index 028649b19..8287b5a63 100644 --- a/lib/ret_web/controllers/page_controller.ex +++ b/lib/ret_web/controllers/page_controller.ex @@ -831,7 +831,7 @@ defmodule RetWeb.PageController do make_reverse_proxy_request(conn, url, body, is_head, opts) end - {:ok, %HTTPoison.Response{status_code: status_code}} -> + {:ok, %HTTPoison.Response{}} -> # Not a redirect, use ReverseProxyPlug for the actual request make_reverse_proxy_request(conn, url, body, is_head, opts) diff --git a/lib/ret_web/templates/page/index.html.eex b/lib/ret_web/templates/page/index.html.eex index 0504e406e..dac5adc5e 100644 --- a/lib/ret_web/templates/page/index.html.eex +++ b/lib/ret_web/templates/page/index.html.eex @@ -1,10 +1,6 @@
-
-
diff --git a/priv/static/spoke-preview.png b/priv/static/spoke-preview.png index 60ba224ac..a9ee4d093 100644 Binary files a/priv/static/spoke-preview.png and b/priv/static/spoke-preview.png differ diff --git a/scripts/build.sh b/scripts/build.sh index eadf6bb42..a7873dda3 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -13,7 +13,7 @@ pushd "$DIR/.." pkg_test_deps=( core/git - mozillareality/postgresql + hubsfoundation/postgresql ) export LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 @@ -34,7 +34,7 @@ ln -s "$(hab pkg path core/coreutils)/bin/env" /usr/bin/env deps="$(join_by " " "${pkg_deps[@]}") $(join_by " " "${pkg_build_deps[@]}") $(join_by " " "${pkg_test_deps[@]}")" hab pkg install -b $deps -hab svc load mozillareality/postgresql & +hab svc load hubsfoundation/postgresql & while ! [ -f /hab/svc/postgresql/PID ] ; do sleep 1; done MIX_ENV=test @@ -47,7 +47,7 @@ TEST_EXIT_CODE=$? echo "Test and build exit code: $TEST_EXIT_CODE" -hab svc unload mozillareality/postgresql +hab svc unload hubsfoundation/postgresql popd exit $TEST_EXIT_CODE diff --git a/scripts/hab-wrap-and-push.sh b/scripts/hab-wrap-and-push.sh index ade3e3c8c..a2f460732 100644 --- a/scripts/hab-wrap-and-push.sh +++ b/scripts/hab-wrap-and-push.sh @@ -13,14 +13,14 @@ dl="https://github.com/$org/$repo/releases/download/$ver/bio-${ver#"v"}-x86_64-l echo "[info] getting bio from: $dl" && curl -L -o bio.gz $dl && tar -xf bio.gz cp ./bio /usr/bin/bio && bio --version -export HAB_ORIGIN=mozillareality +export HAB_ORIGIN=hubsfoundation mkdir -p /hab/cache/keys/ mkdir -p ./hab/cache/keys/ -echo $BLDR_RET_PUB_B64 | base64 -d > /hab/cache/keys/mozillareality-20190117233449.pub -echo $BLDR_RET_PUB_B64 | base64 -d > ./hab/cache/keys/mozillareality-20190117233449.pub -echo $BLDR_HAB_PVT_B64 | base64 -d > /hab/cache/keys/mozillareality-20190117233449.sig.key -echo $BLDR_HAB_PVT_B64 | base64 -d > /hab/cache/keys/mozillareality-20190117233449.sig.key +echo $BLDR_RET_PUB_B64 | base64 -d > /hab/cache/keys/hubsfoundation-20190117233449.pub +echo $BLDR_RET_PUB_B64 | base64 -d > ./hab/cache/keys/hubsfoundation-20190117233449.pub +echo $BLDR_HAB_PVT_B64 | base64 -d > /hab/cache/keys/hubsfoundation-20190117233449.sig.key +echo $BLDR_HAB_PVT_B64 | base64 -d > /hab/cache/keys/hubsfoundation-20190117233449.sig.key echo "### build hab pkg" export HAB_AUTH_TOKEN=$BLDR_HAB_TOKEN @@ -31,10 +31,10 @@ cp -r /ret/* /repo/ret/ cd /repo cat > habitat/plan.sh << 'EOF' pkg_name=reticulum -pkg_origin=mozillareality +pkg_origin=hubsfoundation pkg_version="1.0.1" -pkg_maintainer="Mozilla Mixed Reality " -pkg_upstream_url="http://github.com/mozilla/reticulum" +pkg_maintainer="Hubs Foundation " +pkg_upstream_url="http://github.com/Hubs-Foundation/reticulum" pkg_license=('MPL-2.0') pkg_deps=( core/coreutils/8.32/20220311101609 @@ -46,8 +46,8 @@ pkg_deps=( pkg_build_deps=( core/coreutils/8.32/20220311101609 core/git/2.23.0 - mozillareality/erlang/23.3.4.18 - mozillareality/elixir/1.14.3 + hubsfoundation/erlang/23.3.4.18 + hubsfoundation/elixir/1.14.3 ) pkg_exports=( [port]=phx.port @@ -97,15 +97,15 @@ do_end() { return 0 } EOF -bio pkg build -k mozillareality . +bio pkg build -k hubsfoundation . ### upload echo "### upload hab pkg" export HAB_BLDR_URL="https://bldr.reticulum.io" export HAB_AUTH_TOKEN=$BLDR_RET_TOKEN -export HAB_ORIGIN_KEYS=mozillareality_ret -echo $BLDR_RET_PUB_B64 | base64 -d > /hab/cache/keys/mozillareality-20190117233449.pub -# cat /hab/cache/keys/mozillareality-20190117233449.pub +export HAB_ORIGIN_KEYS=hubsfoundation_ret +echo $BLDR_RET_PUB_B64 | base64 -d > /hab/cache/keys/hubsfoundation-20190117233449.pub +# cat /hab/cache/keys/hubsfoundation-20190117233449.pub hart="/hab/cache/artifacts/$HAB_ORIGIN-reticulum*.hart" ls -lha $hart bio pkg upload $hart diff --git a/scripts/setup.sh b/scripts/setup.sh new file mode 100755 index 000000000..85198b184 --- /dev/null +++ b/scripts/setup.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +git config --local core.hooksPath .githooks/ + +mix deps.get + +#TODO: move other setup commands here diff --git a/test/ret/account_test.exs b/test/ret/account_test.exs index 3e4fc6754..c4eb6e4b3 100644 --- a/test/ret/account_test.exs +++ b/test/ret/account_test.exs @@ -4,29 +4,29 @@ defmodule Ret.AccountTest do alias Ret.{Account} test "create new account based on email" do - account = Account.find_or_create_account_for_email("test@mozilla.com") - assert account.login.identifier_hash == Ret.Crypto.hash("test@mozilla.com") + account = Account.find_or_create_account_for_email("test@hubsfoundation.org") + assert account.login.identifier_hash == Ret.Crypto.hash("test@hubsfoundation.org") end test "ensure the admin account, but not subsequent accounts, are admins" do - account = Account.find_or_create_account_for_email("admin@mozilla.com") - account2 = Account.find_or_create_account_for_email("test2@mozilla.com") - account3 = Account.find_or_create_account_for_email("test3@mozilla.com") + account = Account.find_or_create_account_for_email("admin@hubsfoundation.org") + account2 = Account.find_or_create_account_for_email("test2@hubsfoundation.org") + account3 = Account.find_or_create_account_for_email("test3@hubsfoundation.org") assert account.is_admin === true assert account2.is_admin === false assert account3.is_admin === false end test "re-use same account when queried twice, case-insensitive" do - account = Account.find_or_create_account_for_email("test@mozilla.com") - account2 = Account.find_or_create_account_for_email("TEST@mozilla.com") + account = Account.find_or_create_account_for_email("test@hubsfoundation.org") + account2 = Account.find_or_create_account_for_email("TEST@hubsfoundation.org") assert account.account_id == account2.account_id assert account.login.login_id == account2.login.login_id end test "can assign and re-assign identity" do - account = Account.find_or_create_account_for_email("test@mozilla.com") + account = Account.find_or_create_account_for_email("test@hubsfoundation.org") account = account |> Account.set_identity!("Test User") assert account.identity diff --git a/test/ret/api_token_test.exs b/test/ret/api_token_test.exs index 0d6806702..803800786 100644 --- a/test/ret/api_token_test.exs +++ b/test/ret/api_token_test.exs @@ -33,7 +33,7 @@ defmodule Ret.ApiTokenTest do end test "Api tokens can be associated with an account" do - account = Ret.Account.find_or_create_account_for_email("test@mozilla.com") + account = Ret.Account.find_or_create_account_for_email("test@hubsfoundation.org") {:ok, token, _claims} = TokenUtils.gen_token_for_account(account) {:ok, credentials, _claims} = Guardian.resource_from_token(Ret.Api.Token, token) assert credentials.account_id === account.account_id diff --git a/test/ret/avatar_listing_test.exs b/test/ret/avatar_listing_test.exs index 38d4b4c4b..282ae1c45 100644 --- a/test/ret/avatar_listing_test.exs +++ b/test/ret/avatar_listing_test.exs @@ -11,8 +11,8 @@ defmodule Ret.AvatarListingTest do end setup _context do - account_1 = Account.find_or_create_account_for_email("test@mozilla.com") - account_2 = Account.find_or_create_account_for_email("test2@mozilla.com") + account_1 = Account.find_or_create_account_for_email("test@hubsfoundation.org") + account_2 = Account.find_or_create_account_for_email("test2@hubsfoundation.org") account_1_avatar_1 = create_avatar(account_1) account_1_avatar_2 = create_avatar(account_1) diff --git a/test/ret/guardian_test.exs b/test/ret/guardian_test.exs index e99444d0b..5f1e202eb 100644 --- a/test/ret/guardian_test.exs +++ b/test/ret/guardian_test.exs @@ -5,7 +5,7 @@ defmodule Ret.GuardianTest do alias Ret.{Account, Guardian, Repo} test "retrieve account from token" do - account = Account.find_or_create_account_for_email("test@mozilla.com") + account = Account.find_or_create_account_for_email("test@hubsfoundation.org") token = account |> Account.credentials_for_account() {:ok, account2, _claims} = Guardian.resource_from_token(token) @@ -14,12 +14,12 @@ defmodule Ret.GuardianTest do end test "avoid creation when looking up" do - Account.account_for_email("test@mozilla.com") - refute Account.exists_for_email?("test@mozilla.com") + Account.account_for_email("test@hubsfoundation.org") + refute Account.exists_for_email?("test@hubsfoundation.org") end test "does not retrieve account from revoked token" do - account = Account.find_or_create_account_for_email("test@mozilla.com") + account = Account.find_or_create_account_for_email("test@hubsfoundation.org") token = account |> Account.credentials_for_account() date = Timex.now() |> Timex.shift(seconds: 1) |> DateTime.truncate(:second) diff --git a/test/ret/hub_test.exs b/test/ret/hub_test.exs index d0274160c..ef274e366 100644 --- a/test/ret/hub_test.exs +++ b/test/ret/hub_test.exs @@ -16,7 +16,9 @@ defmodule Ret.HubTest do close_hub: false, mute_users: false, amplify_audio: false - } = hub |> Hub.perms_for_account(Ret.Account.account_for_email("non-creator@mozilla.com")) + } = + hub + |> Hub.perms_for_account(Ret.Account.account_for_email("non-creator@hubsfoundation.org")) end test "should deny permissions for anon", %{scene: scene} do diff --git a/test/ret/login_token_test.exs b/test/ret/login_token_test.exs index bef56c5e3..0f3654410 100644 --- a/test/ret/login_token_test.exs +++ b/test/ret/login_token_test.exs @@ -4,19 +4,19 @@ defmodule Ret.LoginTokenTest do alias Ret.LoginToken test "should generate valid changeset for email" do - changeset = LoginToken.changeset_for_email(%LoginToken{}, "test@mozilla.com") + changeset = LoginToken.changeset_for_email(%LoginToken{}, "test@hubsfoundation.org") assert changeset.valid? end test "should generate a valid token" do - %LoginToken{token: token} = LoginToken.new_login_token_for_email("test@mozilla.com") + %LoginToken{token: token} = LoginToken.new_login_token_for_email("test@hubsfoundation.org") assert LoginToken.lookup_by_token(token).identifier_hash == - Ret.Crypto.hash("test@mozilla.com") + Ret.Crypto.hash("test@hubsfoundation.org") end test "should allow expiring a token" do - %LoginToken{token: token} = LoginToken.new_login_token_for_email("test@mozilla.com") + %LoginToken{token: token} = LoginToken.new_login_token_for_email("test@hubsfoundation.org") LoginToken.expire(token) assert LoginToken.lookup_by_token(token) == nil end diff --git a/test/ret_web/channels/auth_channel_test.exs b/test/ret_web/channels/auth_channel_test.exs index ad0284054..a0f6923bb 100644 --- a/test/ret_web/channels/auth_channel_test.exs +++ b/test/ret_web/channels/auth_channel_test.exs @@ -6,8 +6,8 @@ defmodule RetWeb.AuthChannelTest do alias RetWeb.{SessionSocket} alias Ret.{Account, AppConfig, Repo} - @test_email "admin1@mozilla.com" - @test_email2 "admin2@mozilla.com" + @test_email "admin1@hubsfoundation.org" + @test_email2 "admin2@hubsfoundation.org" setup [:create_account] @@ -48,10 +48,14 @@ defmodule RetWeb.AuthChannelTest do disabled_account = create_account("disabled_account") disabled_account |> Ecto.Changeset.change(state: :disabled) |> Ret.Repo.update!() - push(socket, "auth_request", %{"email" => "disabled_account@mozilla.com", "origin" => "test"}) + push(socket, "auth_request", %{ + "email" => "disabled_account@hubsfoundation.org", + "origin" => "test" + }) + :timer.sleep(500) - refute login_token_for_email_exists?("disabled_account@mozilla.com") + refute login_token_for_email_exists?("disabled_account@hubsfoundation.org") end defp login_token_for_email_exists?(email) do diff --git a/test/ret_web/controllers/api/account_controller_test.exs b/test/ret_web/controllers/api/account_controller_test.exs index a00931602..5abe39217 100644 --- a/test/ret_web/controllers/api/account_controller_test.exs +++ b/test/ret_web/controllers/api/account_controller_test.exs @@ -17,37 +17,39 @@ defmodule RetWeb.AccountControllerTest do account = create_random_account() {:ok, token, _params} = account |> Ret.Guardian.encode_and_sign() conn = conn |> Plug.Conn.put_req_header("authorization", "bearer: " <> token) - req = conn |> api_v1_account_path(:create, %{data: %{email: "testapi@mozilla.com"}}) + req = conn |> api_v1_account_path(:create, %{data: %{email: "testapi@hubsfoundation.org"}}) conn = conn |> post(req) - assert !Account.exists_for_email?("testapi@mozilla.com") + assert !Account.exists_for_email?("testapi@hubsfoundation.org") assert conn.status === 401 assert conn.resp_body === "Not authorized" end test "admins can create accounts", %{conn: conn} do - req = conn |> api_v1_account_path(:create, %{data: %{email: "testapi@mozilla.com"}}) + req = conn |> api_v1_account_path(:create, %{data: %{email: "testapi@hubsfoundation.org"}}) res = conn |> post(req) |> response(200) |> Poison.decode!() - account = Account.account_for_email("testapi@mozilla.com") + account = Account.account_for_email("testapi@hubsfoundation.org") assert account assert res["data"]["id"] === "#{account.account_id}" - assert res["data"]["login"]["email"] === "testapi@mozilla.com" + assert res["data"]["login"]["email"] === "testapi@hubsfoundation.org" end test "admins can create accounts with identities", %{conn: conn} do req = conn - |> api_v1_account_path(:create, %{data: %{email: "testapi@mozilla.com", name: "Test User"}}) + |> api_v1_account_path(:create, %{ + data: %{email: "testapi@hubsfoundation.org", name: "Test User"} + }) res = conn |> post(req) |> response(200) |> Poison.decode!() - account = Account.account_for_email("testapi@mozilla.com") + account = Account.account_for_email("testapi@hubsfoundation.org") assert account assert res["data"]["id"] === "#{account.account_id}" - assert res["data"]["login"]["email"] === "testapi@mozilla.com" + assert res["data"]["login"]["email"] === "testapi@hubsfoundation.org" assert res["data"]["identity"]["name"] === "Test User" end @@ -61,17 +63,17 @@ defmodule RetWeb.AccountControllerTest do "/api/v1/accounts", Poison.encode!(%{ data: [ - %{email: "testapi@mozilla.com", name: "Test User New"}, - %{email: "testapi2@mozilla.com", name: "Test User 2 New"} + %{email: "testapi@hubsfoundation.org", name: "Test User New"}, + %{email: "testapi2@hubsfoundation.org", name: "Test User 2 New"} ] }) ) |> response(207) - account = Account.account_for_email("testapi@mozilla.com") + account = Account.account_for_email("testapi@hubsfoundation.org") assert account.identity.name === "Test User New" - account = Account.account_for_email("testapi2@mozilla.com") + account = Account.account_for_email("testapi2@hubsfoundation.org") assert account.identity.name === "Test User 2 New" end @@ -80,16 +82,16 @@ defmodule RetWeb.AccountControllerTest do conn |> api_v1_account_path(:create, %{ data: [ - %{email: "testapi1@mozilla.com"}, - %{email: "testapi2@mozilla.com"}, + %{email: "testapi1@hubsfoundation.org"}, + %{email: "testapi2@hubsfoundation.org"}, %{email: "invalidemail"} ] }) res = conn |> post(req) |> response(207) |> Poison.decode!() - account1 = Account.account_for_email("testapi1@mozilla.com") - account2 = Account.account_for_email("testapi2@mozilla.com") + account1 = Account.account_for_email("testapi1@hubsfoundation.org") + account2 = Account.account_for_email("testapi2@hubsfoundation.org") result1 = res |> Enum.at(0) result2 = res |> Enum.at(1) result3 = res |> Enum.at(2) @@ -98,10 +100,10 @@ defmodule RetWeb.AccountControllerTest do assert account2 assert result1["status"] === 200 assert result1["body"]["data"]["id"] === "#{account1.account_id}" - assert result1["body"]["data"]["login"]["email"] === "testapi1@mozilla.com" + assert result1["body"]["data"]["login"]["email"] === "testapi1@hubsfoundation.org" assert result2["status"] === 200 assert result2["body"]["data"]["id"] === "#{account2.account_id}" - assert result2["body"]["data"]["login"]["email"] === "testapi2@mozilla.com" + assert result2["body"]["data"]["login"]["email"] === "testapi2@hubsfoundation.org" assert result3["status"] === 400 assert result3["body"]["errors"] |> Enum.at(0) |> Map.get("code") === "MALFORMED_RECORD" end @@ -127,7 +129,7 @@ defmodule RetWeb.AccountControllerTest do end test "should return 409 if account exists", %{conn: conn} do - req = conn |> api_v1_account_path(:create, %{data: %{email: "test@mozilla.com"}}) + req = conn |> api_v1_account_path(:create, %{data: %{email: "test@hubsfoundation.org"}}) conn |> post(req) |> response(409) end @@ -135,7 +137,7 @@ defmodule RetWeb.AccountControllerTest do account = create_random_account() {:ok, token, _params} = account |> Ret.Guardian.encode_and_sign() conn = conn |> Plug.Conn.put_req_header("authorization", "bearer: " <> token) - req = conn |> api_v1_account_search_path(:create, %{email: "unknown@mozilla.com"}) + req = conn |> api_v1_account_search_path(:create, %{email: "unknown@hubsfoundation.org"}) conn = conn |> post(req) assert conn.status === 401 @@ -143,17 +145,17 @@ defmodule RetWeb.AccountControllerTest do end test "should return 404 if no such account exists", %{conn: conn} do - req = conn |> api_v1_account_search_path(:create, %{email: "unknown@mozilla.com"}) + req = conn |> api_v1_account_search_path(:create, %{email: "unknown@hubsfoundation.org"}) conn = conn |> post(req) assert conn.status === 404 end test "should return account if account exists", %{conn: conn} do - req = conn |> api_v1_account_search_path(:create, %{email: "test@mozilla.com"}) + req = conn |> api_v1_account_search_path(:create, %{email: "test@hubsfoundation.org"}) res = conn |> post(req) |> response(200) |> Poison.decode!() - account = Account.account_for_email("test@mozilla.com") + account = Account.account_for_email("test@hubsfoundation.org") record = res["data"] |> Enum.at(0) assert record["id"] === "#{account.account_id}" diff --git a/test/ret_web/controllers/api/app_config_controller_test.exs b/test/ret_web/controllers/api/app_config_controller_test.exs index 3f515fc56..4800d9341 100644 --- a/test/ret_web/controllers/api/app_config_controller_test.exs +++ b/test/ret_web/controllers/api/app_config_controller_test.exs @@ -8,7 +8,7 @@ defmodule RetWeb.AppConfigControllerTest do test "admins can create app configs", %{conn: conn} do conn - |> Ret.TestHelpers.put_auth_header_for_email("admin@mozilla.com") + |> Ret.TestHelpers.put_auth_header_for_email("admin@hubsfoundation.org") |> create_app_config(%{"test-config" => "foo"}) |> response(200) @@ -18,7 +18,7 @@ defmodule RetWeb.AppConfigControllerTest do test "non-admins cannot create app configs", %{conn: conn} do %{status: 401} = conn - |> Ret.TestHelpers.put_auth_header_for_email("test2@mozilla.com") + |> Ret.TestHelpers.put_auth_header_for_email("test2@hubsfoundation.org") |> create_app_config(%{"test-config" => "bar"}) end diff --git a/test/ret_web/controllers/api/assets_controller_test.exs b/test/ret_web/controllers/api/assets_controller_test.exs index 7d887f70f..16e897cc4 100644 --- a/test/ret_web/controllers/api/assets_controller_test.exs +++ b/test/ret_web/controllers/api/assets_controller_test.exs @@ -54,7 +54,7 @@ defmodule RetWeb.AssetsControllerTest do conn: conn, thumbnail_owned_file: thumbnail_owned_file } do - other_account = Account.account_for_email("test2@mozilla.com") + other_account = Account.account_for_email("test2@hubsfoundation.org") {:ok, asset} = %Asset{} diff --git a/test/ret_web/controllers/api/hub_controller_test.exs b/test/ret_web/controllers/api/hub_controller_test.exs index 6a885765b..f879f65b4 100644 --- a/test/ret_web/controllers/api/hub_controller_test.exs +++ b/test/ret_web/controllers/api/hub_controller_test.exs @@ -28,7 +28,7 @@ defmodule RetWeb.HubControllerTest do disabled_account |> Ecto.Changeset.change(state: :disabled) |> Ret.Repo.update!() conn - |> put_auth_header_for_email("disabled_account@mozilla.com") + |> put_auth_header_for_email("disabled_account@hubsfoundation.org") |> create_hub("Test Hub") |> response(401) end @@ -42,7 +42,7 @@ defmodule RetWeb.HubControllerTest do created_hub = Hub |> Repo.get_by(hub_sid: hub_id) |> Repo.preload(:created_by_account) - created_account = Ret.Account.account_for_email("test@mozilla.com") + created_account = Ret.Account.account_for_email("test@hubsfoundation.org") assert created_hub.created_by_account.account_id == created_account.account_id end diff --git a/test/ret_web/controllers/api/media_search_controller_test.exs b/test/ret_web/controllers/api/media_search_controller_test.exs index 240bc884b..a76bceb1a 100644 --- a/test/ret_web/controllers/api/media_search_controller_test.exs +++ b/test/ret_web/controllers/api/media_search_controller_test.exs @@ -11,9 +11,9 @@ defmodule RetWeb.MediaSearchControllerTest do end setup _context do - account_1 = Account.find_or_create_account_for_email("test@mozilla.com") - account_2 = Account.find_or_create_account_for_email("test2@mozilla.com") - account_3 = Account.find_or_create_account_for_email("test3@mozilla.com") + account_1 = Account.find_or_create_account_for_email("test@hubsfoundation.org") + account_2 = Account.find_or_create_account_for_email("test2@hubsfoundation.org") + account_3 = Account.find_or_create_account_for_email("test3@hubsfoundation.org") scene_1 = create_scene(account_1) scene_2 = create_scene(account_2) diff --git a/test/ret_web/controllers/api/project_assets_controller_test.exs b/test/ret_web/controllers/api/project_assets_controller_test.exs index c9fa83e14..b03aad385 100644 --- a/test/ret_web/controllers/api/project_assets_controller_test.exs +++ b/test/ret_web/controllers/api/project_assets_controller_test.exs @@ -149,7 +149,7 @@ defmodule RetWeb.ProjectAssetsControllerTest do project_owned_file: project_owned_file, thumbnail_owned_file: thumbnail_owned_file } do - other_account = Account.account_for_email("test2@mozilla.com") + other_account = Account.account_for_email("test2@hubsfoundation.org") {:ok, project} = %Project{} diff --git a/test/ret_web/controllers/api/projects_controller_test.exs b/test/ret_web/controllers/api/projects_controller_test.exs index cd1601bdf..e4c530304 100644 --- a/test/ret_web/controllers/api/projects_controller_test.exs +++ b/test/ret_web/controllers/api/projects_controller_test.exs @@ -226,7 +226,7 @@ defmodule RetWeb.ProjectsControllerTest do project_owned_file: project_owned_file, thumbnail_owned_file: thumbnail_owned_file } do - other_account = Account.find_or_create_account_for_email("test2@mozilla.com") + other_account = Account.find_or_create_account_for_email("test2@hubsfoundation.org") {:ok, project} = %Project{} diff --git a/test/ret_web/controllers/api/scene_controller_test.exs b/test/ret_web/controllers/api/scene_controller_test.exs index 67301c0c2..0047d31da 100644 --- a/test/ret_web/controllers/api/scene_controller_test.exs +++ b/test/ret_web/controllers/api/scene_controller_test.exs @@ -61,7 +61,7 @@ defmodule RetWeb.SceneControllerTest do scene: scene } do {:ok, token, _claims} = - "test2@mozilla.com" + "test2@hubsfoundation.org" |> Ret.Account.find_or_create_account_for_email() |> Ret.Guardian.encode_and_sign() diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex index be9c68b3b..2e6c80a25 100644 --- a/test/support/conn_case.ex +++ b/test/support/conn_case.ex @@ -38,7 +38,7 @@ defmodule RetWeb.ConnCase do conn = if tags[:authenticated] do - conn |> Ret.TestHelpers.put_auth_header_for_email("test@mozilla.com") + conn |> Ret.TestHelpers.put_auth_header_for_email("test@hubsfoundation.org") else conn end diff --git a/test/support/test_helpers.ex b/test/support/test_helpers.ex index 77df6036b..5bd057932 100644 --- a/test/support/test_helpers.ex +++ b/test/support/test_helpers.ex @@ -47,7 +47,7 @@ defmodule Ret.TestHelpers do def create_account(prefix, is_admin \\ false) def create_account(prefix, is_admin) when is_binary(prefix) do - account = Account.find_or_create_account_for_email("#{prefix}@mozilla.com") + account = Account.find_or_create_account_for_email("#{prefix}@hubsfoundation.org") if is_admin do # Currently admin bits not set via any reticulum APIs, so avoid adding them to code for now. @@ -56,7 +56,7 @@ defmodule Ret.TestHelpers do "update ret0.accounts set is_admin = 't' where account_id = #{account.account_id}" ) - Account.find_or_create_account_for_email("#{prefix}@mozilla.com") + Account.find_or_create_account_for_email("#{prefix}@hubsfoundation.org") else account end