@agent-native/core 0.12.2 → 0.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/a2a/artifact-response.d.ts.map +1 -1
- package/dist/a2a/artifact-response.js +103 -9
- package/dist/a2a/artifact-response.js.map +1 -1
- package/dist/client/composer/TiptapComposer.d.ts +1 -0
- package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/client/composer/TiptapComposer.js +32 -23
- package/dist/client/composer/TiptapComposer.js.map +1 -1
- package/dist/client/extensions/ExtensionViewer.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionViewer.js +7 -2
- package/dist/client/extensions/ExtensionViewer.js.map +1 -1
- package/dist/client/extensions/ExtensionViewerPage.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionViewerPage.js +4 -1
- package/dist/client/extensions/ExtensionViewerPage.js.map +1 -1
- package/dist/client/extensions/ExtensionsListPage.js +1 -1
- package/dist/client/extensions/ExtensionsListPage.js.map +1 -1
- package/dist/client/theme.d.ts.map +1 -1
- package/dist/client/theme.js +5 -1
- package/dist/client/theme.js.map +1 -1
- package/dist/client/vite-dev-recovery-script.d.ts +10 -0
- package/dist/client/vite-dev-recovery-script.d.ts.map +1 -0
- package/dist/client/vite-dev-recovery-script.js +199 -0
- package/dist/client/vite-dev-recovery-script.js.map +1 -0
- package/dist/extensions/actions.d.ts.map +1 -1
- package/dist/extensions/actions.js +5 -1
- package/dist/extensions/actions.js.map +1 -1
- package/dist/scripts/call-agent.js +1 -1
- package/dist/scripts/call-agent.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +8 -4
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +245 -36
- package/dist/server/auth.js.map +1 -1
- package/dist/vite/client.d.ts +1 -4
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +39 -128
- package/dist/vite/client.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/server/auth.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAsChE,KAAK,KAAK,GAAG,SAAS,CAAC;AAQvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AA2BlE;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAMD,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mFAAmF;IACnF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC7D;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;OAMG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB;;;;OAIG;IACH,SAAS,CAAC,EAAE;QACV,OAAO,EAAE,MAAM,CAAC;QAChB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AAQ,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,CAG5C;AAqQD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CA6E5E;AAgvCD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,KAAK,EACV,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,OAAO,CAAC,CAmJlB;AAMD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAEzE"}
|
package/dist/server/auth.js
CHANGED
|
@@ -891,73 +891,218 @@ function stripAppBasePath(pathname) {
|
|
|
891
891
|
// ---------------------------------------------------------------------------
|
|
892
892
|
// Login page HTML (ACCESS_TOKEN mode)
|
|
893
893
|
// ---------------------------------------------------------------------------
|
|
894
|
-
|
|
894
|
+
function getTokenLoginHtml() {
|
|
895
|
+
const configuredBasePath = getAppBasePath();
|
|
896
|
+
return `<!DOCTYPE html>
|
|
895
897
|
<html lang="en">
|
|
896
898
|
<head>
|
|
897
899
|
<meta charset="UTF-8">
|
|
898
900
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
|
899
|
-
<title>
|
|
901
|
+
<title>Private app</title>
|
|
900
902
|
<style>
|
|
901
903
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
904
|
+
:root {
|
|
905
|
+
color-scheme: dark;
|
|
906
|
+
--bg: #09090b;
|
|
907
|
+
--panel: #141417;
|
|
908
|
+
--panel-soft: #1b1b20;
|
|
909
|
+
--border: rgba(255,255,255,0.1);
|
|
910
|
+
--border-strong: rgba(255,255,255,0.18);
|
|
911
|
+
--text: #f4f4f5;
|
|
912
|
+
--muted: #a1a1aa;
|
|
913
|
+
--subtle: #71717a;
|
|
914
|
+
--error: #fca5a5;
|
|
915
|
+
--error-bg: rgba(127,29,29,0.18);
|
|
916
|
+
--success: #86efac;
|
|
917
|
+
--success-bg: rgba(20,83,45,0.2);
|
|
918
|
+
--info: #c4b5fd;
|
|
919
|
+
--info-bg: rgba(76,29,149,0.18);
|
|
920
|
+
}
|
|
902
921
|
body {
|
|
903
922
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
904
|
-
background:
|
|
905
|
-
|
|
923
|
+
background:
|
|
924
|
+
radial-gradient(circle at top left, rgba(63,63,70,0.24), transparent 32rem),
|
|
925
|
+
linear-gradient(180deg, #111114 0%, var(--bg) 58%);
|
|
926
|
+
color: var(--text);
|
|
906
927
|
display: flex;
|
|
907
928
|
align-items: center;
|
|
908
929
|
justify-content: center;
|
|
909
930
|
min-height: 100vh;
|
|
931
|
+
padding: 1rem;
|
|
910
932
|
}
|
|
911
933
|
.card {
|
|
912
934
|
width: 100%;
|
|
913
|
-
max-width:
|
|
935
|
+
max-width: 420px;
|
|
914
936
|
padding: 2rem;
|
|
915
|
-
background:
|
|
916
|
-
border: 1px solid
|
|
937
|
+
background: color-mix(in srgb, var(--panel) 94%, transparent);
|
|
938
|
+
border: 1px solid var(--border);
|
|
917
939
|
border-radius: 12px;
|
|
940
|
+
box-shadow: 0 24px 80px rgba(0,0,0,0.35);
|
|
941
|
+
}
|
|
942
|
+
.eyebrow {
|
|
943
|
+
display: inline-flex;
|
|
944
|
+
align-items: center;
|
|
945
|
+
min-height: 1.5rem;
|
|
946
|
+
padding: 0 0.625rem;
|
|
947
|
+
margin-bottom: 1rem;
|
|
948
|
+
border: 1px solid var(--border);
|
|
949
|
+
border-radius: 999px;
|
|
950
|
+
color: var(--muted);
|
|
951
|
+
background: rgba(255,255,255,0.04);
|
|
952
|
+
font-size: 0.75rem;
|
|
953
|
+
font-weight: 500;
|
|
954
|
+
}
|
|
955
|
+
h1 {
|
|
956
|
+
font-size: 1.375rem;
|
|
957
|
+
line-height: 1.2;
|
|
958
|
+
font-weight: 650;
|
|
959
|
+
margin-bottom: 0.5rem;
|
|
960
|
+
color: var(--text);
|
|
961
|
+
letter-spacing: 0;
|
|
962
|
+
}
|
|
963
|
+
.intro {
|
|
964
|
+
margin-bottom: 1.5rem;
|
|
965
|
+
color: var(--muted);
|
|
966
|
+
font-size: 0.9375rem;
|
|
967
|
+
line-height: 1.55;
|
|
968
|
+
}
|
|
969
|
+
label {
|
|
970
|
+
display: flex;
|
|
971
|
+
align-items: baseline;
|
|
972
|
+
justify-content: space-between;
|
|
973
|
+
gap: 0.75rem;
|
|
974
|
+
font-size: 0.8125rem;
|
|
975
|
+
color: var(--muted);
|
|
976
|
+
margin-bottom: 0.375rem;
|
|
977
|
+
}
|
|
978
|
+
label span:last-child {
|
|
979
|
+
color: var(--subtle);
|
|
980
|
+
font-size: 0.75rem;
|
|
918
981
|
}
|
|
919
|
-
|
|
920
|
-
label { display: block; font-size: 0.8125rem; color: #888; margin-bottom: 0.375rem; }
|
|
982
|
+
.input-wrap { position: relative; }
|
|
921
983
|
input {
|
|
922
984
|
width: 100%;
|
|
985
|
+
min-height: 2.75rem;
|
|
923
986
|
padding: 0.625rem 0.75rem;
|
|
924
|
-
background: #
|
|
925
|
-
border: 1px solid
|
|
987
|
+
background: #0f0f12;
|
|
988
|
+
border: 1px solid var(--border);
|
|
926
989
|
border-radius: 8px;
|
|
927
|
-
color:
|
|
990
|
+
color: var(--text);
|
|
928
991
|
font-size: 0.9375rem;
|
|
929
992
|
outline: none;
|
|
930
993
|
}
|
|
931
|
-
input:focus {
|
|
994
|
+
input:focus {
|
|
995
|
+
border-color: var(--border-strong);
|
|
996
|
+
box-shadow: 0 0 0 3px rgba(255,255,255,0.08);
|
|
997
|
+
}
|
|
998
|
+
input::placeholder { color: #52525b; }
|
|
932
999
|
button {
|
|
933
1000
|
width: 100%;
|
|
1001
|
+
min-height: 2.75rem;
|
|
934
1002
|
margin-top: 1rem;
|
|
935
|
-
padding: 0.625rem;
|
|
936
|
-
background:
|
|
1003
|
+
padding: 0.625rem 0.875rem;
|
|
1004
|
+
background: var(--text);
|
|
937
1005
|
color: #000;
|
|
938
1006
|
border: none;
|
|
939
1007
|
border-radius: 8px;
|
|
940
1008
|
font-size: 0.9375rem;
|
|
941
|
-
font-weight:
|
|
1009
|
+
font-weight: 600;
|
|
1010
|
+
cursor: pointer;
|
|
1011
|
+
transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
|
|
1012
|
+
}
|
|
1013
|
+
button:hover:not(:disabled) { background: #e4e4e7; transform: translateY(-1px); }
|
|
1014
|
+
button:disabled { opacity: 0.55; cursor: wait; }
|
|
1015
|
+
.hint {
|
|
1016
|
+
margin-top: 0.75rem;
|
|
1017
|
+
color: var(--subtle);
|
|
1018
|
+
font-size: 0.8125rem;
|
|
1019
|
+
line-height: 1.45;
|
|
1020
|
+
}
|
|
1021
|
+
.msg {
|
|
1022
|
+
display: none;
|
|
1023
|
+
margin-top: 0.875rem;
|
|
1024
|
+
padding: 0.75rem;
|
|
1025
|
+
border-radius: 8px;
|
|
1026
|
+
font-size: 0.8125rem;
|
|
1027
|
+
line-height: 1.45;
|
|
1028
|
+
}
|
|
1029
|
+
.msg.show { display: block; }
|
|
1030
|
+
.msg.error {
|
|
1031
|
+
color: var(--error);
|
|
1032
|
+
background: var(--error-bg);
|
|
1033
|
+
border: 1px solid rgba(248,113,113,0.22);
|
|
1034
|
+
}
|
|
1035
|
+
.msg.success {
|
|
1036
|
+
color: var(--success);
|
|
1037
|
+
background: var(--success-bg);
|
|
1038
|
+
border: 1px solid rgba(74,222,128,0.18);
|
|
1039
|
+
}
|
|
1040
|
+
.msg.info {
|
|
1041
|
+
color: var(--info);
|
|
1042
|
+
background: var(--info-bg);
|
|
1043
|
+
border: 1px solid rgba(167,139,250,0.2);
|
|
1044
|
+
}
|
|
1045
|
+
details {
|
|
1046
|
+
margin-top: 1rem;
|
|
1047
|
+
padding-top: 1rem;
|
|
1048
|
+
border-top: 1px solid var(--border);
|
|
1049
|
+
}
|
|
1050
|
+
summary {
|
|
942
1051
|
cursor: pointer;
|
|
1052
|
+
color: var(--muted);
|
|
1053
|
+
font-size: 0.8125rem;
|
|
1054
|
+
font-weight: 600;
|
|
1055
|
+
}
|
|
1056
|
+
details p {
|
|
1057
|
+
margin-top: 0.75rem;
|
|
1058
|
+
color: var(--subtle);
|
|
1059
|
+
font-size: 0.8125rem;
|
|
1060
|
+
line-height: 1.5;
|
|
1061
|
+
}
|
|
1062
|
+
code {
|
|
1063
|
+
color: #e4e4e7;
|
|
1064
|
+
background: var(--panel-soft);
|
|
1065
|
+
border: 1px solid var(--border);
|
|
1066
|
+
border-radius: 5px;
|
|
1067
|
+
padding: 0.075rem 0.25rem;
|
|
1068
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
1069
|
+
font-size: 0.78rem;
|
|
1070
|
+
}
|
|
1071
|
+
@media (max-width: 480px) {
|
|
1072
|
+
.card { padding: 1.5rem; }
|
|
1073
|
+
h1 { font-size: 1.25rem; }
|
|
943
1074
|
}
|
|
944
|
-
button:hover { opacity: 0.85; }
|
|
945
|
-
.error { margin-top: 0.75rem; font-size: 0.8125rem; color: #f87171; display: none; }
|
|
946
|
-
.error.show { display: block; }
|
|
947
1075
|
</style>
|
|
948
1076
|
</head>
|
|
949
1077
|
<body>
|
|
950
1078
|
<div class="card">
|
|
951
|
-
<
|
|
1079
|
+
<div class="eyebrow">Private deployment</div>
|
|
1080
|
+
<h1>This app is private</h1>
|
|
1081
|
+
<p class="intro">Enter the shared app access token to continue. This is the value configured for this app, not your Netlify personal access token.</p>
|
|
952
1082
|
<form id="form">
|
|
953
|
-
<label for="token">
|
|
954
|
-
<
|
|
955
|
-
|
|
956
|
-
|
|
1083
|
+
<label for="token"><span>App ACCESS_TOKEN</span><span>Required</span></label>
|
|
1084
|
+
<div class="input-wrap">
|
|
1085
|
+
<input id="token" type="password" autocomplete="current-password" autofocus placeholder="Paste the shared app token" />
|
|
1086
|
+
</div>
|
|
1087
|
+
<button id="submit" type="submit">Continue</button>
|
|
1088
|
+
<p class="hint">If someone sent you this app, ask them for the shared app token. If you own the deploy, use the exact value saved as <code>ACCESS_TOKEN</code> or one of <code>ACCESS_TOKENS</code>.</p>
|
|
1089
|
+
<p class="msg error" id="msg" role="alert"></p>
|
|
957
1090
|
</form>
|
|
1091
|
+
<details>
|
|
1092
|
+
<summary>Where do I find this?</summary>
|
|
1093
|
+
<p>In Netlify, create or copy the app's shared token from Site configuration, Environment variables. The key should be <code>ACCESS_TOKEN</code> for one token or <code>ACCESS_TOKENS</code> for a comma-separated list. Redeploy after changing it.</p>
|
|
1094
|
+
</details>
|
|
958
1095
|
</div>
|
|
959
1096
|
<script>
|
|
1097
|
+
var configuredBasePath = ${JSON.stringify(configuredBasePath)};
|
|
960
1098
|
function __anBasePath() {
|
|
1099
|
+
if (
|
|
1100
|
+
configuredBasePath &&
|
|
1101
|
+
(window.location.pathname === configuredBasePath ||
|
|
1102
|
+
window.location.pathname.indexOf(configuredBasePath + '/') === 0)
|
|
1103
|
+
) {
|
|
1104
|
+
return configuredBasePath;
|
|
1105
|
+
}
|
|
961
1106
|
var marker = '/_agent-native';
|
|
962
1107
|
var idx = window.location.pathname.indexOf(marker);
|
|
963
1108
|
return idx > 0 ? window.location.pathname.slice(0, idx) : '';
|
|
@@ -965,23 +1110,87 @@ const TOKEN_LOGIN_HTML = `<!DOCTYPE html>
|
|
|
965
1110
|
function __anPath(path) {
|
|
966
1111
|
return __anBasePath() + path;
|
|
967
1112
|
}
|
|
1113
|
+
function setMessage(kind, text) {
|
|
1114
|
+
var msg = document.getElementById('msg');
|
|
1115
|
+
msg.textContent = text;
|
|
1116
|
+
msg.className = 'msg ' + kind + ' show';
|
|
1117
|
+
}
|
|
1118
|
+
function clearMessage() {
|
|
1119
|
+
var msg = document.getElementById('msg');
|
|
1120
|
+
msg.textContent = '';
|
|
1121
|
+
msg.className = 'msg error';
|
|
1122
|
+
}
|
|
1123
|
+
function setBusy(isBusy) {
|
|
1124
|
+
var button = document.getElementById('submit');
|
|
1125
|
+
var input = document.getElementById('token');
|
|
1126
|
+
button.disabled = isBusy;
|
|
1127
|
+
input.disabled = isBusy;
|
|
1128
|
+
button.textContent = isBusy ? 'Checking...' : 'Continue';
|
|
1129
|
+
}
|
|
1130
|
+
async function readJsonSafely(res) {
|
|
1131
|
+
try {
|
|
1132
|
+
return await res.json();
|
|
1133
|
+
} catch (_err) {
|
|
1134
|
+
return null;
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
async function verifySession() {
|
|
1138
|
+
var res = await fetch(__anPath('/_agent-native/auth/session'), {
|
|
1139
|
+
method: 'GET',
|
|
1140
|
+
credentials: 'same-origin',
|
|
1141
|
+
cache: 'no-store',
|
|
1142
|
+
headers: { 'Accept': 'application/json' },
|
|
1143
|
+
});
|
|
1144
|
+
if (!res.ok) return false;
|
|
1145
|
+
var data = await readJsonSafely(res);
|
|
1146
|
+
return !!data && !data.error;
|
|
1147
|
+
}
|
|
968
1148
|
document.getElementById('form').addEventListener('submit', async (e) => {
|
|
969
1149
|
e.preventDefault();
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
1150
|
+
var token = document.getElementById('token').value.trim();
|
|
1151
|
+
if (!token) {
|
|
1152
|
+
setMessage('error', 'Paste the shared app token to continue.');
|
|
1153
|
+
return;
|
|
1154
|
+
}
|
|
1155
|
+
clearMessage();
|
|
1156
|
+
setBusy(true);
|
|
1157
|
+
setMessage('info', 'Checking the app token...');
|
|
1158
|
+
try {
|
|
1159
|
+
var res = await fetch(__anPath('/_agent-native/auth/login'), {
|
|
1160
|
+
method: 'POST',
|
|
1161
|
+
headers: {
|
|
1162
|
+
'Content-Type': 'application/json',
|
|
1163
|
+
'Accept': 'application/json',
|
|
1164
|
+
},
|
|
1165
|
+
credentials: 'same-origin',
|
|
1166
|
+
body: JSON.stringify({ token: token }),
|
|
1167
|
+
});
|
|
1168
|
+
if (!res.ok) {
|
|
1169
|
+
var badTokenMessage = 'That token was not accepted. Use this app\\'s shared ACCESS_TOKEN, not a Netlify personal access token.';
|
|
1170
|
+
if (res.status === 404) {
|
|
1171
|
+
badTokenMessage = 'Could not reach this app\\'s auth endpoint. If this app is mounted under a path, confirm APP_BASE_PATH and VITE_APP_BASE_PATH match the deploy path.';
|
|
1172
|
+
}
|
|
1173
|
+
setMessage('error', badTokenMessage);
|
|
1174
|
+
setBusy(false);
|
|
1175
|
+
return;
|
|
1176
|
+
}
|
|
1177
|
+
var hasSession = await verifySession();
|
|
1178
|
+
if (!hasSession) {
|
|
1179
|
+
setMessage('error', 'The token was accepted, but the browser did not keep the session cookie. Try opening the app in a new tab, or check cookie restrictions for this domain.');
|
|
1180
|
+
setBusy(false);
|
|
1181
|
+
return;
|
|
1182
|
+
}
|
|
1183
|
+
setMessage('success', 'Signed in. Opening the app...');
|
|
1184
|
+
window.location.replace(window.location.href);
|
|
1185
|
+
} catch (_err) {
|
|
1186
|
+
setMessage('error', 'Could not contact the auth endpoint. Check the deploy status, then try again.');
|
|
1187
|
+
setBusy(false);
|
|
980
1188
|
}
|
|
981
1189
|
});
|
|
982
1190
|
</script>
|
|
983
1191
|
</body>
|
|
984
1192
|
</html>`;
|
|
1193
|
+
}
|
|
985
1194
|
// ---------------------------------------------------------------------------
|
|
986
1195
|
// mountBetterAuthRoutes — Better Auth powered auth with backward-compat routes
|
|
987
1196
|
// ---------------------------------------------------------------------------
|
|
@@ -1618,7 +1827,7 @@ function mountTokenOnlyRoutes(app, accessTokens, publicPaths = []) {
|
|
|
1618
1827
|
const session = await getSession(event);
|
|
1619
1828
|
return session ?? { error: "Not authenticated" };
|
|
1620
1829
|
}));
|
|
1621
|
-
_authGuardConfig = { loginHtml:
|
|
1830
|
+
_authGuardConfig = { loginHtml: getTokenLoginHtml(), publicPaths };
|
|
1622
1831
|
const guardFn = createAuthGuardFn();
|
|
1623
1832
|
_authGuardFn = guardFn;
|
|
1624
1833
|
app.use(defineEventHandler(guardFn));
|
|
@@ -1833,7 +2042,7 @@ export async function autoMountAuth(app, options = {}) {
|
|
|
1833
2042
|
await clearDesktopSso();
|
|
1834
2043
|
return { ok: true };
|
|
1835
2044
|
}));
|
|
1836
|
-
const byoaLoginHtml = options.loginHtml ??
|
|
2045
|
+
const byoaLoginHtml = options.loginHtml ?? getTokenLoginHtml();
|
|
1837
2046
|
_authGuardConfig = { loginHtml: byoaLoginHtml, publicPaths };
|
|
1838
2047
|
const guardFn = createAuthGuardFn();
|
|
1839
2048
|
_authGuardFn = guardFn;
|