commit 5e5b4c5983366a5e4d7d17ba30795748bc3f0018 Author: Jimmy GALLAND Date: Sat Nov 21 22:06:53 2026 +0100 fist commit diff --git a/.github/workflows/firefox-release.yml b/.github/workflows/firefox-release.yml new file mode 100644 index 0000000..ad31067 --- /dev/null +++ b/.github/workflows/firefox-release.yml @@ -0,0 +1,253 @@ +name: Firefox extension release + +on: + release: + types: [published] + +permissions: + contents: write + +jobs: + build-and-publish: + name: Build, package and publish SKYNET SSO + runs-on: ubuntu-latest + env: + EXTENSION_DIR: src/mod/auth/sso/zorxauth/extension + RELEASE_TAG: ${{ gitea.event.release.tag_name }} + RELEASE_ID: ${{ gitea.event.release.id }} + REPOSITORY: ${{ gitea.repository }} + GITEA_SERVER_URL: ${{ gitea.server_url }} + GITEA_SHA: ${{ gitea.sha }} + + steps: + - name: Checkout release commit + uses: actions/checkout@v4 + with: + ref: ${{ gitea.sha }} + fetch-depth: 0 + token: ${{ secrets.GITEA_TOKEN }} + + - name: Ensure the release tag exists + shell: bash + env: + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + run: | + set -euo pipefail + + if [[ -z "${RELEASE_TAG}" ]]; then + echo "::error::The release event does not contain a tag name." + exit 1 + fi + + git fetch --force origin \ + "+refs/tags/${RELEASE_TAG}:refs/tags/${RELEASE_TAG}" \ + 2>/dev/null || true + + if git show-ref --verify --quiet "refs/tags/${RELEASE_TAG}"; then + echo "Tag ${RELEASE_TAG} already exists." + else + if [[ -z "${GITEA_SHA}" ]]; then + echo "::error::Cannot create the tag: the release commit SHA is missing." + exit 1 + fi + + git tag -a "${RELEASE_TAG}" "${GITEA_SHA}" \ + -m "Release ${RELEASE_TAG}" + + # Use an HTTP authorization header so the token is not embedded + # in the remote URL or written to the Git configuration. + AUTH="$(printf 'x-access-token:%s' "${GITEA_TOKEN}" | base64 -w 0)" + git -c http.extraheader="AUTHORIZATION: basic ${AUTH}" \ + push origin "refs/tags/${RELEASE_TAG}" + fi + + git checkout --detach "refs/tags/${RELEASE_TAG}" + echo "Release tag points to $(git rev-parse HEAD)." + + - name: Validate release version + shell: bash + run: | + set -euo pipefail + + TAG_VERSION="${RELEASE_TAG#v}" + MANIFEST_VERSION="$(node -p \ + "require('./${EXTENSION_DIR}/manifest.json').version")" + + if [[ "${TAG_VERSION}" != "${MANIFEST_VERSION}" ]]; then + echo "::error::Release tag ${RELEASE_TAG} does not match manifest version ${MANIFEST_VERSION}." + echo "Expected tag: v${MANIFEST_VERSION} (or ${MANIFEST_VERSION})." + exit 1 + fi + + echo "Release ${RELEASE_TAG} matches manifest version ${MANIFEST_VERSION}." + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "22" + + - name: Install build tools + run: | + npm install --no-save --no-audit --no-fund \ + terser@5.44.1 \ + clean-css-cli@5.6.3 \ + html-minifier-terser@7.2.0 \ + web-ext@8.9.0 + + - name: Prepare and safely minify extension + shell: bash + run: | + set -euo pipefail + + rm -rf dist artifacts + mkdir -p dist artifacts + cp -a "${EXTENSION_DIR}/." dist/ + rm -f dist/README.md + + # Minify JavaScript, CSS and HTML in the build copy only. + # The tracked source files are never rewritten. + while IFS= read -r -d '' file; do + tmp="${file}.min" + npx --no-install terser "${file}" \ + --compress --mangle --format "comments=false" \ + --output "${tmp}" + mv "${tmp}" "${file}" + done < <(find dist -type f -name '*.js' -print0) + + while IFS= read -r -d '' file; do + tmp="${file}.min" + npx --no-install cleancss \ + --compatibility ie11 -O2 \ + --output "${tmp}" "${file}" + mv "${tmp}" "${file}" + done < <(find dist -type f -name '*.css' -print0) + + while IFS= read -r -d '' file; do + tmp="${file}.min" + npx --no-install html-minifier-terser \ + --collapse-whitespace \ + --remove-comments \ + --minify-css true \ + --minify-js false \ + --remove-optional-tags false \ + --remove-redundant-attributes false \ + --remove-attribute-quotes false \ + --keep-closing-slash true \ + "${file}" --output "${tmp}" + mv "${tmp}" "${file}" + done < <(find dist -type f -name '*.html' -print0) + + # Validate that the resulting manifest is still valid JSON and + # that all referenced entry-point files are present. + node <<'NODE' + const fs = require("node:fs"); + const path = require("node:path"); + const root = path.resolve("dist"); + const manifest = JSON.parse(fs.readFileSync(path.join(root, "manifest.json"), "utf8")); + + const required = [ + ...(manifest.background?.scripts || []), + ...(manifest.content_scripts || []).flatMap(s => [ + ...(s.js || []), + ...(s.css || []) + ]), + ...(manifest.options_ui?.page ? [manifest.options_ui.page] : []), + ...(manifest.action?.default_popup ? [manifest.action.default_popup] : []), + ...Object.values(manifest.icons || {}), + ...(manifest.web_accessible_resources || []).flatMap(r => r.resources || []) + ]; + + for (const entry of required) { + const target = path.resolve(root, entry); + if (!target.startsWith(root + path.sep) || !fs.existsSync(target)) { + throw new Error(`Manifest resource missing or invalid: ${entry}`); + } + } + + console.log(`Manifest OK; ${required.length} referenced resources verified.`); + NODE + + npx --no-install web-ext lint --source-dir dist + + ZIP_NAME="SKYNET-SSO-${RELEASE_TAG}.zip" + ( + cd dist + zip -qr "../artifacts/${ZIP_NAME}" . + ) + + echo "ZIP_NAME=${ZIP_NAME}" >> "${GITEA_ENV:-$GITHUB_ENV}" + echo "ZIP_PATH=artifacts/${ZIP_NAME}" >> "${GITEA_ENV:-$GITHUB_ENV}" + + - name: Sign and submit to Firefox Add-ons (AMO) + id: amo + if: ${{ secrets.AMO_JWT_ISSUER != '' && secrets.AMO_JWT_SECRET != '' }} + env: + AMO_JWT_ISSUER: ${{ secrets.AMO_JWT_ISSUER }} + AMO_JWT_SECRET: ${{ secrets.AMO_JWT_SECRET }} + run: | + set -euo pipefail + mkdir -p artifacts/amo + + npx --no-install web-ext sign \ + --source-dir dist \ + --artifacts-dir artifacts/amo \ + --channel listed \ + --api-key "${AMO_JWT_ISSUER}" \ + --api-secret "${AMO_JWT_SECRET}" \ + --no-input + + XPI="$(find artifacts/amo -maxdepth 1 -type f -name '*.xpi' -print -quit)" + if [[ -z "${XPI}" ]]; then + echo "::error::AMO did not return a signed XPI." + exit 1 + fi + + cp "${XPI}" "artifacts/SKYNET-SSO-${RELEASE_TAG}.xpi" + echo "AMO submission/signing completed." + + - name: Upload release files to Gitea + shell: bash + env: + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + AMO_JWT_ISSUER: ${{ secrets.AMO_JWT_ISSUER }} + AMO_JWT_SECRET: ${{ secrets.AMO_JWT_SECRET }} + run: | + set -euo pipefail + + if [[ -z "${GITEA_TOKEN}" ]]; then + echo "::error::Add the GITEA_TOKEN repository secret (write access required)." + exit 1 + fi + + API_BASE="${GITEA_SERVER_URL%/}/api/v1" + OWNER="${REPOSITORY%%/*}" + REPO="${REPOSITORY#*/}" + AUTH_HEADER="Authorization: token ${GITEA_TOKEN}" + + upload_asset() { + local file="$1" + local name + name="$(basename "${file}")" + + echo "Uploading ${name} to release ${RELEASE_TAG}..." + curl --fail --silent --show-error \ + --request POST \ + --header "${AUTH_HEADER}" \ + --form "attachment=@${file}" \ + "${API_BASE}/repos/${OWNER}/${REPO}/releases/${RELEASE_ID}/assets?name=${name}" + } + + upload_asset "artifacts/${ZIP_NAME}" + + if [[ -f "artifacts/SKYNET-SSO-${RELEASE_TAG}.xpi" ]]; then + upload_asset "artifacts/SKYNET-SSO-${RELEASE_TAG}.xpi" + else + echo "AMO credentials are not configured; ZIP is attached, AMO publication skipped." + fi + + - name: Preserve build files in workflow artifacts + uses: actions/upload-artifact@v3 + with: + name: SKYNET-SSO-${{ gitea.event.release.tag_name }} + path: artifacts/* + if-no-files-found: error diff --git a/README.md b/README.md new file mode 100644 index 0000000..74d1fa5 --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +# SKYNET SSO — extension Firefox + +Extension compagnon de Zoraxy Auth. + +## Fonctionnalités +- Barre supérieure escamotable au clic n'importe où en dehors de la barre. +- Encoche de réouverture activable ou désactivable dans les paramètres. +- Affichage de l'état de la session centrale et du nom d'utilisateur. +- Déconnexion depuis n'importe quelle page couverte. +- Thème sombre bleu nuit / cyan SKYNET. + +## Installation temporaire +1. Ouvrir `about:debugging#/runtime/this-firefox`. +2. Choisir « Charger un module complémentaire temporaire ». +3. Sélectionner `manifest.json`. + +## Configuration + +Les domaines protégés et l'affichage de l'encoche sont configurables depuis la page d'options. + +## API utilisée côté Zoraxy Auth +- `GET /user/api/info` — endpoint natif du portail utilisateur ; confirme la session et renvoie le profil de l'utilisateur. +- `POST /logout` — endpoint natif existant ; invalide toutes les sessions centrales de l'utilisateur et expire le cookie SSO du navigateur courant. + +L'extension n'accède jamais au cookie SSO et ne le lit pas. Elle demande simplement au navigateur d'inclure le cookie dans les requêtes vers le fournisseur. Les éventuelles sessions locales propres aux applications tierces restent soumises à leur propre cycle de vie. \ No newline at end of file diff --git a/github/workflows/firefox-release.yml b/github/workflows/firefox-release.yml new file mode 100644 index 0000000..6469a32 --- /dev/null +++ b/github/workflows/firefox-release.yml @@ -0,0 +1,253 @@ +name: Firefox extension release + +on: + release: + types: [published] + +permissions: + contents: write + +jobs: + build-and-publish: + name: Build, package and publish SKYNET SSO + runs-on: ubuntu-latest + env: + EXTENSION_DIR: src + RELEASE_TAG: ${{ gitea.event.release.tag_name }} + RELEASE_ID: ${{ gitea.event.release.id }} + REPOSITORY: ${{ gitea.repository }} + GITEA_SERVER_URL: ${{ gitea.server_url }} + GITEA_SHA: ${{ gitea.sha }} + + steps: + - name: Checkout release commit + uses: actions/checkout@v4 + with: + ref: ${{ gitea.sha }} + fetch-depth: 0 + token: ${{ secrets.GITEA_TOKEN }} + + - name: Ensure the release tag exists + shell: bash + env: + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + run: | + set -euo pipefail + + if [[ -z "${RELEASE_TAG}" ]]; then + echo "::error::The release event does not contain a tag name." + exit 1 + fi + + git fetch --force origin \ + "+refs/tags/${RELEASE_TAG}:refs/tags/${RELEASE_TAG}" \ + 2>/dev/null || true + + if git show-ref --verify --quiet "refs/tags/${RELEASE_TAG}"; then + echo "Tag ${RELEASE_TAG} already exists." + else + if [[ -z "${GITEA_SHA}" ]]; then + echo "::error::Cannot create the tag: the release commit SHA is missing." + exit 1 + fi + + git tag -a "${RELEASE_TAG}" "${GITEA_SHA}" \ + -m "Release ${RELEASE_TAG}" + + # Use an HTTP authorization header so the token is not embedded + # in the remote URL or written to the Git configuration. + AUTH="$(printf 'x-access-token:%s' "${GITEA_TOKEN}" | base64 -w 0)" + git -c http.extraheader="AUTHORIZATION: basic ${AUTH}" \ + push origin "refs/tags/${RELEASE_TAG}" + fi + + git checkout --detach "refs/tags/${RELEASE_TAG}" + echo "Release tag points to $(git rev-parse HEAD)." + + - name: Validate release version + shell: bash + run: | + set -euo pipefail + + TAG_VERSION="${RELEASE_TAG#v}" + MANIFEST_VERSION="$(node -p \ + "require('./${EXTENSION_DIR}/manifest.json').version")" + + if [[ "${TAG_VERSION}" != "${MANIFEST_VERSION}" ]]; then + echo "::error::Release tag ${RELEASE_TAG} does not match manifest version ${MANIFEST_VERSION}." + echo "Expected tag: v${MANIFEST_VERSION} (or ${MANIFEST_VERSION})." + exit 1 + fi + + echo "Release ${RELEASE_TAG} matches manifest version ${MANIFEST_VERSION}." + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "22" + + - name: Install build tools + run: | + npm install --no-save --no-audit --no-fund \ + terser@5.44.1 \ + clean-css-cli@5.6.3 \ + html-minifier-terser@7.2.0 \ + web-ext@8.9.0 + + - name: Prepare and safely minify extension + shell: bash + run: | + set -euo pipefail + + rm -rf dist artifacts + mkdir -p dist artifacts + cp -a "${EXTENSION_DIR}/." dist/ + rm -f dist/README.md + + # Minify JavaScript, CSS and HTML in the build copy only. + # The tracked source files are never rewritten. + while IFS= read -r -d '' file; do + tmp="${file}.min" + npx --no-install terser "${file}" \ + --compress --mangle --format "comments=false" \ + --output "${tmp}" + mv "${tmp}" "${file}" + done < <(find dist -type f -name '*.js' -print0) + + while IFS= read -r -d '' file; do + tmp="${file}.min" + npx --no-install cleancss \ + --compatibility ie11 -O2 \ + --output "${tmp}" "${file}" + mv "${tmp}" "${file}" + done < <(find dist -type f -name '*.css' -print0) + + while IFS= read -r -d '' file; do + tmp="${file}.min" + npx --no-install html-minifier-terser \ + --collapse-whitespace \ + --remove-comments \ + --minify-css true \ + --minify-js false \ + --remove-optional-tags false \ + --remove-redundant-attributes false \ + --remove-attribute-quotes false \ + --keep-closing-slash true \ + "${file}" --output "${tmp}" + mv "${tmp}" "${file}" + done < <(find dist -type f -name '*.html' -print0) + + # Validate that the resulting manifest is still valid JSON and + # that all referenced entry-point files are present. + node <<'NODE' + const fs = require("node:fs"); + const path = require("node:path"); + const root = path.resolve("dist"); + const manifest = JSON.parse(fs.readFileSync(path.join(root, "manifest.json"), "utf8")); + + const required = [ + ...(manifest.background?.scripts || []), + ...(manifest.content_scripts || []).flatMap(s => [ + ...(s.js || []), + ...(s.css || []) + ]), + ...(manifest.options_ui?.page ? [manifest.options_ui.page] : []), + ...(manifest.action?.default_popup ? [manifest.action.default_popup] : []), + ...Object.values(manifest.icons || {}), + ...(manifest.web_accessible_resources || []).flatMap(r => r.resources || []) + ]; + + for (const entry of required) { + const target = path.resolve(root, entry); + if (!target.startsWith(root + path.sep) || !fs.existsSync(target)) { + throw new Error(`Manifest resource missing or invalid: ${entry}`); + } + } + + console.log(`Manifest OK; ${required.length} referenced resources verified.`); + NODE + + npx --no-install web-ext lint --source-dir dist + + ZIP_NAME="SKYNET-SSO-${RELEASE_TAG}.zip" + ( + cd dist + zip -qr "../artifacts/${ZIP_NAME}" . + ) + + echo "ZIP_NAME=${ZIP_NAME}" >> "${GITEA_ENV:-$GITHUB_ENV}" + echo "ZIP_PATH=artifacts/${ZIP_NAME}" >> "${GITEA_ENV:-$GITHUB_ENV}" + + - name: Sign and submit to Firefox Add-ons (AMO) + id: amo + if: ${{ secrets.AMO_JWT_ISSUER != '' && secrets.AMO_JWT_SECRET != '' }} + env: + AMO_JWT_ISSUER: ${{ secrets.AMO_JWT_ISSUER }} + AMO_JWT_SECRET: ${{ secrets.AMO_JWT_SECRET }} + run: | + set -euo pipefail + mkdir -p artifacts/amo + + npx --no-install web-ext sign \ + --source-dir dist \ + --artifacts-dir artifacts/amo \ + --channel listed \ + --api-key "${AMO_JWT_ISSUER}" \ + --api-secret "${AMO_JWT_SECRET}" \ + --no-input + + XPI="$(find artifacts/amo -maxdepth 1 -type f -name '*.xpi' -print -quit)" + if [[ -z "${XPI}" ]]; then + echo "::error::AMO did not return a signed XPI." + exit 1 + fi + + cp "${XPI}" "artifacts/SKYNET-SSO-${RELEASE_TAG}.xpi" + echo "AMO submission/signing completed." + + - name: Upload release files to Gitea + shell: bash + env: + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + AMO_JWT_ISSUER: ${{ secrets.AMO_JWT_ISSUER }} + AMO_JWT_SECRET: ${{ secrets.AMO_JWT_SECRET }} + run: | + set -euo pipefail + + if [[ -z "${GITEA_TOKEN}" ]]; then + echo "::error::Add the GITEA_TOKEN repository secret (write access required)." + exit 1 + fi + + API_BASE="${GITEA_SERVER_URL%/}/api/v1" + OWNER="${REPOSITORY%%/*}" + REPO="${REPOSITORY#*/}" + AUTH_HEADER="Authorization: token ${GITEA_TOKEN}" + + upload_asset() { + local file="$1" + local name + name="$(basename "${file}")" + + echo "Uploading ${name} to release ${RELEASE_TAG}..." + curl --fail --silent --show-error \ + --request POST \ + --header "${AUTH_HEADER}" \ + --form "attachment=@${file}" \ + "${API_BASE}/repos/${OWNER}/${REPO}/releases/${RELEASE_ID}/assets?name=${name}" + } + + upload_asset "artifacts/${ZIP_NAME}" + + if [[ -f "artifacts/SKYNET-SSO-${RELEASE_TAG}.xpi" ]]; then + upload_asset "artifacts/SKYNET-SSO-${RELEASE_TAG}.xpi" + else + echo "AMO credentials are not configured; ZIP is attached, AMO publication skipped." + fi + + - name: Preserve build files in workflow artifacts + uses: actions/upload-artifact@v3 + with: + name: SKYNET-SSO-${{ gitea.event.release.tag_name }} + path: artifacts/* + if-no-files-found: error diff --git a/src/background.js b/src/background.js new file mode 100644 index 0000000..af9fe2b --- /dev/null +++ b/src/background.js @@ -0,0 +1,147 @@ +const DEFAULTS = { + issuer: "https://auth.domain.net", + protectedHosts: ["domain.net", "domain.net2"], + pollIntervalMs: 60000 +}; + +let state = { + status: "checking", + username: "", + expiresAt: null, + error: "" +}; + +async function settings() { + return { + ...DEFAULTS, + ...(await browser.storage.local.get(DEFAULTS)) + }; +} + +function hostMatches(host, suffix) { + const normalized = String(suffix || "") + .trim() + .toLowerCase() + .replace(/^\*\./, ""); + + return normalized && ( + host === normalized || + host.endsWith("." + normalized) + ); +} + +async function refreshSession() { + const cfg = await settings(); + + try { + const response = await fetch( + cfg.issuer.replace(/\/$/, "") + "/user/api/info", + { + method: "GET", + credentials: "include", + cache: "no-store" + } + ); + + if (response.status === 401) { + state = { + status: "anonymous", + username: "", + expiresAt: null, + error: "" + }; + } else if (!response.ok) { + throw new Error("HTTP " + response.status); + } else { + const data = await response.json(); + + state = { + status: "authenticated", + username: data.username || "", + expiresAt: null, + error: "" + }; + } + } catch (error) { + state = { + ...state, + status: "unavailable", + error: error.message || String(error) + }; + } + + await browser.storage.local.set({ sessionState: state }); + + await browser.tabs.query({}).then(tabs => { + for (const tab of tabs) { + if (tab.id) { + browser.tabs.sendMessage( + tab.id, + { type: "SSO_STATE", state } + ).catch(() => {}); + } + } + }); + + return state; +} + +browser.runtime.onMessage.addListener(async message => { + if (message?.type === "SSO_IS_HOST_ALLOWED") { + const cfg = await settings(); + + return (cfg.protectedHosts || []).some(suffix => + hostMatches(message.host, suffix) + ); + } + + if (message?.type === "SSO_GET_STATE") { + return refreshSession(); + } + + if (message?.type === "SSO_LOGOUT") { + const cfg = await settings(); + const response = await fetch( + cfg.issuer.replace(/\/$/, "") + "/logout", + { + method: "POST", + credentials: "include", + cache: "no-store" + } + ); + + if (!response.ok) { + throw new Error( + "Déconnexion refusée (HTTP " + response.status + ")" + ); + } + + state = { + status: "anonymous", + username: "", + expiresAt: null, + error: "" + }; + + await browser.storage.local.set({ sessionState: state }); + + await browser.tabs.query({}).then(tabs => { + for (const tab of tabs) { + if (tab.id) { + browser.tabs.sendMessage( + tab.id, + { type: "SSO_STATE", state } + ).catch(() => {}); + } + } + }); + + return { success: true }; + } +}); + +browser.runtime.onInstalled.addListener(() => refreshSession()); +browser.runtime.onStartup.addListener(() => refreshSession()); + +refreshSession(); +setInterval(refreshSession, DEFAULTS.pollIntervalMs); diff --git a/src/content.js b/src/content.js new file mode 100644 index 0000000..20c094c --- /dev/null +++ b/src/content.js @@ -0,0 +1,307 @@ +(async () => { + if ( + window.top !== window || + document.getElementById("skynet-sso-bar") + ) { + return; + } + + const allowed = await browser.runtime.sendMessage({ + type: "SSO_IS_HOST_ALLOWED", + host: location.hostname + }).catch(() => false); + + if (!allowed || document.getElementById("skynet-sso-bar")) { + return; + } + + const prefs = await browser.storage.local.get({ + showNotch: true + }); + + const bar = document.createElement("aside"); + bar.id = "skynet-sso-bar"; + bar.dataset.collapsed = "false"; + bar.dataset.showNotch = String(prefs.showNotch !== false); + bar.setAttribute("aria-live", "polite"); + + bar.innerHTML = ` + + +
+ + Vérification de la session… +
+ +
+ +
+ + + +
+ + + `; + + document.documentElement.appendChild(bar); + + function collapseAfterPageLoad() { + bar.dataset.collapsed = "true"; + } + + if (document.readyState === "complete") { + collapseAfterPageLoad(); + } else { + window.addEventListener("load", collapseAfterPageLoad, { once: true }); + } + + const dialog = document.createElement("div"); + dialog.id = "skynet-sso-dialog"; + dialog.innerHTML = ` +
+ + `; + document.documentElement.appendChild(dialog); + + const dialogPanel = dialog.querySelector(".skynet-sso-dialog-panel"); + const dialogCancel = dialog.querySelector(".skynet-sso-dialog-cancel"); + const dialogConfirm = dialog.querySelector(".skynet-sso-dialog-confirm"); + const dialogError = dialog.querySelector(".skynet-sso-dialog-error"); + const dialogProgress = dialog.querySelector(".skynet-sso-dialog-progress"); + const dialogProgressLabel = dialog.querySelector(".skynet-sso-dialog-progress-label"); + const dialogDescription = dialog.querySelector("#skynet-sso-dialog-description"); + + function closeLogoutDialog() { + if (dialog.dataset.busy === "true") return; + dialog.dataset.open = "false"; + dialogError.hidden = true; + logout.focus(); + } + + function openLogoutDialog() { + dialog.dataset.open = "true"; + dialog.dataset.busy = "false"; + dialogError.hidden = true; + dialogProgress.hidden = true; + dialogDescription.hidden = false; + dialogConfirm.disabled = false; + dialogCancel.disabled = false; + dialogConfirm.querySelector("span").textContent = "Me déconnecter"; + dialogPanel.focus(); + } + + function setLogoutBusy(busy) { + dialog.dataset.busy = String(busy); + dialogProgress.hidden = !busy; + dialogDescription.hidden = busy; + dialogCancel.disabled = busy; + dialogConfirm.disabled = busy; + dialogConfirm.querySelector("span").textContent = busy + ? "Déconnexion…" + : "Me déconnecter"; + dialogProgressLabel.textContent = "Déconnexion en cours…"; + dialogError.hidden = true; + } + + dialogCancel.addEventListener("click", closeLogoutDialog); + dialog.querySelector(".skynet-sso-dialog-backdrop") + .addEventListener("click", closeLogoutDialog); + dialogConfirm.addEventListener("click", async () => { + if (dialog.dataset.busy === "true") return; + + setLogoutBusy(true); + + try { + const result = await browser.runtime.sendMessage({ + type: "SSO_LOGOUT" + }); + + if (!result?.success) { + throw new Error("Le serveur n’a pas confirmé la déconnexion."); + } + + dialogProgressLabel.textContent = "Session fermée. Actualisation…"; + render({ status: "anonymous" }); + window.location.reload(); + } catch (error) { + dialog.dataset.busy = "false"; + dialogProgress.hidden = true; + dialogDescription.hidden = false; + dialogCancel.disabled = false; + dialogConfirm.disabled = false; + dialogConfirm.querySelector("span").textContent = "Réessayer"; + dialogError.textContent = error.message || "La déconnexion a échoué. Veuillez réessayer."; + dialogError.hidden = false; + } + }); + + document.addEventListener("keydown", event => { + if (dialog.dataset.open !== "true") return; + if (event.key === "Escape") { + event.preventDefault(); + closeLogoutDialog(); + } + if (event.key === "Tab") { + const focusable = [dialogCancel, dialogConfirm].filter( + element => !element.disabled + ); + if (!focusable.length) { + event.preventDefault(); + return; + } + const first = focusable[0]; + const last = focusable[focusable.length - 1]; + if (event.shiftKey && document.activeElement === first) { + event.preventDefault(); + last.focus(); + } else if (!event.shiftKey && document.activeElement === last) { + event.preventDefault(); + first.focus(); + } + } + }); + + const label = bar.querySelector(".skynet-sso-label"); + const user = bar.querySelector(".skynet-sso-user"); + const logout = bar.querySelector(".skynet-sso-logout"); + const tab = bar.querySelector(".skynet-sso-tab"); + const collapse = bar.querySelector(".skynet-sso-collapse"); + const brand = bar.querySelector(".skynet-sso-brand"); + + brand.addEventListener("click", async event => { + event.preventDefault(); + event.stopPropagation(); + + const cfg = await browser.storage.local.get({ + homeUrl: "https://celjim.fr" + }); + + const destination = String( + cfg.homeUrl || "https://git.celjim.fr/public/zoraxy-sso-extension-firefox" + ).trim(); + + if (/^https?:\/\//i.test(destination)) { + window.location.assign(destination); + } + }); + + document.addEventListener("click", event => { + if ( + bar.dataset.collapsed !== "true" && + !bar.contains(event.target) + ) { + bar.dataset.collapsed = "true"; + } + }, true); + + collapse.addEventListener("click", event => { + event.preventDefault(); + event.stopPropagation(); + bar.dataset.collapsed = "true"; + }); + + function revealBar(event) { + event?.preventDefault(); + event?.stopPropagation(); + bar.dataset.collapsed = "false"; + } + + tab.addEventListener("mouseenter", revealBar); + tab.addEventListener("click", revealBar); + + function render(state) { + bar.dataset.state = state.status; + user.textContent = state.username || ""; + logout.hidden = state.status !== "authenticated"; + + if (state.status === "authenticated") { + label.textContent = "Session SSO active"; + } else if (state.status === "anonymous") { + label.textContent = "Aucune session SSO"; + } else if (state.status === "unavailable") { + label.textContent = "Serveur SSO indisponible"; + } else { + label.textContent = "Vérification de la session…"; + } + } + + browser.runtime.sendMessage({ + type: "SSO_GET_STATE" + }).then(render).catch(() => { + render({ status: "unavailable" }); + }); + + browser.runtime.onMessage.addListener(message => { + if (message?.type === "SSO_STATE") { + render(message.state); + } + }); + + browser.storage.onChanged.addListener((changes, area) => { + if (area === "local" && changes.showNotch) { + bar.dataset.showNotch = String( + changes.showNotch.newValue !== false + ); + } + }); + + logout.addEventListener("click", event => { + event.preventDefault(); + event.stopPropagation(); + openLogoutDialog(); + }); +})(); diff --git a/src/icons/logoSkynet.ico b/src/icons/logoSkynet.ico new file mode 100644 index 0000000..43318eb Binary files /dev/null and b/src/icons/logoSkynet.ico differ diff --git a/src/icons/logoSkynet.png b/src/icons/logoSkynet.png new file mode 100644 index 0000000..964edf7 Binary files /dev/null and b/src/icons/logoSkynet.png differ diff --git a/src/icons/skynet.png b/src/icons/skynet.png new file mode 100644 index 0000000..3d6b17e Binary files /dev/null and b/src/icons/skynet.png differ diff --git a/src/manifest.json b/src/manifest.json new file mode 100644 index 0000000..d516518 --- /dev/null +++ b/src/manifest.json @@ -0,0 +1,34 @@ +{ + "manifest_version": 3, + "name": "SKYNET SSO", + "version": "0.0.1", + "description": "Affiche l'état de la session SSO Zoraxy et permet une déconnexion.", + "browser_specific_settings": { + "gecko": { + "id": "skynet-sso@celjim.fr", + "strict_min_version": "128.0" + } + }, + "permissions": ["storage", "tabs"], + "host_permissions": ["http://*/*", "https://*/*"], + "web_accessible_resources": [ + { + "resources": ["icons/skynet.png"], + "matches": ["http://*/*", "https://*/*"] + } + ], + "icons": { "128": "icons/logoSkynet.ico" }, + "background": { "scripts": ["background.js"] }, + "content_scripts": [{ + "matches": ["http://*/*", "https://*/*"], + "js": ["content.js"], + "css": ["skynet.css"], + "run_at": "document_idle" + }], + "options_ui": { "page": "options.html", "open_in_tab": true }, + "action": { + "default_title": "SKYNET SSO", + "default_popup": "popup.html", + "default_icon": { "128": "icons/logoSkynet.ico" } + } +} \ No newline at end of file diff --git a/src/options.css b/src/options.css new file mode 100644 index 0000000..2319fb3 --- /dev/null +++ b/src/options.css @@ -0,0 +1,94 @@ +* { + box-sizing: border-box; +} + +body { + margin: 0; + background: #071629; + color: #e8f5ff; + font: 14px/1.5 Inter, "Segoe UI", sans-serif; +} + +main { + max-width: 680px; + margin: 48px auto; + padding: 28px; + background: #0c213c; + border: 1px solid #1d4565; + border-radius: 12px; +} + +header { + display: flex; + gap: 14px; + align-items: center; + margin-bottom: 28px; +} + +.app-icon { + width: 54px; + height: 54px; + object-fit: contain; +} + +h1 { + margin: 0; + letter-spacing: 0.1em; + font-size: 19px; +} + +header p, +.hint { + margin: 2px 0; + color: #91abc2; +} + +label { + display: block; + margin: 18px 0 7px; + color: #c8e3f8; +} + +input:not([type="checkbox"]), +textarea { + width: 100%; + padding: 10px; + border: 1px solid #294c68; + border-radius: 6px; + background: #071629; + color: #e8f5ff; + font: inherit; +} + +textarea { + resize: vertical; +} + +.toggle-row { + display: flex; + align-items: center; + gap: 10px; + margin-top: 22px; +} + +.toggle-row input { + width: 17px; + height: 17px; + accent-color: #38c8ff; +} + +button { + margin-top: 18px; + padding: 10px 18px; + border: 1px solid #38aee0; + border-radius: 6px; + background: #10436a; + color: white; + font: inherit; + cursor: pointer; +} + +#result { + margin-left: 12px; + color: #57ddb0; +} diff --git a/src/options.html b/src/options.html new file mode 100644 index 0000000..9e98793 --- /dev/null +++ b/src/options.html @@ -0,0 +1,73 @@ + + + + + + Paramètres SKYNET SSO + + + + +
+
+ + +
+

SKYNET SSO

+

Paramètres de l’extension Firefox

+
+
+ + + + + + + + + + +

+ Un domaine par ligne. Les sous-domaines sont inclus automatiquement. + Exemple : domain.net couvre sub.domain.net. +

+ + + + + + +
+ + + + diff --git a/src/options.js b/src/options.js new file mode 100644 index 0000000..2989820 --- /dev/null +++ b/src/options.js @@ -0,0 +1,60 @@ +const homeUrl = document.getElementById("homeUrl"); +const issuer = document.getElementById("issuer"); +const hosts = document.getElementById("hosts"); +const showNotch = document.getElementById("showNotch"); +const result = document.getElementById("result"); + +browser.storage.local.get({ + homeUrl: "https://home.domain.net", + issuer: "https://auth.domain.net", + protectedHosts: ["domain.net", "domain2.net"], + showNotch: true +}).then(cfg => { + homeUrl.value = cfg.homeUrl; + issuer.value = cfg.issuer; + hosts.value = cfg.protectedHosts.join("\n"); + showNotch.checked = cfg.showNotch !== false; +}); + +document.getElementById("save").addEventListener("click", async () => { + const value = issuer.value.trim().replace(/\/$/, ""); + + if (!/^https:\/\//i.test(value)) { + result.textContent = "L’URL doit commencer par https://"; + return; + } + + const domains = [ + ...new Set( + hosts.value + .split(/[\r\n,;]+/) + .map(value => value.trim().toLowerCase()) + .filter(Boolean) + ) + ]; + + if ( + !domains.length || + domains.some(domain => /[\s/:?#]/.test(domain)) + ) { + result.textContent = "Vérifiez la liste des domaines."; + return; + } + + const home = homeUrl.value.trim(); + + if (!/^https?:\/\//i.test(home)) { + result.textContent = + "L’URL de la page d’accueil doit commencer par http:// ou https://"; + return; + } + + await browser.storage.local.set({ + homeUrl: home, + issuer: value, + protectedHosts: domains, + showNotch: showNotch.checked + }); + + result.textContent = "Paramètres enregistrés."; +}); diff --git a/src/popup.css b/src/popup.css new file mode 100644 index 0000000..4ae744d --- /dev/null +++ b/src/popup.css @@ -0,0 +1,61 @@ +* { + box-sizing: border-box; +} + +body { + width: 290px; + margin: 0; + background: #071629; + color: #e8f5ff; + font: 13px/1.5 Inter, "Segoe UI", sans-serif; +} + +main { + padding: 16px; +} + +header { + display: flex; + align-items: center; + gap: 10px; + padding-bottom: 14px; + border-bottom: 1px solid #1c3b58; +} + +.app-icon { + width: 38px; + height: 38px; + object-fit: contain; +} + +header strong { + display: block; + letter-spacing: 0.1em; +} + +small { + color: #8fa9c0; +} + +section { + padding: 18px 0; + color: #bcd3e7; +} + +button { + width: 100%; + padding: 9px; + border: 1px solid #2f9bc9; + border-radius: 6px; + background: #10436a; + color: white; + cursor: pointer; +} + +a { + display: block; + margin-top: 14px; + color: #38c8ff; + text-decoration: none; + font-size: 12px; +} diff --git a/src/popup.html b/src/popup.html new file mode 100644 index 0000000..3bad23f --- /dev/null +++ b/src/popup.html @@ -0,0 +1,40 @@ + + + + + + SKYNET SSO + + + + +
+
+ + +
+ SKYNET SSO + Central authentication +
+
+ +
+ Vérification… +
+ + + + + Paramètres de l’extension + +
+ + + + diff --git a/src/popup.js b/src/popup.js new file mode 100644 index 0000000..c37fe1d --- /dev/null +++ b/src/popup.js @@ -0,0 +1,34 @@ +const stateNode = document.getElementById("state"); +const logout = document.getElementById("logout"); + +browser.runtime.sendMessage({ + type: "SSO_GET_STATE" +}).then(state => { + stateNode.textContent = state.status === "authenticated" + ? "Connecté : " + state.username + : state.status === "anonymous" + ? "Aucune session active" + : "Service SSO indisponible"; + + logout.hidden = state.status !== "authenticated"; +}).catch(() => { + stateNode.textContent = "Impossible de joindre le service SSO"; +}); + +logout.addEventListener("click", async () => { + logout.disabled = true; + logout.textContent = "Déconnexion…"; + + try { + await browser.runtime.sendMessage({ + type: "SSO_LOGOUT" + }); + + stateNode.textContent = "Session centrale fermée"; + logout.hidden = true; + } catch (error) { + stateNode.textContent = error.message || "Échec de la déconnexion"; + logout.disabled = false; + logout.textContent = "Déconnexion"; + } +}); diff --git a/src/skynet.css b/src/skynet.css new file mode 100644 index 0000000..a8609ac --- /dev/null +++ b/src/skynet.css @@ -0,0 +1,456 @@ +#skynet-sso-bar { + --sky-bg: rgba(7, 18, 35, 0.97); + --sky-line: rgba(57, 190, 255, 0.24); + --sky-cyan: #38c8ff; + --sky-text: #e8f5ff; + --sky-muted: #91abc2; + + position: fixed; + z-index: 2147483647; + inset: 0 0 auto 0; + min-height: 44px; + display: flex; + align-items: center; + gap: 18px; + padding: 7px 14px; + color: var(--sky-text); + background: linear-gradient( + 100deg, + var(--sky-bg), + #0b2948 65%, + #10213b + ); + border-bottom: 1px solid var(--sky-line); + box-shadow: 0 5px 22px rgba(0, 0, 0, 0.22); + font: 12px/1.4 Inter, "Segoe UI", sans-serif; + transition: transform 0.38s cubic-bezier(0.22, 0.8, 0.25, 1); + will-change: transform; +} + +#skynet-sso-bar * { + box-sizing: border-box; +} + +#skynet-sso-bar[data-collapsed="true"] { + transform: translateY(calc(-100% + 1px)); +} + +#skynet-sso-bar .skynet-sso-brand { + display: flex; + align-items: center; + gap: 9px; + margin: 0; + padding: 0; + border: 0; + background: transparent; + color: inherit; + font: inherit; + font-weight: 700; + letter-spacing: 0.12em; + white-space: nowrap; + cursor: pointer; +} + +#skynet-sso-bar .skynet-sso-brand b { + color: var(--sky-cyan); +} + +#skynet-sso-bar .skynet-sso-mark { + width: 50px; + height: 50px; + object-fit: contain; +} + +#skynet-sso-bar .skynet-sso-status { + display: flex; + align-items: center; + gap: 8px; + color: var(--sky-muted); +} + +#skynet-sso-bar .skynet-sso-status i { + width: 7px; + height: 7px; + border-radius: 50%; + background: #71869a; +} + +#skynet-sso-bar[data-state="authenticated"] .skynet-sso-status i { + background: #35d69a !important; + box-shadow: 0 0 9px #35d69a; +} + +#skynet-sso-bar[data-state="unavailable"] .skynet-sso-status i { + background: #ffb454; +} + +#skynet-sso-bar .skynet-sso-user { + color: #c9eaff; + font-weight: 600; +} + +#skynet-sso-bar .skynet-sso-logout { + padding: 6px 11px; + border: 1px solid rgba(56, 200, 255, 0.55); + border-radius: 6px; + background: rgba(14, 75, 112, 0.55); + color: #eaf8ff; + font: inherit; + cursor: pointer; +} + +#skynet-sso-bar .skynet-sso-logout:hover { + background: #12517a; +} + +#skynet-sso-bar .skynet-sso-logout:disabled { + opacity: 0.6; + cursor: wait; +} + +#skynet-sso-bar .skynet-sso-actions { + display: flex; + align-items: center; + gap: 12px; + margin-left: auto; +} + +#skynet-sso-bar .skynet-sso-collapse { + display: grid; + place-items: center; + width: 28px; + height: 28px; + flex: 0 0 28px; + padding: 0; + border: 1px solid transparent; + border-radius: 50%; + background: transparent; + cursor: pointer; + transition: background 0.2s ease, border-color 0.2s ease; +} + +#skynet-sso-bar .skynet-sso-collapse span, +#skynet-sso-bar .skynet-sso-tab span { + display: block; + width: 7px; + height: 7px; + border-right: 1.5px solid var(--sky-cyan); + border-bottom: 1.5px solid var(--sky-cyan); +} + +#skynet-sso-bar .skynet-sso-collapse span { + transform: translateY(2px) rotate(225deg); +} + +#skynet-sso-bar .skynet-sso-collapse:hover { + background: rgba(56, 200, 255, 0.1); + border-color: rgba(56, 200, 255, 0.22); +} + +#skynet-sso-bar .skynet-sso-tab { + position: absolute; + left: 50%; + bottom: -13px; + display: none; + align-items: center; + justify-content: center; + width: 42px; + height: 14px; + padding: 0 0 3px; + transform: translateX(-50%); + border: 1px solid rgba(56, 200, 255, 0.25); + border-top: 0; + border-radius: 0 0 8px 8px; + background: rgba(11, 41, 72, 0.96); + box-shadow: 0 3px 10px rgba(0, 0, 0, 0.16); + cursor: pointer; + transition: background 0.2s ease, height 0.2s ease; +} + +#skynet-sso-bar .skynet-sso-tab span { + transform: translateY(-2px) rotate(45deg); +} + +#skynet-sso-bar .skynet-sso-tab:hover { + height: 17px; + background: #103656; + border-color: rgba(56, 200, 255, 0.5); +} + +#skynet-sso-bar[data-collapsed="true"][data-show-notch="true"] .skynet-sso-tab { + display: flex; +} + +#skynet-sso-bar[data-collapsed="true"] .skynet-sso-collapse { + display: none; +} + +#skynet-sso-bar[data-collapsed="true"][data-show-notch="false"] { + transform: translateY(-100%); +} + +@media (max-width: 600px) { + #skynet-sso-bar { + gap: 10px; + padding: 6px 9px; + } + + #skynet-sso-bar .skynet-sso-brand { + letter-spacing: 0.04em; + } + + #skynet-sso-bar .skynet-sso-status { + font-size: 11px; + } + + #skynet-sso-bar .skynet-sso-actions { + gap: 6px; + } + + #skynet-sso-bar .skynet-sso-logout { + padding: 5px 7px; + font-size: 11px; + } +} + + +/* Confirmation de déconnexion */ +#skynet-sso-dialog { + --sky-dialog-bg: #08182b; + --sky-dialog-line: rgba(76, 190, 245, 0.2); + --sky-dialog-cyan: #54d2ff; + --sky-dialog-text: #edf8ff; + --sky-dialog-muted: #9bb2c8; + + position: fixed; + z-index: 2147483647; + inset: 0; + display: grid; + place-items: center; + padding: 24px; + color: var(--sky-dialog-text); + font: 14px/1.55 Inter, "Segoe UI", sans-serif; + opacity: 0; + visibility: hidden; + pointer-events: none; + transition: opacity 0.24s ease, visibility 0.24s ease; +} + +#skynet-sso-dialog[data-open="true"] { + opacity: 1; + visibility: visible; + pointer-events: auto; +} + +#skynet-sso-dialog *, +#skynet-sso-dialog *::before, +#skynet-sso-dialog *::after { + box-sizing: border-box; +} + +#skynet-sso-dialog .skynet-sso-dialog-backdrop { + position: absolute; + inset: 0; + background: rgba(2, 9, 19, 0.7); + -webkit-backdrop-filter: blur(7px); + backdrop-filter: blur(7px); +} + +#skynet-sso-dialog .skynet-sso-dialog-panel { + position: relative; + width: min(100%, 420px); + padding: 34px 34px 28px; + overflow: hidden; + text-align: center; + background: + radial-gradient(ellipse at 50% -20%, rgba(40, 155, 220, 0.2), transparent 62%), + linear-gradient(145deg, #0c2139, var(--sky-dialog-bg) 72%); + border: 1px solid var(--sky-dialog-line); + border-radius: 18px; + box-shadow: + 0 28px 90px rgba(0, 0, 0, 0.48), + inset 0 1px rgba(255, 255, 255, 0.045); + transform: translateY(12px) scale(0.985); + transition: transform 0.28s cubic-bezier(0.2, 0.75, 0.25, 1); + outline: none; +} + +#skynet-sso-dialog[data-open="true"] .skynet-sso-dialog-panel { + transform: translateY(0) scale(1); +} + +#skynet-sso-dialog .skynet-sso-dialog-symbol { + display: grid; + place-items: center; + width: 52px; + height: 52px; + margin: 0 auto 18px; + border: 1px solid rgba(84, 210, 255, 0.28); + border-radius: 16px; + background: rgba(40, 155, 220, 0.1); + box-shadow: 0 0 28px rgba(40, 155, 220, 0.1); +} + +#skynet-sso-dialog .skynet-sso-dialog-symbol span { + width: 17px; + height: 17px; + border: 1.7px solid var(--sky-dialog-cyan); + border-radius: 50%; + position: relative; +} + +#skynet-sso-dialog .skynet-sso-dialog-symbol span::after { + content: ""; + position: absolute; + width: 7px; + height: 7px; + right: -4px; + bottom: -2px; + border-right: 1.7px solid var(--sky-dialog-cyan); + border-bottom: 1.7px solid var(--sky-dialog-cyan); + background: #0b1c30; +} + +#skynet-sso-dialog .skynet-sso-dialog-eyebrow { + margin: 0 0 8px; + color: var(--sky-dialog-cyan); + font-size: 10px; + font-weight: 700; + letter-spacing: 0.2em; +} + +#skynet-sso-dialog h2 { + margin: 0; + color: var(--sky-dialog-text); + font-size: 21px; + font-weight: 650; + letter-spacing: -0.025em; +} + +#skynet-sso-dialog #skynet-sso-dialog-description { + max-width: 310px; + margin: 12px auto 0; + color: var(--sky-dialog-muted); + font-size: 13px; +} + +#skynet-sso-dialog .skynet-sso-dialog-actions { + display: flex; + justify-content: center; + gap: 10px; + margin-top: 27px; +} + +#skynet-sso-dialog .skynet-sso-dialog-actions button { + min-height: 40px; + padding: 0 16px; + border-radius: 9px; + font: inherit; + font-size: 12px; + font-weight: 600; + cursor: pointer; + transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease; +} + +#skynet-sso-dialog .skynet-sso-dialog-cancel { + color: #c2d2e1; + border: 1px solid rgba(158, 188, 215, 0.18); + background: rgba(255, 255, 255, 0.035); +} + +#skynet-sso-dialog .skynet-sso-dialog-cancel:hover:not(:disabled) { + background: rgba(255, 255, 255, 0.08); + border-color: rgba(158, 188, 215, 0.32); +} + +#skynet-sso-dialog .skynet-sso-dialog-confirm { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 13px; + color: #041523; + border: 1px solid #69d7ff; + background: linear-gradient(115deg, #72ddff, #35b8ee); + box-shadow: 0 5px 18px rgba(45, 174, 230, 0.2); +} + +#skynet-sso-dialog .skynet-sso-dialog-confirm:hover:not(:disabled) { + transform: translateY(-1px); + background: linear-gradient(115deg, #9ae8ff, #53c8f5); +} + +#skynet-sso-dialog .skynet-sso-dialog-confirm:disabled, +#skynet-sso-dialog .skynet-sso-dialog-cancel:disabled { + opacity: 0.55; + cursor: wait; +} + +#skynet-sso-dialog .skynet-sso-dialog-arrow { + font-size: 15px; + line-height: 1; +} + +#skynet-sso-dialog .skynet-sso-dialog-progress { + display: flex; + align-items: center; + justify-content: center; + gap: 11px; + margin-top: 23px; + color: #c4eaff; + font-size: 12px; +} + +#skynet-sso-dialog .skynet-sso-dialog-progress[hidden], +#skynet-sso-dialog [hidden] { + display: none !important; +} + +#skynet-sso-dialog .skynet-sso-spinner { + width: 17px; + height: 17px; + flex: 0 0 17px; + border: 2px solid rgba(84, 210, 255, 0.2); + border-top-color: var(--sky-dialog-cyan); + border-radius: 50%; + animation: skynet-sso-spin 0.75s linear infinite; +} + +#skynet-sso-dialog .skynet-sso-dialog-error { + margin: 16px 0 0; + color: #ff9c9c; + font-size: 12px; +} + +@keyframes skynet-sso-spin { + to { transform: rotate(360deg); } +} + +@media (max-width: 480px) { + #skynet-sso-dialog { + padding: 16px; + } + + #skynet-sso-dialog .skynet-sso-dialog-panel { + padding: 29px 22px 23px; + } + + #skynet-sso-dialog .skynet-sso-dialog-actions { + flex-direction: column-reverse; + } + + #skynet-sso-dialog .skynet-sso-dialog-actions button { + width: 100%; + } +} + +@media (prefers-reduced-motion: reduce) { + #skynet-sso-dialog, + #skynet-sso-dialog .skynet-sso-dialog-panel, + #skynet-sso-dialog .skynet-sso-dialog-actions button { + transition: none; + } + + #skynet-sso-dialog .skynet-sso-spinner { + animation-duration: 1.8s; + } +}