www in docker support
This commit is contained in:
parent
539a848e95
commit
c227fce036
2145 changed files with 399596 additions and 58 deletions
|
|
@ -458,12 +458,168 @@ function stripFaceAiStateFromUrl(url) {
|
|||
cleanUrl.searchParams.delete("faceaiMatchCount");
|
||||
cleanUrl.searchParams.delete("faceaiPhotoIds");
|
||||
cleanUrl.searchParams.delete("faceaiMatchStorageKey");
|
||||
cleanUrl.searchParams.delete("faceaiResultId");
|
||||
cleanUrl.searchParams.delete("faceaiToken");
|
||||
return cleanUrl.toString();
|
||||
} catch (error) {
|
||||
return url || fallbackUrl;
|
||||
}
|
||||
}
|
||||
|
||||
function buildFaceAiBackendBaseUrl() {
|
||||
var configuredUrl = "";
|
||||
var parsedUrl;
|
||||
|
||||
if (window.faceAiConfig && window.faceAiConfig.backendBaseUrl) {
|
||||
configuredUrl = String(window.faceAiConfig.backendBaseUrl || "").trim();
|
||||
}
|
||||
|
||||
if (!configuredUrl && window.faceAiSimulator && window.faceAiSimulator.handoffUrl) {
|
||||
configuredUrl = String(window.faceAiSimulator.handoffUrl || "").trim();
|
||||
}
|
||||
|
||||
if (!configuredUrl) {
|
||||
return "";
|
||||
}
|
||||
|
||||
try {
|
||||
parsedUrl = new URL(configuredUrl, window.location.href);
|
||||
return parsedUrl.origin;
|
||||
} catch (error) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
function getFaceAiDirectReturnState() {
|
||||
if (typeof URLSearchParams === "undefined") {
|
||||
return null;
|
||||
}
|
||||
|
||||
var params = new URLSearchParams(window.location.search || "");
|
||||
var resultId = String(params.get("faceaiResultId") || "").trim();
|
||||
var token = String(params.get("faceaiToken") || "").trim();
|
||||
var backendBaseUrl = buildFaceAiBackendBaseUrl();
|
||||
|
||||
if (!resultId || !token || !backendBaseUrl) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
resultId: resultId,
|
||||
token: token,
|
||||
backendBaseUrl: backendBaseUrl,
|
||||
clearUrl: stripFaceAiStateFromUrl(window.location.href)
|
||||
};
|
||||
}
|
||||
|
||||
function persistFaceAiDirectReturnPayload(matchState, clearUrl) {
|
||||
var storageKey;
|
||||
var entryKey;
|
||||
var pendingEntryKey;
|
||||
var payload;
|
||||
var pendingPayload;
|
||||
var photoIdSet = {};
|
||||
var index;
|
||||
|
||||
if (!matchState || !matchState.photoIds || !matchState.photoIds.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
storageKey = "faceai-result-" + String(matchState.resultId || "").replace(/[^a-zA-Z0-9_-]/g, "");
|
||||
entryKey = getFaceAiMatchStorageEntryKey(storageKey);
|
||||
pendingEntryKey = getFaceAiPendingMatchEntryKey();
|
||||
payload = {
|
||||
photoIds: matchState.photoIds.slice(0),
|
||||
matchCount: matchState.matchCount,
|
||||
storedAt: new Date().toISOString()
|
||||
};
|
||||
pendingPayload = {
|
||||
storageKey: storageKey,
|
||||
raceId: String(matchState.raceId || getFaceAiCurrentRaceId() || "").trim(),
|
||||
targetPath: (function() {
|
||||
try {
|
||||
return String(new URL(clearUrl || window.location.href, window.location.href).pathname || "");
|
||||
} catch (error) {
|
||||
return window.location.pathname || "";
|
||||
}
|
||||
}()),
|
||||
payload: payload
|
||||
};
|
||||
|
||||
if (canUseFaceAiWebStorage(window.sessionStorage)) {
|
||||
window.sessionStorage.setItem(entryKey, JSON.stringify(payload));
|
||||
window.sessionStorage.setItem(pendingEntryKey, JSON.stringify(pendingPayload));
|
||||
}
|
||||
|
||||
if (canUseFaceAiWebStorage(window.localStorage)) {
|
||||
window.localStorage.setItem(entryKey, JSON.stringify(payload));
|
||||
window.localStorage.setItem(pendingEntryKey, JSON.stringify(pendingPayload));
|
||||
}
|
||||
|
||||
try {
|
||||
window.name = JSON.stringify({
|
||||
faceAiStorageKey: storageKey,
|
||||
faceAiMatchState: payload,
|
||||
faceAiPendingMatchState: pendingPayload
|
||||
});
|
||||
} catch (error) {}
|
||||
|
||||
for (index = 0; index < payload.photoIds.length; index += 1) {
|
||||
photoIdSet[payload.photoIds[index]] = true;
|
||||
}
|
||||
|
||||
window.faceAiMatchState = {
|
||||
photoIds: payload.photoIds,
|
||||
photoIdSet: photoIdSet,
|
||||
matchCount: payload.matchCount,
|
||||
storageKey: storageKey,
|
||||
clearUrl: clearUrl || stripFaceAiStateFromUrl(window.location.href),
|
||||
resultId: matchState.resultId,
|
||||
raceId: pendingPayload.raceId
|
||||
};
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function hydrateFaceAiDirectReturn() {
|
||||
var directReturnState = getFaceAiDirectReturnState();
|
||||
|
||||
if (!directReturnState) {
|
||||
return $.Deferred().resolve(false).promise();
|
||||
}
|
||||
|
||||
return $.getJSON(directReturnState.backendBaseUrl + "/bridge/results/" + encodeURIComponent(directReturnState.resultId), {
|
||||
token: directReturnState.token
|
||||
}).then(function(payload) {
|
||||
var matches = payload && payload.matches ? payload.matches : [];
|
||||
var photoIds = [];
|
||||
var photoIdLookup = {};
|
||||
var index;
|
||||
var photoId;
|
||||
|
||||
for (index = 0; index < matches.length; index += 1) {
|
||||
photoId = String((matches[index] && (matches[index].photoId || matches[index].id)) || "").trim();
|
||||
if (!photoId || photoIdLookup[photoId]) {
|
||||
continue;
|
||||
}
|
||||
photoIdLookup[photoId] = true;
|
||||
photoIds.push(photoId);
|
||||
}
|
||||
|
||||
persistFaceAiDirectReturnPayload({
|
||||
resultId: directReturnState.resultId,
|
||||
raceId: String((payload && payload.raceId) || "").trim(),
|
||||
photoIds: photoIds,
|
||||
matchCount: photoIds.length
|
||||
}, directReturnState.clearUrl);
|
||||
|
||||
window.location.replace(directReturnState.clearUrl);
|
||||
return true;
|
||||
}, function() {
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
function getFaceAiMatchState() {
|
||||
if (typeof URLSearchParams === "undefined") {
|
||||
return null;
|
||||
|
|
@ -902,6 +1058,17 @@ function prepareFaceAiLegacyRacePage() {
|
|||
return matchState;
|
||||
}
|
||||
|
||||
function initFaceAiLegacyRacePage() {
|
||||
var directReturnState = getFaceAiDirectReturnState();
|
||||
|
||||
if (directReturnState) {
|
||||
hydrateFaceAiDirectReturn();
|
||||
return null;
|
||||
}
|
||||
|
||||
return prepareFaceAiLegacyRacePage();
|
||||
}
|
||||
|
||||
function buildFaceAiLaunchUrl() {
|
||||
var raceId = $("#id_gara").val() || "";
|
||||
var raceSlug = $("#garaDesc").val() || "";
|
||||
|
|
@ -1209,7 +1376,7 @@ function goPage()
|
|||
|
||||
$(function() {
|
||||
clearLegacyLoadingState();
|
||||
prepareFaceAiLegacyRacePage();
|
||||
initFaceAiLegacyRacePage();
|
||||
initFaceAiRaceSearchButton();
|
||||
initFaceAiErrorModal();
|
||||
logFaceAiDebug("Legacy race page ready");
|
||||
|
|
|
|||
|
|
@ -56,11 +56,39 @@ if (faceAiFeatureEnabledValue == null || faceAiFeatureEnabledValue.trim().length
|
|||
}
|
||||
String faceAiFeatureEnabledNormalized = faceAiFeatureEnabledValue != null ? faceAiFeatureEnabledValue.trim() : "";
|
||||
boolean faceAiFeatureEnabled = !("0".equals(faceAiFeatureEnabledNormalized) || "false".equalsIgnoreCase(faceAiFeatureEnabledNormalized) || "no".equalsIgnoreCase(faceAiFeatureEnabledNormalized) || "off".equalsIgnoreCase(faceAiFeatureEnabledNormalized));
|
||||
String faceAiHandoffUrl = System.getenv("FACEAI_HANDOFF_URL");
|
||||
if (faceAiHandoffUrl == null || faceAiHandoffUrl.trim().length() == 0) {
|
||||
faceAiHandoffUrl = System.getProperty("FACEAI_HANDOFF_URL", "");
|
||||
}
|
||||
faceAiHandoffUrl = faceAiHandoffUrl != null ? faceAiHandoffUrl.trim() : "";
|
||||
String faceAiDevUserId = System.getenv("FACEAI_DEV_USER_ID");
|
||||
if (faceAiDevUserId == null || faceAiDevUserId.trim().length() == 0) {
|
||||
faceAiDevUserId = System.getProperty("FACEAI_DEV_USER_ID", "");
|
||||
}
|
||||
faceAiDevUserId = faceAiDevUserId != null ? faceAiDevUserId.trim() : "";
|
||||
String faceAiDevDisplayName = System.getenv("FACEAI_DEV_DISPLAY_NAME");
|
||||
if (faceAiDevDisplayName == null || faceAiDevDisplayName.trim().length() == 0) {
|
||||
faceAiDevDisplayName = System.getProperty("FACEAI_DEV_DISPLAY_NAME", "");
|
||||
}
|
||||
faceAiDevDisplayName = faceAiDevDisplayName != null ? faceAiDevDisplayName.trim() : "";
|
||||
String faceAiDevEmail = System.getenv("FACEAI_DEV_EMAIL");
|
||||
if (faceAiDevEmail == null || faceAiDevEmail.trim().length() == 0) {
|
||||
faceAiDevEmail = System.getProperty("FACEAI_DEV_EMAIL", "");
|
||||
}
|
||||
faceAiDevEmail = faceAiDevEmail != null ? faceAiDevEmail.trim() : "";
|
||||
String faceAiDevMembershipStatus = System.getenv("FACEAI_DEV_MEMBERSHIP_STATUS");
|
||||
if (faceAiDevMembershipStatus == null || faceAiDevMembershipStatus.trim().length() == 0) {
|
||||
faceAiDevMembershipStatus = System.getProperty("FACEAI_DEV_MEMBERSHIP_STATUS", "");
|
||||
}
|
||||
faceAiDevMembershipStatus = faceAiDevMembershipStatus != null ? faceAiDevMembershipStatus.trim() : "";
|
||||
%>
|
||||
<%@ include file="_inc_faceai_identity.jsp" %>
|
||||
<jsp:include page="_inc_lang.jsp" flush="true" />
|
||||
<%
|
||||
String faceAiRacePathBase = CR.getGara().getPathBase() != null ? CR.getGara().getPathBase().trim() : "";
|
||||
if (faceAiRacePathBase.isEmpty() && bean.getPathBase() != null) {
|
||||
faceAiRacePathBase = bean.getPathBase().trim();
|
||||
}
|
||||
String faceAiRaceYear = "";
|
||||
String faceAiRaceMonthFolder = "";
|
||||
String faceAiRaceFolder = "";
|
||||
|
|
@ -388,6 +416,24 @@ if (!faceAiRaceYear.isEmpty()) {
|
|||
window.faceAiConfig.enabled = <%= faceAiFeatureEnabled ? "true" : "false" %>;
|
||||
window.faceAiConfig.lang = "<%= lang %>";
|
||||
window.faceAiConfig.galleryMode = '<%= CR.getFlgVisCompatta()==1 ? "compact" : "standard" %>';
|
||||
<% if (!faceAiHandoffUrl.isEmpty()) { %>
|
||||
window.faceAiConfig.handoffUrl = "<%= faceAiHandoffUrl %>";
|
||||
window.faceAiConfig.backendBaseUrl = "<%= faceAiHandoffUrl %>";
|
||||
window.faceAiSimulator = window.faceAiSimulator || {};
|
||||
window.faceAiSimulator.handoffUrl = window.faceAiConfig.handoffUrl;
|
||||
<% if (!faceAiDevUserId.isEmpty()) { %>
|
||||
window.faceAiSimulator.devUserId = "<%= faceAiDevUserId %>";
|
||||
<% } %>
|
||||
<% if (!faceAiDevDisplayName.isEmpty()) { %>
|
||||
window.faceAiSimulator.devDisplayName = "<%= faceAiDevDisplayName %>";
|
||||
<% } %>
|
||||
<% if (!faceAiDevEmail.isEmpty()) { %>
|
||||
window.faceAiSimulator.devEmail = "<%= faceAiDevEmail %>";
|
||||
<% } %>
|
||||
<% if (!faceAiDevMembershipStatus.isEmpty()) { %>
|
||||
window.faceAiSimulator.devMembershipStatus = "<%= faceAiDevMembershipStatus %>";
|
||||
<% } %>
|
||||
<% } %>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -56,11 +56,39 @@ if (faceAiFeatureEnabledValue == null || faceAiFeatureEnabledValue.trim().length
|
|||
}
|
||||
String faceAiFeatureEnabledNormalized = faceAiFeatureEnabledValue != null ? faceAiFeatureEnabledValue.trim() : "";
|
||||
boolean faceAiFeatureEnabled = !("0".equals(faceAiFeatureEnabledNormalized) || "false".equalsIgnoreCase(faceAiFeatureEnabledNormalized) || "no".equalsIgnoreCase(faceAiFeatureEnabledNormalized) || "off".equalsIgnoreCase(faceAiFeatureEnabledNormalized));
|
||||
String faceAiHandoffUrl = System.getenv("FACEAI_HANDOFF_URL");
|
||||
if (faceAiHandoffUrl == null || faceAiHandoffUrl.trim().length() == 0) {
|
||||
faceAiHandoffUrl = System.getProperty("FACEAI_HANDOFF_URL", "");
|
||||
}
|
||||
faceAiHandoffUrl = faceAiHandoffUrl != null ? faceAiHandoffUrl.trim() : "";
|
||||
String faceAiDevUserId = System.getenv("FACEAI_DEV_USER_ID");
|
||||
if (faceAiDevUserId == null || faceAiDevUserId.trim().length() == 0) {
|
||||
faceAiDevUserId = System.getProperty("FACEAI_DEV_USER_ID", "");
|
||||
}
|
||||
faceAiDevUserId = faceAiDevUserId != null ? faceAiDevUserId.trim() : "";
|
||||
String faceAiDevDisplayName = System.getenv("FACEAI_DEV_DISPLAY_NAME");
|
||||
if (faceAiDevDisplayName == null || faceAiDevDisplayName.trim().length() == 0) {
|
||||
faceAiDevDisplayName = System.getProperty("FACEAI_DEV_DISPLAY_NAME", "");
|
||||
}
|
||||
faceAiDevDisplayName = faceAiDevDisplayName != null ? faceAiDevDisplayName.trim() : "";
|
||||
String faceAiDevEmail = System.getenv("FACEAI_DEV_EMAIL");
|
||||
if (faceAiDevEmail == null || faceAiDevEmail.trim().length() == 0) {
|
||||
faceAiDevEmail = System.getProperty("FACEAI_DEV_EMAIL", "");
|
||||
}
|
||||
faceAiDevEmail = faceAiDevEmail != null ? faceAiDevEmail.trim() : "";
|
||||
String faceAiDevMembershipStatus = System.getenv("FACEAI_DEV_MEMBERSHIP_STATUS");
|
||||
if (faceAiDevMembershipStatus == null || faceAiDevMembershipStatus.trim().length() == 0) {
|
||||
faceAiDevMembershipStatus = System.getProperty("FACEAI_DEV_MEMBERSHIP_STATUS", "");
|
||||
}
|
||||
faceAiDevMembershipStatus = faceAiDevMembershipStatus != null ? faceAiDevMembershipStatus.trim() : "";
|
||||
%>
|
||||
<%@ include file="_inc_faceai_identity.jsp" %>
|
||||
<jsp:include page="_inc_lang.jsp" flush="true" />
|
||||
<%
|
||||
String faceAiRacePathBase = CR.getGara().getPathBase() != null ? CR.getGara().getPathBase().trim() : "";
|
||||
if (faceAiRacePathBase.isEmpty() && bean.getPathBase() != null) {
|
||||
faceAiRacePathBase = bean.getPathBase().trim();
|
||||
}
|
||||
String faceAiRaceYear = "";
|
||||
String faceAiRaceMonthFolder = "";
|
||||
String faceAiRaceFolder = "";
|
||||
|
|
@ -388,6 +416,24 @@ if (!faceAiRaceYear.isEmpty()) {
|
|||
window.faceAiConfig.enabled = <%= faceAiFeatureEnabled ? "true" : "false" %>;
|
||||
window.faceAiConfig.lang = "<%= lang %>";
|
||||
window.faceAiConfig.galleryMode = '<%= CR.getFlgVisCompatta()==1 ? "compact" : "standard" %>';
|
||||
<% if (!faceAiHandoffUrl.isEmpty()) { %>
|
||||
window.faceAiConfig.handoffUrl = "<%= faceAiHandoffUrl %>";
|
||||
window.faceAiConfig.backendBaseUrl = "<%= faceAiHandoffUrl %>";
|
||||
window.faceAiSimulator = window.faceAiSimulator || {};
|
||||
window.faceAiSimulator.handoffUrl = window.faceAiConfig.handoffUrl;
|
||||
<% if (!faceAiDevUserId.isEmpty()) { %>
|
||||
window.faceAiSimulator.devUserId = "<%= faceAiDevUserId %>";
|
||||
<% } %>
|
||||
<% if (!faceAiDevDisplayName.isEmpty()) { %>
|
||||
window.faceAiSimulator.devDisplayName = "<%= faceAiDevDisplayName %>";
|
||||
<% } %>
|
||||
<% if (!faceAiDevEmail.isEmpty()) { %>
|
||||
window.faceAiSimulator.devEmail = "<%= faceAiDevEmail %>";
|
||||
<% } %>
|
||||
<% if (!faceAiDevMembershipStatus.isEmpty()) { %>
|
||||
window.faceAiSimulator.devMembershipStatus = "<%= faceAiDevMembershipStatus %>";
|
||||
<% } %>
|
||||
<% } %>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue