diff --git a/app/assets/package-lock.json b/app/assets/package-lock.json index 1dc496f2e..ea8f648e6 100644 --- a/app/assets/package-lock.json +++ b/app/assets/package-lock.json @@ -7,14 +7,14 @@ "license": "MIT", "dependencies": { "@absinthe/socket-apollo-link": "^0.2.1", - "@apollo/client": "*", + "@apollo/client": "latest", "@apollo/react-hooks": "^4.0.0", "@apollo/react-testing": "^4.0.0", "@appbaseio/reactivesearch": "3.23.1", "@emotion/react": "^11.11.4", "@fortawesome/fontawesome-svg-core": "^6.5.1", "@fortawesome/free-brands-svg-icons": "^6.5.1", - "@fortawesome/free-solid-svg-icons": "^6.5.1", + "@fortawesome/free-solid-svg-icons": "^6.6.0", "@fortawesome/react-fontawesome": "^0.2.2", "@honeybadger-io/js": "^6.9.3", "@honeybadger-io/react": "^6.1.7", @@ -35,7 +35,7 @@ "file-saver": "^2.0.5", "graphql": "^16.9.0", "graphql-tag": "^2.12.6", - "hls.js": "^1.5.11", + "hls.js": "^1.5.13", "inflection": "^3.0.0", "jest-environment-jsdom": "^29.7.0", "js-cookie": "^3.0.5", @@ -75,7 +75,7 @@ "@nulib/dcapi-types": "^2.3.1", "@nulib/prettier-config": "^1.2.0", "@testing-library/dom": "^10.4.0", - "@testing-library/jest-dom": "^6.4.6", + "@testing-library/jest-dom": "^6.4.7", "@testing-library/react": "^16.0.0", "@testing-library/user-event": "^14.5.2", "@types/jest": "^29.5.12", @@ -94,14 +94,14 @@ "lodash.isnull": "^3.0.0", "lodash.isundefined": "3.0.1", "node-fetch": "^2.6.1", - "prettier": "^3.3.2", + "prettier": "^3.3.3", "react": "^18.3.1", "react-dom": "^18.3.1", "react-router-dom": "^5.3.0", "react-router-prop-types": "^1.0.5", - "sass": "^1.77.6", + "sass": "^1.77.8", "ts-node": "^10.9.2", - "typescript": "^5.5.3", + "typescript": "^5.5.4", "use-phoenix-channel": "^1.1.1" } }, @@ -247,9 +247,9 @@ } }, "node_modules/@apollo/client": { - "version": "3.10.8", - "resolved": "https://registry.npmjs.org/@apollo/client/-/client-3.10.8.tgz", - "integrity": "sha512-UaaFEitRrPRWV836wY2L7bd3HRCfbMie1jlYMcmazFAK23MVhz/Uq7VG1nwbotPb5xzFsw5RF4Wnp2G3dWPM3g==", + "version": "3.11.0", + "resolved": "https://registry.npmjs.org/@apollo/client/-/client-3.11.0.tgz", + "integrity": "sha512-gX+sfALW6m/EfydJAE3ogLci1SFIBJKlyyWcakcNgTMLm7PfKMJ2MysagIdKgCSapQjBUL8qxZVI62TLKqe2Ng==", "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@wry/caches": "^1.0.0", @@ -269,8 +269,8 @@ "peerDependencies": { "graphql": "^15.0.0 || ^16.0.0", "graphql-ws": "^5.5.5", - "react": "^16.8.0 || ^17.0.0 || ^18.0.0", - "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0", "subscriptions-transport-ws": "^0.9.0 || ^0.11.0" }, "peerDependenciesMeta": { @@ -3243,17 +3243,24 @@ } }, "node_modules/@fortawesome/free-solid-svg-icons": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-6.5.2.tgz", - "integrity": "sha512-QWFZYXFE7O1Gr1dTIp+D6UcFUF0qElOnZptpi7PBUMylJh+vFmIedVe1Ir6RM1t2tEQLLSV1k7bR4o92M+uqlw==", - "hasInstallScript": true, + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-6.6.0.tgz", + "integrity": "sha512-IYv/2skhEDFc2WGUcqvFJkeK39Q+HyPf5GHUrT/l2pKbtgEIv1al1TKd6qStR5OIwQdN1GZP54ci3y4mroJWjA==", "dependencies": { - "@fortawesome/fontawesome-common-types": "6.5.2" + "@fortawesome/fontawesome-common-types": "6.6.0" }, "engines": { "node": ">=6" } }, + "node_modules/@fortawesome/free-solid-svg-icons/node_modules/@fortawesome/fontawesome-common-types": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-6.6.0.tgz", + "integrity": "sha512-xyX0X9mc0kyz9plIyryrRbl7ngsA9jz77mCZJsUkLl+ZKs0KWObgaEBoSgQiYWAsSmjz/yjl0F++Got0Mdp4Rw==", + "engines": { + "node": ">=6" + } + }, "node_modules/@fortawesome/react-fontawesome": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/@fortawesome/react-fontawesome/-/react-fontawesome-0.2.2.tgz", @@ -7621,9 +7628,9 @@ } }, "node_modules/@testing-library/jest-dom": { - "version": "6.4.6", - "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.4.6.tgz", - "integrity": "sha512-8qpnGVincVDLEcQXWaHOf6zmlbwTKc6Us6PPu4CRnPXCzo2OGBS5cwgMMOWdxDpEz1mkbvXHpEy99M5Yvt682w==", + "version": "6.4.7", + "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.4.7.tgz", + "integrity": "sha512-GaKJ0nijoNf30dWSOOzQEBkWBRk4rG3C/efw8zKrimNuZpnS/6/AEwo0WvZHgJxG84cNCgxt+mtbe1fsvfLp2A==", "dev": true, "dependencies": { "@adobe/css-tools": "^4.4.0", @@ -13181,9 +13188,9 @@ } }, "node_modules/hls.js": { - "version": "1.5.11", - "resolved": "https://registry.npmjs.org/hls.js/-/hls.js-1.5.11.tgz", - "integrity": "sha512-q3We1izi2+qkOO+TvZdHv+dx6aFzdtk3xc1/Qesrvto4thLTT/x/1FK85c5h1qZE4MmMBNgKg+MIW8nxQfxwBw==" + "version": "1.5.13", + "resolved": "https://registry.npmjs.org/hls.js/-/hls.js-1.5.13.tgz", + "integrity": "sha512-xRgKo84nsC7clEvSfIdgn/Tc0NOT+d7vdiL/wvkLO+0k0juc26NRBPPG1SfB8pd5bHXIjMW/F5VM8VYYkOYYdw==" }, "node_modules/hmac-drbg": { "version": "1.0.1", @@ -18857,9 +18864,9 @@ } }, "node_modules/prettier": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.2.tgz", - "integrity": "sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" @@ -20307,9 +20314,9 @@ } }, "node_modules/sass": { - "version": "1.77.6", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.77.6.tgz", - "integrity": "sha512-ByXE1oLD79GVq9Ht1PeHWCPMPB8XHpBuz1r85oByKHjZY6qV6rWnQovQzXJXuQ/XyE1Oj3iPk3lo28uzaRA2/Q==", + "version": "1.77.8", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.77.8.tgz", + "integrity": "sha512-4UHg6prsrycW20fqLGPShtEvo/WyHRVRHwOP4DzkUrObWoWI05QBSfzU71TVB7PFaL104TwNaHpjlWXAZbQiNQ==", "dev": true, "dependencies": { "chokidar": ">=3.0.0 <4.0.0", @@ -21698,9 +21705,9 @@ } }, "node_modules/typescript": { - "version": "5.5.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz", - "integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==", + "version": "5.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", + "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", "devOptional": true, "bin": { "tsc": "bin/tsc", diff --git a/app/assets/package.json b/app/assets/package.json index 1a63de144..20338fd70 100644 --- a/app/assets/package.json +++ b/app/assets/package.json @@ -24,7 +24,7 @@ "@emotion/react": "^11.11.4", "@fortawesome/fontawesome-svg-core": "^6.5.1", "@fortawesome/free-brands-svg-icons": "^6.5.1", - "@fortawesome/free-solid-svg-icons": "^6.5.1", + "@fortawesome/free-solid-svg-icons": "^6.6.0", "@fortawesome/react-fontawesome": "^0.2.2", "@honeybadger-io/js": "^6.9.3", "@honeybadger-io/react": "^6.1.7", @@ -45,7 +45,7 @@ "file-saver": "^2.0.5", "graphql": "^16.9.0", "graphql-tag": "^2.12.6", - "hls.js": "^1.5.11", + "hls.js": "^1.5.13", "inflection": "^3.0.0", "jest-environment-jsdom": "^29.7.0", "js-cookie": "^3.0.5", @@ -85,7 +85,7 @@ "@nulib/dcapi-types": "^2.3.1", "@nulib/prettier-config": "^1.2.0", "@testing-library/dom": "^10.4.0", - "@testing-library/jest-dom": "^6.4.6", + "@testing-library/jest-dom": "^6.4.7", "@testing-library/react": "^16.0.0", "@testing-library/user-event": "^14.5.2", "@types/jest": "^29.5.12", @@ -104,14 +104,14 @@ "lodash.isnull": "^3.0.0", "lodash.isundefined": "3.0.1", "node-fetch": "^2.6.1", - "prettier": "^3.3.2", + "prettier": "^3.3.3", "react": "^18.3.1", "react-dom": "^18.3.1", "react-router-dom": "^5.3.0", "react-router-prop-types": "^1.0.5", - "sass": "^1.77.6", + "sass": "^1.77.8", "ts-node": "^10.9.2", - "typescript": "^5.5.3", + "typescript": "^5.5.4", "use-phoenix-channel": "^1.1.1" } } diff --git a/app/config/dev.exs b/app/config/dev.exs index d0a9ecd7f..bfa8a39f4 100644 --- a/app/config/dev.exs +++ b/app/config/dev.exs @@ -124,6 +124,7 @@ if prefix = System.get_env("DEV_PREFIX") do end config :meadow, :sitemaps, + base_url: "https://dc.library.northwestern.edu/", gzip: false, store: Sitemapper.FileStore, sitemap_url: "https://devbox.library.northwestern.edu:3333/", diff --git a/app/config/releases.exs b/app/config/releases.exs index 0b2dafcbc..b1d9d47b4 100644 --- a/app/config/releases.exs +++ b/app/config/releases.exs @@ -105,7 +105,9 @@ config :meadow, bucket: aws_secret("meadow", dig: ["buckets", "sitemap"]), path: "/" ], - sitemap_url: aws_secret("meadow", dig: ["dc", "base_url"]) + base_url: aws_secret("meadow", dig: ["dc", "base_url"]), + sitemap_url: + aws_secret("meadow", dig: ["dc", "base_url"], apply: &{:ok, Path.join(&1, "api/sitemap")}) ], validation_ping_interval: environment_secret("VALIDATION_PING_INTERVAL", default: "1000") @@ -125,7 +127,12 @@ config :meadow, Meadow.Scheduler, overlap: false, timezone: "America/Chicago", jobs: [ - # Runs daily at the configured time (default: 2AM Central) + # Sitemap generation runs daily at the configured time (default: 1AM Central) + { + aws_secret("meadow", dig: ["scheduler", "sitemap"], default: "0 1 * * *"), + {Meadow.Utils.Sitemap, :generate, []} + }, + # Preservation check runs daily at the configured time (default: 2AM Central) { aws_secret("meadow", dig: ["scheduler", "preservation_check"], default: "0 2 * * *"), {Meadow.Data.PreservationChecks, :start_job, []} diff --git a/app/config/test.exs b/app/config/test.exs index 551fc23bf..46e977fbd 100644 --- a/app/config/test.exs +++ b/app/config/test.exs @@ -119,6 +119,7 @@ config :honeybadger, config :meadow, :sitemaps, gzip: true, store: Sitemapper.S3Store, + base_url: "http://localhost:3333/", sitemap_url: "http://localhost:3333/", store_config: [bucket: prefix("uploads"), path: ""] diff --git a/app/lib/meadow/utils/sitemap.ex b/app/lib/meadow/utils/sitemap.ex index 72ec49d30..367220df2 100644 --- a/app/lib/meadow/utils/sitemap.ex +++ b/app/lib/meadow/utils/sitemap.ex @@ -2,9 +2,12 @@ defmodule Meadow.Utils.Sitemap do @moduledoc """ Generate and upload Digital Collection sitemaps """ - alias Meadow.Data.{Collections, Works} + alias Meadow.Data.Collections + alias Meadow.Data.Schemas.Work alias Meadow.Repo + import Ecto.Query + require Logger @doc """ @@ -74,7 +77,7 @@ defmodule Meadow.Utils.Sitemap do end defp work_urls do - Works.work_query(visibility: "OPEN", work_type: "IMAGE") + from(w in Work, where: w.visibility["id"] == ^"OPEN" and w.published) |> Repo.stream() |> Stream.map(fn %{id: id, updated_at: updated_at} -> %Sitemapper.URL{ @@ -88,7 +91,7 @@ defmodule Meadow.Utils.Sitemap do defp expand_url(path) do config() - |> Keyword.get(:sitemap_url) + |> Keyword.get(:base_url) |> URI.parse() |> URI.merge(path) |> URI.to_string() diff --git a/app/mix.exs b/app/mix.exs index 7774d9005..1a8413d06 100644 --- a/app/mix.exs +++ b/app/mix.exs @@ -3,7 +3,7 @@ Code.require_file("lib/env.ex") defmodule Meadow.MixProject do use Mix.Project - @app_version "9.4.0" + @app_version "9.4.1" def project do [ diff --git a/app/mix.lock b/app/mix.lock index b1c325d7d..12df761b9 100644 --- a/app/mix.lock +++ b/app/mix.lock @@ -1,5 +1,5 @@ %{ - "absinthe": {:hex, :absinthe, "1.7.7", "ecbf4e9b21372dda271c79bb43dded3583b4f080348c5e68d9b5445e790ff17e", [:mix], [{:dataloader, "~> 1.0.0 or ~> 2.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}, {:opentelemetry_process_propagator, "~> 0.2.1 or ~> 0.3", [hex: :opentelemetry_process_propagator, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "2145519828bcb7c8621b72d7af2bcff88b01cba2774583c40ebd867e1d336ff6"}, + "absinthe": {:hex, :absinthe, "1.7.8", "43443d12ad2b4fcce60e257ac71caf3081f3d5c4ddd5eac63a02628bcaf5b556", [:mix], [{:dataloader, "~> 1.0.0 or ~> 2.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}, {:opentelemetry_process_propagator, "~> 0.2.1 or ~> 0.3", [hex: :opentelemetry_process_propagator, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c4085df201892a498384f997649aedb37a4ce8a726c170d5b5617ed3bf45d40b"}, "absinthe_phoenix": {:hex, :absinthe_phoenix, "2.0.3", "74e0862f280424b7bc290f6f69e133268bce0b4e7db0218c7e129c5c2b1d3fd4", [:mix], [{:absinthe, "~> 1.5", [hex: :absinthe, repo: "hexpm", optional: false]}, {:absinthe_plug, "~> 1.5", [hex: :absinthe_plug, repo: "hexpm", optional: false]}, {:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.5", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.13 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}], "hexpm", "caffaea03c17ea7419fe07e4bc04c2399c47f0d8736900623dbf4749a826fd2c"}, "absinthe_plug": {:hex, :absinthe_plug, "1.5.8", "38d230641ba9dca8f72f1fed2dfc8abd53b3907d1996363da32434ab6ee5d6ab", [:mix], [{:absinthe, "~> 1.5", [hex: :absinthe, repo: "hexpm", optional: false]}, {:plug, "~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "bbb04176647b735828861e7b2705465e53e2cf54ccf5a73ddd1ebd855f996e5a"}, "assertions": {:hex, :assertions, "0.20.1", "e6bfcefbf199bc760d273d5a204ad9ef8a4f6c2b4725fc51d10610d73062e57b", [:mix], [], "hexpm", "848284fbde52f752232d73b8f77060ad191e1a98c177873c4b8dc56c4958defd"}, @@ -13,7 +13,7 @@ "broadway_sqs": {:hex, :broadway_sqs, "0.7.4", "ab89b298f9253adb8534f92095b56d4879e35fe2f5a0730256f7e824572c637f", [:mix], [{:broadway, "~> 1.0", [hex: :broadway, repo: "hexpm", optional: false]}, {:ex_aws_sqs, "~> 3.2.1 or ~> 3.3", [hex: :ex_aws_sqs, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.3.7 or ~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:saxy, "~> 1.1", [hex: :saxy, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7140085c4f7c4b27886b3a8f3d0942976f39f195fdbc2f652c5d7b157f93ae28"}, "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, "cachex": {:hex, :cachex, "3.6.0", "14a1bfbeee060dd9bec25a5b6f4e4691e3670ebda28c8ba2884b12fe30b36bf8", [:mix], [{:eternal, "~> 1.2", [hex: :eternal, repo: "hexpm", optional: false]}, {:jumper, "~> 1.0", [hex: :jumper, repo: "hexpm", optional: false]}, {:sleeplocks, "~> 1.1", [hex: :sleeplocks, repo: "hexpm", optional: false]}, {:unsafe, "~> 1.0", [hex: :unsafe, repo: "hexpm", optional: false]}], "hexpm", "ebf24e373883bc8e0c8d894a63bbe102ae13d918f790121f5cfe6e485cc8e2e2"}, - "castore": {:hex, :castore, "1.0.7", "b651241514e5f6956028147fe6637f7ac13802537e895a724f90bf3e36ddd1dd", [:mix], [], "hexpm", "da7785a4b0d2a021cd1292a60875a784b6caef71e76bf4917bdee1f390455cf5"}, + "castore": {:hex, :castore, "1.0.8", "dedcf20ea746694647f883590b82d9e96014057aff1d44d03ec90f36a5c0dc6e", [], [], "hexpm", "0b2b66d2ee742cb1d9cb8c8be3b43c3a70ee8651f37b75a8b982e036752983f1"}, "certifi": {:hex, :certifi, "2.12.0", "2d1cca2ec95f59643862af91f001478c9863c2ac9cb6e2f89780bfd8de987329", [:rebar3], [], "hexpm", "ee68d85df22e554040cdb4be100f33873ac6051387baf6a8f6ce82272340ff1c"}, "configparser_ex": {:hex, :configparser_ex, "4.0.0", "17e2b831cfa33a08c56effc610339b2986f0d82a9caa0ed18880a07658292ab6", [:mix], [], "hexpm", "02e6d1a559361a063cba7b75bc3eb2d6ad7e62730c551cc4703541fd11e65e5b"}, "cowboy": {:hex, :cowboy, "2.12.0", "f276d521a1ff88b2b9b4c54d0e753da6c66dd7be6c9fca3d9418b561828a3731", [:make, :rebar3], [{:cowlib, "2.13.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "8a7abe6d183372ceb21caa2709bec928ab2b72e18a3911aa1771639bef82651e"}, @@ -38,7 +38,7 @@ "ex_aws_secretsmanager": {:hex, :ex_aws_secretsmanager, "2.0.0", "deff8c12335f0160882afeb9687e55a97fddcd7d9a82fc3a6fbb270797374773", [:mix], [{:ex_aws, "~> 2.0", [hex: :ex_aws, repo: "hexpm", optional: false]}], "hexpm", "8b2838af536c32263ff797012b29e87bad73ef34f43cfa60ebca8e84576f6d45"}, "ex_aws_sqs": {:hex, :ex_aws_sqs, "3.4.0", "f7c4d0177c1c954776363d3dc05e5dfd37ddf0e2c65ec3f047e5c9c7dd1b71ac", [:mix], [{:ex_aws, "~> 2.1", [hex: :ex_aws, repo: "hexpm", optional: false]}, {:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: true]}, {:saxy, "~> 1.1", [hex: :saxy, repo: "hexpm", optional: true]}, {:sweet_xml, ">= 0.0.0", [hex: :sweet_xml, repo: "hexpm", optional: true]}], "hexpm", "b504482206ccaf767b714888e9d41a1cfcdcb241577985517114191c812f155a"}, "ex_aws_ssm": {:hex, :ex_aws_ssm, "2.1.0", "548b3d085d2916f54a5b5c5b273673175a46b04ff637624dab582957649eb680", [:mix], [{:ex_aws, "~> 2.0", [hex: :ex_aws, repo: "hexpm", optional: false]}], "hexpm", "a91a183dc131a780e74aad10d7866533ca6018a6c2bf0345d52fe3f3c494f9f7"}, - "excoveralls": {:hex, :excoveralls, "0.18.1", "a6f547570c6b24ec13f122a5634833a063aec49218f6fff27de9df693a15588c", [:mix], [{:castore, "~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "d65f79db146bb20399f23046015974de0079668b9abb2f5aac074d078da60b8d"}, + "excoveralls": {:hex, :excoveralls, "0.18.2", "86efd87a0676a3198ff50b8c77620ea2f445e7d414afa9ec6c4ba84c9f8bdcc2", [:mix], [{:castore, "~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "230262c418f0de64077626a498bd4fdf1126d5c2559bb0e6b43deac3005225a4"}, "exldap": {:hex, :exldap, "0.6.3", "98e8c4ad5e1773b921ba0a5f27c96a6d814a7dff1581e5648eaf7c4f594729e7", [:mix], [], "hexpm", "412fafabe43cfde52d85957776f54edad9258d88b261dab76e0458a43c618a2c"}, "expo": {:hex, :expo, "0.5.1", "249e826a897cac48f591deba863b26c16682b43711dd15ee86b92f25eafd96d9", [:mix], [], "hexpm", "68a4233b0658a3d12ee00d27d37d856b1ba48607e7ce20fd376958d0ba6ce92b"}, "faker": {:hex, :faker, "0.18.0", "943e479319a22ea4e8e39e8e076b81c02827d9302f3d32726c5bf82f430e6e14", [:mix], [], "hexpm", "bfbdd83958d78e2788e99ec9317c4816e651ad05e24cfd1196ce5db5b3e81797"}, @@ -53,7 +53,7 @@ "hush_aws_secrets_manager": {:hex, :hush_aws_secrets_manager, "0.2.0", "308289205282b31168691180f5a85b8ef72d6ae2bac4e3cd5cb6f725a0499b99", [:mix], [{:ex_aws, "~> 2.0", [hex: :ex_aws, repo: "hexpm", optional: false]}, {:ex_aws_secretsmanager, "~> 2.0", [hex: :ex_aws_secretsmanager, repo: "hexpm", optional: false]}, {:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}, {:hush, "~> 0.4", [hex: :hush, repo: "hexpm", optional: false]}], "hexpm", "e07d5515d0e9c44ab891c5402ce4f7827cb167eed8ef84b426d8d2962d07a4ab"}, "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, "inflex": {:hex, :inflex, "2.1.0", "a365cf0821a9dacb65067abd95008ca1b0bb7dcdd85ae59965deef2aa062924c", [:mix], [], "hexpm", "14c17d05db4ee9b6d319b0bff1bdf22aa389a25398d1952c7a0b5f3d93162dd8"}, - "jason": {:hex, :jason, "1.4.3", "d3f984eeb96fe53b85d20e0b049f03e57d075b5acda3ac8d465c969a2536c17b", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "9a90e868927f7c777689baa16d86f4d0e086d968db5c05d917ccff6d443e58a3"}, + "jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"}, "jsx": {:hex, :jsx, "2.8.3", "a05252d381885240744d955fbe3cf810504eb2567164824e19303ea59eef62cf", [:mix, :rebar3], [], "hexpm", "fc3499fed7a726995aa659143a248534adc754ebd16ccd437cd93b649a95091f"}, "jumper": {:hex, :jumper, "1.0.1", "3c00542ef1a83532b72269fab9f0f0c82bf23a35e27d278bfd9ed0865cecabff", [:mix], [], "hexpm", "318c59078ac220e966d27af3646026db9b5a5e6703cb2aa3e26bcfaba65b7433"}, "jwt": {:hex, :jwt, "0.1.11", "4f18896c4a182530ed445312c45ac353d801fbdfd54f538910370e9cf12687cf", [:rebar3], [{:base64url, "~> 0.0.1", [hex: :base64url, repo: "hexpm", optional: false]}, {:jsx, "~> 2.8.0", [hex: :jsx, repo: "hexpm", optional: false]}], "hexpm", "b483fbb786d1bd050b3c551d323112d604e5b0f9cf9dc5671adeec462c2e36bb"}, diff --git a/livebook/Dockerfile b/livebook/Dockerfile index 3f3388a0d..46420a9cf 100644 --- a/livebook/Dockerfile +++ b/livebook/Dockerfile @@ -1,9 +1,10 @@ -FROM ghcr.io/livebook-dev/livebook +FROM ghcr.io/livebook-dev/livebook:latest ENV LIVEBOOK_AWS_CREDENTIALS=true -ENV LIVEBOOK_IDENTITY_PROVIDER=custom:MeadowLivebookAuth -ENV LIVEBOOK_DISTRIBUTION=sname -ENV LIVEBOOK_IP=0.0.0.0 ENV LIVEBOOK_DATA_PATH=/data +ENV LIVEBOOK_DISTRIBUTION=name ENV LIVEBOOK_HOME=${LIVEBOOK_DATA_PATH}/books +ENV LIVEBOOK_IDENTITY_PROVIDER=custom:MeadowLivebookAuth +ENV LIVEBOOK_IP=0.0.0.0 +ENV LIVEBOOK_TOKEN_ENABLED=false RUN mkdir -p ${LIVEBOOK_DATA_PATH}/books ADD ./meadow_livebook_auth.exs /app/user/extensions/meadow_livebook_auth.exs diff --git a/livebook/meadow_livebook_auth.exs b/livebook/meadow_livebook_auth.exs index 1a4aa84c6..9cf63caca 100644 --- a/livebook/meadow_livebook_auth.exs +++ b/livebook/meadow_livebook_auth.exs @@ -23,9 +23,22 @@ defmodule MeadowLivebookAuth do @spec authenticate(GenServer.server(), Plug.Conn.t(), keyword()) :: {Plug.Conn.t(), map() | nil} def authenticate(server, conn, _) do - with url <- get_meadow_url() do - set_state(server, :auth_url, url) - {conn, meadow_auth(url, conn)} + with url <- find_meadow_url(server), + user <- meadow_auth(url, conn) do + {conn, user} + end + end + + defp find_meadow_url(server) do + case get_state(server) do + %{auth_url: auth_url} -> + auth_url + + _ -> + with url <- get_meadow_url() do + set_state(server, :auth_url, url) + url + end end end @@ -48,7 +61,7 @@ defmodule MeadowLivebookAuth do defp meadow_auth(url, conn) do with meadow_cookie <- conn |> Plug.Conn.fetch_cookies() |> Map.get(:cookies) |> Map.get("_meadow_key") do - Req.get(url, + Req.post(url, body: @query, headers: ["Content-Type": "application/graphql", Cookie: "_meadow_key=#{meadow_cookie}"] )