Compare commits

2 Commits

Author SHA1 Message Date
dqj
4bd3ca0e2b UI improved 2026-01-22 21:46:12 +09:00
dqj
9218662a4b Removed stanalone support from UI SDK 2026-01-18 22:49:11 +09:00
5 changed files with 27 additions and 228 deletions

View File

@@ -54,8 +54,8 @@
<script src="files/ua-parser.js"></script>
<script src="files/amipro_utils.js?v=20230401402"></script>
<script src="files/dfido2-lib.js?v=20230918"></script>
<script src="files/amipro_utils.js?v=20260118"></script>
<script src="files/dfido2-lib.js?v=20260118"></script>
<script>

View File

@@ -86,33 +86,9 @@
border-radius: 6px;
background-color: #e7f1ff;
border-left: 4px solid #0d6efd;
}
}
.fido2-sdk-standalone {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 40px 20px;
}
.fido2-sdk-standalone .container {
max-width: 1000px;
}
.fido2-sdk-standalone .card {
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
border: none;
}
.fido2-sdk-standalone .card-header {
background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
border-bottom: 2px solid #dee2e6;
}
.fido2-sdk-standalone .card-body {
background-color: #ffffff;
}
.fido2-sdk-table .text-danger {
.fido2-sdk-table .text-danger {
color: #dc3545 !important;
text-decoration: none;
transition: all 0.2s ease;
@@ -134,15 +110,11 @@
@media (max-width: 768px) {
.fido2-sdk-modal .modal-dialog {
margin: 10px;
max-width: calc(100% - 20px);
}
margin: 10px;
max-width: calc(100% - 20px);
}
.fido2-sdk-standalone {
padding: 20px 10px;
}
.fido2-sdk-table th,
.fido2-sdk-table th,
.fido2-sdk-table td {
padding: 8px 12px;
font-size: 14px;

View File

@@ -1685,137 +1685,6 @@
this.containerElement = null;
};
UIRenderer.prototype.renderStandalone = function() {
if (this.config.container) {
const container = typeof this.config.container === 'string'
? document.querySelector(this.config.container)
: this.config.container;
if (container) {
container.innerHTML = this._getStandaloneBodyHTML();
this.containerElement = container;
this.themeManager.applyTheme(container);
this._bindEvents();
return container;
}
}
document.body.innerHTML = this._getStandaloneBodyHTML();
document.body.className = 'fido2-sdk-standalone';
this.containerElement = document.body;
this.themeManager.applyTheme(document.body);
this._bindEvents();
return document.body;
};
UIRenderer.prototype._getStandaloneBodyHTML = function() {
const theme = this.config.theme;
const dm = window.Fido2UIManager ? window.Fido2UIManager.deviceManager : null;
const userId = dm ? dm.getEffectiveUserId() : (this.config.userId || '');
return `
<div class="container fido2-sdk-container">
<div class="card fido2-sdk-card">
<div class="card-header fido2-sdk-header d-flex justify-content-between align-items-center">
<div>
${theme.logo ? `<img src="${theme.logo}" class="fido2-sdk-logo me-2" alt="Logo">` : ''}
<h4 class="mb-0 fido2-sdk-text">${this.i18n.getText('my_devices')}</h4>
</div>
${this.config.features.showSessionStatus ? '<span class="badge fido2-sdk-status-badge" id="fido2SessionStatus"></span>' : ''}
</div>
<div class="card-body fido2-sdk-body">
${this.config.features.showUserInfo && userId ? `
<div class="alert alert-info fido2-sdk-user-info fido2-sdk-text">
<strong>${this.i18n.getText('title_welcome')}:</strong> ${userId}
</div>
` : ''}
${this.config.features.showAddButton ? `
<button type="button" class="btn btn-info mt-2 mb-3 fido2-sdk-btn fido2-sdk-btn-primary" id="fido2AddDeviceBtn">
${this.i18n.getText('btn_add')}
</button>
` : ''}
<div class="table-responsive mt-2">
<table class="table table-striped fido2-sdk-table">
<thead>
<tr>
<th>${this.i18n.getText('title_device')}</th>
<th>${this.i18n.getText('title_time')}</th>
${this.config.features.showDeleteButton ? `<th>${this.i18n.getText('title_act')}</th>` : ''}
</tr>
</thead>
<tbody id="fido2DevicesList">
<tr>
<td colspan="3" class="text-center fido2-sdk-text">${this.i18n.getText('title_empty_list')}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
`;
};
UIRenderer.prototype._getStandaloneHTML = function() {
const theme = this.config.theme;
const dm = window.Fido2UIManager ? window.Fido2UIManager.deviceManager : null;
const userId = dm ? dm.getEffectiveUserId() : (this.config.userId || '');
return `
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>${this.i18n.getText('my_devices')}</title>
<link rel="stylesheet" href="files/bootstrap.css">
<link rel="stylesheet" href="files/boxicons.css">
<link rel="stylesheet" href="files/fido2-ui-sdk.css">
</head>
<body class="fido2-sdk-standalone">
<div class="container fido2-sdk-container">
<div class="card fido2-sdk-card">
<div class="card-header fido2-sdk-header d-flex justify-content-between align-items-center">
<div>
${theme.logo ? `<img src="${theme.logo}" class="fido2-sdk-logo me-2" alt="Logo">` : ''}
<h4 class="mb-0 fido2-sdk-text">${this.i18n.getText('my_devices')}</h4>
</div>
${this.config.features.showSessionStatus ? '<span class="badge fido2-sdk-status-badge" id="fido2SessionStatus"></span>' : ''}
</div>
<div class="card-body fido2-sdk-body">
${this.config.features.showUserInfo && userId ? `
<div class="alert alert-info fido2-sdk-user-info fido2-sdk-text">
<strong>${this.i18n.getText('title_welcome')}:</strong> ${userId}
</div>
` : ''}
${this.config.features.showAddButton ? `
<button type="button" class="btn btn-info mt-2 mb-3 fido2-sdk-btn fido2-sdk-btn-primary" id="fido2AddDeviceBtn">
${this.i18n.getText('btn_add')}
</button>
` : ''}
<div class="table-responsive mt-2">
<table class="table table-striped fido2-sdk-table">
<thead>
<tr>
<th>${this.i18n.getText('title_device')}</th>
<th>${this.i18n.getText('title_time')}</th>
${this.config.features.showDeleteButton ? `<th>${this.i18n.getText('title_act')}</th>` : ''}
</tr>
</thead>
<tbody id="fido2DevicesList">
<tr>
<td colspan="3" class="text-center fido2-sdk-text">${this.i18n.getText('title_empty_list')}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</body>
</html>
`;
};
function Fido2UIManager() {
this.config = null;
@@ -1888,11 +1757,7 @@
const mode = manager.config.mode;
if (mode === 'standalone') {
manager.uiRenderer.renderStandalone();
} else {
manager.uiRenderer.renderModal();
}
manager.uiRenderer.renderModal();
manager._bindInternalEvents();
manager._loadInitialData();

View File

@@ -53,15 +53,15 @@
<script src="files/menu.js"></script>
<script src="files/main.js"></script>
<script src="files/amipro_utils.js?v=20230414"></script>
<script src="files/dfido2-lib.js?v=2025092701"></script>
<script src="files/amipro_utils.js?v=20260118"></script>
<script src="files/dfido2-lib.js?v=20260118"></script>
<script>
<!--
// For stand alone: 'https://local.dqj-macpro.com'
// For proxy: set 'https://mac-air-m2.dqj-home.com'
-->
setFidoServerURL('https://local.dqj-macpro.com');//'https://fido2.amipro.me');
setFidoServerURL('https://fido2.amipro.me'); //'https://local.dqj-macpro.com');
const i18n_messages = new Map();

View File

@@ -213,9 +213,9 @@
i18n_messages.set("msg_login_desc", lang_map);
lang_map = new Map();
lang_map.set("en-US", "Login");
lang_map.set("zh-CN", "登录");
lang_map.set("ja", "ログイン");
lang_map.set("en-US", "Passkey Login");
lang_map.set("zh-CN", "Passkey 登录");
lang_map.set("ja", "パスキーログイン");
i18n_messages.set("msg_btn_passkey_login", lang_map);
lang_map = new Map();
@@ -361,9 +361,10 @@
lang_map.set("zh-CN", "事件回调系统");
lang_map.set("ja", "イベント コールバック システム");
i18n_messages.set("msg_feature_9", lang_map);
lang_map.set("zh-CN", "主题色和样式定制");
lang_map.set("ja", "テーマの色とスタイルのカスタマイズ");
i18n_messages.set("msg_feature_7", lang_map);
lang_map.set("en-US", "Event callback system");
lang_map.set("zh-CN", "事件回调系统");
lang_map.set("ja", "イベント コールバック システム");
i18n_messages.set("msg_feature_9", lang_map);
lang_map = new Map();
lang_map.set("en-US", "Login Default");
@@ -371,51 +372,6 @@
lang_map.set("ja", "ログイン デフォルト");
i18n_messages.set("msg_code_login_default", lang_map);
lang_map = new Map();
lang_map.set("en-US", "Login Custom");
lang_map.set("zh-CN", "登录定制");
lang_map.set("ja", "ログイン カスタム");
i18n_messages.set("msg_code_login_custom", lang_map);
lang_map = new Map();
lang_map.set("en-US", "Device Manager Default");
lang_map.set("zh-CN", "设备管理缺省");
lang_map.set("ja", "デバイス管理 デフォルト");
i18n_messages.set("msg_code_device_default", lang_map);
lang_map = new Map();
lang_map.set("en-US", "Device Manager Custom");
lang_map.set("zh-CN", "设备管理定制");
lang_map.set("ja", "デバイス管理 カスタム");
i18n_messages.set("msg_code_device_custom", lang_map);
lang_map = new Map();
lang_map.set("en-US", "JS Import Examples:");
lang_map.set("zh-CN", "JS 引入示例:");
lang_map.set("ja", "JS インポート例:");
i18n_messages.set("msg_js_import_examples", lang_map);
lang_map = new Map();
lang_map.set("en-US", "Multi-language support (English/Japanese/Chinese)");
lang_map.set("zh-CN", "多语言支持(英/日/中)");
lang_map.set("ja", "多言語対応(英/日/中)");
i18n_messages.set("msg_feature_8", lang_map);
lang_map = new Map();
lang_map.set("en-US", "Event callback system");
lang_map.set("zh-CN", "事件回调系统");
lang_map.set("ja", "イベント コールバック システム");
i18n_messages.set("msg_feature_9", lang_map);
lang_map.set("zh-CN", "多语言支持(英/日/中)");
lang_map.set("ja", "多言語対応(英/日/中)");
i18n_messages.set("msg_feature_8", lang_map);
lang_map = new Map();
lang_map.set("en-US", "Event callback system");
lang_map.set("zh-CN", "事件回调系统");
lang_map.set("ja", "イベント コールバック システム");
i18n_messages.set("msg_feature_9", lang_map);
lang_map = new Map();
lang_map.set("en-US", "📊 Event Log");
lang_map.set("zh-CN", "📊 事件日志");
@@ -482,6 +438,12 @@
lang_map.set("ja", "エラーが発生しました");
i18n_messages.set("msg_log_error", lang_map);
lang_map = new Map();
lang_map.set("en-US", "Password attempts exhausted");
lang_map.set("zh-CN", "密码尝试次数已用完");
lang_map.set("ja", "パスワード試行回数が上限に達しました");
i18n_messages.set("msg_password_exhausted", lang_map);
lang_map = new Map();
lang_map.set("en-US", "Device manager closed");
lang_map.set("zh-CN", "设备管理器已关闭");
@@ -665,7 +627,7 @@ Fido2UIManager.renderDeviceManager({<br>
<div id="device-container"></div>
<script>
const SERVER_URL = 'https://local.dqj-macpro.com';//'https://fido2.amipro.me';
const SERVER_URL = 'https://fido2.amipro.me'; //'https://local.dqj-macpro.com';
let currentUserId = null;
let isLoggedIn = false;
@@ -904,7 +866,7 @@ Fido2UIManager.renderDeviceManager({<br>
const entry = document.createElement('div');
entry.className = 'log-entry';
const time = new Date().toLocaleTimeString('zh-CN');
const time = new Date().toLocaleTimeString(CURRENT_LANG);
const typeClass = 'log-type-' + type;
entry.innerHTML = `<span class="log-time">[${time}]</span><span class="${typeClass}">[${type.toUpperCase()}]</span> ${message}`;