Skip to content

Commit

Permalink
支持ipv6自建服务
Browse files Browse the repository at this point in the history
  • Loading branch information
yafoo committed Sep 24, 2024
1 parent f1c8691 commit f55b47f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/html/view/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,12 @@
return this.loadMqtt();
}

const url = `${this.host.protocol}://${this.host.ip}:${this.host.port}`;
let ip = this.host.ip + '';
if(~ip.indexOf(':')) {
!~ip.indexOf('[') && (ip = `[${ip}]`);
!~ip.indexOf('[[') && (ip = `[${ip}]`);
}
const url = `${this.host.protocol}://${ip}:${this.host.port}`;
const sub_topic = this.host.push_key;
const client_id = 'pc_' + sub_topic;
const options = {
Expand Down

0 comments on commit f55b47f

Please sign in to comment.