mirror of
https://github.com/MeowLynxSea/CatismImage.git
synced 2025-07-09 10:54:35 +00:00
修复了https下ws连接出错的问题
This commit is contained in:
parent
b33a3eb201
commit
974f20e035
2
.env
2
.env
@ -1,6 +1,6 @@
|
|||||||
S3_ENDPOINT=http://hk.meowdream.cn:5246
|
S3_ENDPOINT=http://hk.meowdream.cn:5246
|
||||||
S3_ACCESS_KEY=s7R9zBdnQcw6FtR8Wr0J
|
S3_ACCESS_KEY=s7R9zBdnQcw6FtR8Wr0J
|
||||||
S3_SECRET_KEY=FoobOUNWN7fDL7Zh0fkXP3d0plP
|
S3_SECRET_KEY=FoobOUNWN7fDL7Zh0fkXP3d0plP/GOvzdv84baw3
|
||||||
S3_BUCKET=image
|
S3_BUCKET=image
|
||||||
MONGO_URI=mongodb://hk.meowdream.cn:27017
|
MONGO_URI=mongodb://hk.meowdream.cn:27017
|
||||||
MONGO_DB=catism_image
|
MONGO_DB=catism_image
|
@ -164,7 +164,8 @@ function fetchUserTheme() {
|
|||||||
|
|
||||||
function initWebSocket() {
|
function initWebSocket() {
|
||||||
const userKey = localStorage.getItem('userKey');
|
const userKey = localStorage.getItem('userKey');
|
||||||
socket = new WebSocket(`ws://${window.location.host}/ws/user-info?key=${userKey}`);
|
const protocol = window.location.protocol === 'https:' ? 'wss' : 'ws';
|
||||||
|
socket = new WebSocket(`${protocol}://${window.location.host}/ws/user-info?key=${userKey}`);
|
||||||
|
|
||||||
// 初始化时获取并应用主题
|
// 初始化时获取并应用主题
|
||||||
fetchUserTheme().then(theme => {
|
fetchUserTheme().then(theme => {
|
||||||
@ -208,7 +209,8 @@ function reconnectWebSocket() {
|
|||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const userKey = localStorage.getItem('userKey');
|
const userKey = localStorage.getItem('userKey');
|
||||||
socket = new WebSocket(`ws://${window.location.host}/ws/user-info?key=${userKey}`);
|
const protocol = window.location.protocol === 'https:' ? 'wss' : 'ws';
|
||||||
|
socket = new WebSocket(`${protocol}://${window.location.host}/ws/user-info?key=${userKey}`);
|
||||||
socket.onopen = function() {
|
socket.onopen = function() {
|
||||||
reconnectAttempts = 0;
|
reconnectAttempts = 0;
|
||||||
console.log('WebSocket重新连接成功');
|
console.log('WebSocket重新连接成功');
|
||||||
|
Loading…
Reference in New Issue
Block a user