修复客户平台图标加载
This commit is contained in:
Vendored
+79
-9
@@ -1,15 +1,85 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
const IM_ADMIN_URL = 'http://127.0.0.1:18080';
|
||||
const IM_ADMIN_SECRET = '123456';
|
||||
const IM_DB_DSN = 'mysql:host=127.0.0.1;port=3306;dbname=wfchat;charset=utf8mb4';
|
||||
const IM_DB_USER = 'winchen';
|
||||
const IM_DB_PASSWORD = 'winchen@0904';
|
||||
const IM_APP_DB_DSN = 'mysql:host=127.0.0.1;port=3306;dbname=appdata;charset=utf8mb4';
|
||||
const IM_APP_DB_USER = 'winchen';
|
||||
const IM_APP_DB_PASSWORD = 'winchen@0904';
|
||||
const IM_DB_TIMEZONE = 'Asia/Bangkok';
|
||||
function webImEnv(string $key, string $fallback = ''): string
|
||||
{
|
||||
$runtimeValue = getenv($key);
|
||||
if ($runtimeValue !== false && $runtimeValue !== '') {
|
||||
return $runtimeValue;
|
||||
}
|
||||
|
||||
static $env = null;
|
||||
if ($env === null) {
|
||||
$env = [];
|
||||
$paths = array_filter([
|
||||
getenv('JC_WEB_IM_ENV_FILE') ?: '',
|
||||
dirname(__DIR__, 2) . '/.env',
|
||||
'/var/www/im-admin/.env',
|
||||
'/var/www/im/.env',
|
||||
]);
|
||||
|
||||
foreach ($paths as $path) {
|
||||
if (!is_readable($path)) {
|
||||
continue;
|
||||
}
|
||||
foreach (file($path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) ?: [] as $line) {
|
||||
$line = trim($line);
|
||||
if ($line === '' || strpos($line, '#') === 0 || strpos($line, '=') === false) {
|
||||
continue;
|
||||
}
|
||||
[$name, $value] = array_map('trim', explode('=', $line, 2));
|
||||
if ($name === '') {
|
||||
continue;
|
||||
}
|
||||
$value = trim($value);
|
||||
if (
|
||||
strlen($value) >= 2
|
||||
&& (($value[0] === '"' && substr($value, -1) === '"') || ($value[0] === "'" && substr($value, -1) === "'"))
|
||||
) {
|
||||
$value = substr($value, 1, -1);
|
||||
}
|
||||
$env[$name] = $value;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $env[$key] ?? $fallback;
|
||||
}
|
||||
|
||||
function webImFirstEnv(array $keys, string $fallback = ''): string
|
||||
{
|
||||
foreach ($keys as $key) {
|
||||
$value = webImEnv($key);
|
||||
if ($value !== '') {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
return $fallback;
|
||||
}
|
||||
|
||||
function webImMysqlDsn(string $host, string $port, string $database): string
|
||||
{
|
||||
return sprintf('mysql:host=%s;port=%s;dbname=%s;charset=utf8mb4', $host, $port, $database);
|
||||
}
|
||||
|
||||
define('IM_ADMIN_URL', webImEnv('JC_WEB_IM_ADMIN_URL', 'http://127.0.0.1:18080'));
|
||||
define('IM_ADMIN_SECRET', webImFirstEnv(['JC_WEB_IM_ADMIN_SECRET', 'SecretKey'], '123456'));
|
||||
define('IM_DB_DSN', webImMysqlDsn(
|
||||
webImEnv('JC_WEB_IM_DB_HOST', webImEnv('DB_HOST', '127.0.0.1')),
|
||||
webImEnv('JC_WEB_IM_DB_PORT', webImEnv('DB_PORT', '3306')),
|
||||
webImEnv('JC_WEB_IM_DB_DATABASE', webImEnv('DB_DATABASE', 'wfchat'))
|
||||
));
|
||||
define('IM_DB_USER', webImEnv('JC_WEB_IM_DB_USER', webImEnv('DB_USERNAME', 'winchen')));
|
||||
define('IM_DB_PASSWORD', webImEnv('JC_WEB_IM_DB_PASSWORD', webImEnv('DB_PASSWORD', 'winchen@0904')));
|
||||
define('IM_APP_DB_DSN', webImMysqlDsn(
|
||||
webImFirstEnv(['JC_WEB_IM_APP_DB_HOST', 'DB_HOST_2', 'DB_HOST2_2'], webImEnv('DB_HOST', '127.0.0.1')),
|
||||
webImFirstEnv(['JC_WEB_IM_APP_DB_PORT', 'DB_PORT_2', 'DB_PORT2_2'], webImEnv('DB_PORT', '3306')),
|
||||
webImFirstEnv(['JC_WEB_IM_APP_DB_DATABASE', 'DB_DATABASE_2', 'DB_DATABASE2_2'], webImEnv('DB_DATABASE', 'appdata'))
|
||||
));
|
||||
define('IM_APP_DB_USER', webImFirstEnv(['JC_WEB_IM_APP_DB_USER', 'DB_USERNAME_2', 'DB_USERNAME2_2'], webImEnv('DB_USERNAME', 'winchen')));
|
||||
define('IM_APP_DB_PASSWORD', webImFirstEnv(['JC_WEB_IM_APP_DB_PASSWORD', 'DB_PASSWORD_2', 'DB_PASSWORD2_2'], webImEnv('DB_PASSWORD', 'winchen@0904')));
|
||||
define('IM_DB_TIMEZONE', webImEnv('JC_WEB_IM_DB_TIMEZONE', 'Asia/Bangkok'));
|
||||
|
||||
function respond(int $code, string $message, array $result = []): void
|
||||
{
|
||||
|
||||
Vendored
+17
-11
@@ -1,11 +1,17 @@
|
||||
window.JC_WEB_IM_CONFIG = {
|
||||
adminServer: 'http://winchen.ezpay.asia:8024',
|
||||
appServer: 'http://winchen.ezpay.asia:18888',
|
||||
platformConfigApi: '/api/platform_config.php',
|
||||
registerConfigApi: 'http://winchen.ezpay.asia:8024/api/register-config',
|
||||
imServerHost: 'winchen.ezpay.asia',
|
||||
imRoutePort: 18000,
|
||||
useWss: false,
|
||||
wsPath: '/ws',
|
||||
sdkMode: 'http'
|
||||
};
|
||||
(() => {
|
||||
const protocol = window.location.protocol || 'http:';
|
||||
const host = window.location.hostname || '127.0.0.1';
|
||||
|
||||
window.JC_WEB_IM_CONFIG = {
|
||||
adminServer: `${protocol}//${host}:8100`,
|
||||
appServer: `${protocol}//${host}:8888`,
|
||||
platformConfigApi: '/api/platform_config.php',
|
||||
registerConfigApi: `${protocol}//${host}:8100/api/register-config`,
|
||||
registerPhoneExistsApi: `${protocol}//${host}:8100/api/register-phone-exists`,
|
||||
imServerHost: host,
|
||||
imRoutePort: 80,
|
||||
useWss: false,
|
||||
wsPath: '/ws',
|
||||
sdkMode: 'http'
|
||||
};
|
||||
})();
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Web IM</title><link rel="icon" href="img/5IuOieu9PF8MJtp43kD2kCkdLVjVwDp7.ico"><script src="config/runtime-config.js"></script><script defer="defer" src="js/chunk-vendors.075405dd.js"></script><script defer="defer" src="js/app.baf00492.js"></script><link href="css/app.f8454e8e.css" rel="stylesheet"></head><body><noscript>请启用 JavaScript 后使用 Web IM。</noscript><div id="app"></div></body></html>
|
||||
<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Web IM</title><link rel="icon" href="img/5IuOieu9PF8MJtp43kD2kCkdLVjVwDp7.ico"><script src="config/runtime-config.js"></script><script defer="defer" src="js/chunk-vendors.075405dd.js"></script><script defer="defer" src="js/app.ec5edb4d.js"></script><link href="css/app.f8454e8e.css" rel="stylesheet"></head><body><noscript>请启用 JavaScript 后使用 Web IM。</noscript><div id="app"></div></body></html>
|
||||
Vendored
-1
File diff suppressed because one or more lines are too long
+10
-4
@@ -8769,13 +8769,19 @@ const emailRegisterEnabled = false;
|
||||
return;
|
||||
}
|
||||
document.title = platformName.value || defaultPlatformName;
|
||||
let icon = document.querySelector('link[rel="icon"]');
|
||||
const iconUrl = platformLogo.value || defaultPlatformLogo;
|
||||
setDocumentIcon('icon', iconUrl);
|
||||
setDocumentIcon('shortcut icon', iconUrl);
|
||||
setDocumentIcon('apple-touch-icon', iconUrl);
|
||||
}
|
||||
function setDocumentIcon(rel, href) {
|
||||
let icon = document.querySelector(`link[rel="${rel}"]`);
|
||||
if (!icon) {
|
||||
icon = document.createElement('link');
|
||||
icon.setAttribute('rel', 'icon');
|
||||
icon.setAttribute('rel', rel);
|
||||
document.head.appendChild(icon);
|
||||
}
|
||||
icon.setAttribute('href', platformLogo.value || defaultPlatformLogo);
|
||||
icon.setAttribute('href', href);
|
||||
}
|
||||
function handleBrandLogoError() {
|
||||
if (platformLogo.value !== defaultPlatformLogo) {
|
||||
@@ -9308,4 +9314,4 @@ const emailRegisterEnabled = false;
|
||||
/******/
|
||||
/******/ })()
|
||||
;
|
||||
//# sourceMappingURL=app.baf00492.js.map
|
||||
//# sourceMappingURL=app.ec5edb4d.js.map
|
||||
Vendored
+1
File diff suppressed because one or more lines are too long
@@ -1,15 +1,85 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
const IM_ADMIN_URL = 'http://127.0.0.1:18080';
|
||||
const IM_ADMIN_SECRET = '123456';
|
||||
const IM_DB_DSN = 'mysql:host=127.0.0.1;port=3306;dbname=wfchat;charset=utf8mb4';
|
||||
const IM_DB_USER = 'winchen';
|
||||
const IM_DB_PASSWORD = 'winchen@0904';
|
||||
const IM_APP_DB_DSN = 'mysql:host=127.0.0.1;port=3306;dbname=appdata;charset=utf8mb4';
|
||||
const IM_APP_DB_USER = 'winchen';
|
||||
const IM_APP_DB_PASSWORD = 'winchen@0904';
|
||||
const IM_DB_TIMEZONE = 'Asia/Bangkok';
|
||||
function webImEnv(string $key, string $fallback = ''): string
|
||||
{
|
||||
$runtimeValue = getenv($key);
|
||||
if ($runtimeValue !== false && $runtimeValue !== '') {
|
||||
return $runtimeValue;
|
||||
}
|
||||
|
||||
static $env = null;
|
||||
if ($env === null) {
|
||||
$env = [];
|
||||
$paths = array_filter([
|
||||
getenv('JC_WEB_IM_ENV_FILE') ?: '',
|
||||
dirname(__DIR__, 2) . '/.env',
|
||||
'/var/www/im-admin/.env',
|
||||
'/var/www/im/.env',
|
||||
]);
|
||||
|
||||
foreach ($paths as $path) {
|
||||
if (!is_readable($path)) {
|
||||
continue;
|
||||
}
|
||||
foreach (file($path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) ?: [] as $line) {
|
||||
$line = trim($line);
|
||||
if ($line === '' || strpos($line, '#') === 0 || strpos($line, '=') === false) {
|
||||
continue;
|
||||
}
|
||||
[$name, $value] = array_map('trim', explode('=', $line, 2));
|
||||
if ($name === '') {
|
||||
continue;
|
||||
}
|
||||
$value = trim($value);
|
||||
if (
|
||||
strlen($value) >= 2
|
||||
&& (($value[0] === '"' && substr($value, -1) === '"') || ($value[0] === "'" && substr($value, -1) === "'"))
|
||||
) {
|
||||
$value = substr($value, 1, -1);
|
||||
}
|
||||
$env[$name] = $value;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $env[$key] ?? $fallback;
|
||||
}
|
||||
|
||||
function webImFirstEnv(array $keys, string $fallback = ''): string
|
||||
{
|
||||
foreach ($keys as $key) {
|
||||
$value = webImEnv($key);
|
||||
if ($value !== '') {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
return $fallback;
|
||||
}
|
||||
|
||||
function webImMysqlDsn(string $host, string $port, string $database): string
|
||||
{
|
||||
return sprintf('mysql:host=%s;port=%s;dbname=%s;charset=utf8mb4', $host, $port, $database);
|
||||
}
|
||||
|
||||
define('IM_ADMIN_URL', webImEnv('JC_WEB_IM_ADMIN_URL', 'http://127.0.0.1:18080'));
|
||||
define('IM_ADMIN_SECRET', webImFirstEnv(['JC_WEB_IM_ADMIN_SECRET', 'SecretKey'], '123456'));
|
||||
define('IM_DB_DSN', webImMysqlDsn(
|
||||
webImEnv('JC_WEB_IM_DB_HOST', webImEnv('DB_HOST', '127.0.0.1')),
|
||||
webImEnv('JC_WEB_IM_DB_PORT', webImEnv('DB_PORT', '3306')),
|
||||
webImEnv('JC_WEB_IM_DB_DATABASE', webImEnv('DB_DATABASE', 'wfchat'))
|
||||
));
|
||||
define('IM_DB_USER', webImEnv('JC_WEB_IM_DB_USER', webImEnv('DB_USERNAME', 'winchen')));
|
||||
define('IM_DB_PASSWORD', webImEnv('JC_WEB_IM_DB_PASSWORD', webImEnv('DB_PASSWORD', 'winchen@0904')));
|
||||
define('IM_APP_DB_DSN', webImMysqlDsn(
|
||||
webImFirstEnv(['JC_WEB_IM_APP_DB_HOST', 'DB_HOST_2', 'DB_HOST2_2'], webImEnv('DB_HOST', '127.0.0.1')),
|
||||
webImFirstEnv(['JC_WEB_IM_APP_DB_PORT', 'DB_PORT_2', 'DB_PORT2_2'], webImEnv('DB_PORT', '3306')),
|
||||
webImFirstEnv(['JC_WEB_IM_APP_DB_DATABASE', 'DB_DATABASE_2', 'DB_DATABASE2_2'], webImEnv('DB_DATABASE', 'appdata'))
|
||||
));
|
||||
define('IM_APP_DB_USER', webImFirstEnv(['JC_WEB_IM_APP_DB_USER', 'DB_USERNAME_2', 'DB_USERNAME2_2'], webImEnv('DB_USERNAME', 'winchen')));
|
||||
define('IM_APP_DB_PASSWORD', webImFirstEnv(['JC_WEB_IM_APP_DB_PASSWORD', 'DB_PASSWORD_2', 'DB_PASSWORD2_2'], webImEnv('DB_PASSWORD', 'winchen@0904')));
|
||||
define('IM_DB_TIMEZONE', webImEnv('JC_WEB_IM_DB_TIMEZONE', 'Asia/Bangkok'));
|
||||
|
||||
function respond(int $code, string $message, array $result = []): void
|
||||
{
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
window.JC_WEB_IM_CONFIG = {
|
||||
adminServer: 'http://winchen.ezpay.asia:8024',
|
||||
appServer: 'http://winchen.ezpay.asia:18888',
|
||||
platformConfigApi: '/api/platform_config.php',
|
||||
registerConfigApi: 'http://winchen.ezpay.asia:8024/api/register-config',
|
||||
imServerHost: 'winchen.ezpay.asia',
|
||||
imRoutePort: 18000,
|
||||
useWss: false,
|
||||
wsPath: '/ws',
|
||||
sdkMode: 'http'
|
||||
};
|
||||
(() => {
|
||||
const protocol = window.location.protocol || 'http:';
|
||||
const host = window.location.hostname || '127.0.0.1';
|
||||
|
||||
window.JC_WEB_IM_CONFIG = {
|
||||
adminServer: `${protocol}//${host}:8100`,
|
||||
appServer: `${protocol}//${host}:8888`,
|
||||
platformConfigApi: '/api/platform_config.php',
|
||||
registerConfigApi: `${protocol}//${host}:8100/api/register-config`,
|
||||
registerPhoneExistsApi: `${protocol}//${host}:8100/api/register-phone-exists`,
|
||||
imServerHost: host,
|
||||
imRoutePort: 80,
|
||||
useWss: false,
|
||||
wsPath: '/ws',
|
||||
sdkMode: 'http'
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -817,13 +817,20 @@ function applyDocumentBrand() {
|
||||
return;
|
||||
}
|
||||
document.title = platformName.value || defaultPlatformName;
|
||||
let icon = document.querySelector('link[rel="icon"]');
|
||||
const iconUrl = platformLogo.value || defaultPlatformLogo;
|
||||
setDocumentIcon('icon', iconUrl);
|
||||
setDocumentIcon('shortcut icon', iconUrl);
|
||||
setDocumentIcon('apple-touch-icon', iconUrl);
|
||||
}
|
||||
|
||||
function setDocumentIcon(rel, href) {
|
||||
let icon = document.querySelector(`link[rel="${rel}"]`);
|
||||
if (!icon) {
|
||||
icon = document.createElement('link');
|
||||
icon.setAttribute('rel', 'icon');
|
||||
icon.setAttribute('rel', rel);
|
||||
document.head.appendChild(icon);
|
||||
}
|
||||
icon.setAttribute('href', platformLogo.value || defaultPlatformLogo);
|
||||
icon.setAttribute('href', href);
|
||||
}
|
||||
|
||||
function handleBrandLogoError() {
|
||||
|
||||
Reference in New Issue
Block a user