Rename sseValid to httpValid
This commit is contained in:
@@ -40,7 +40,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { sseValid } from "~/functions/utils/valid"
|
import { httpValid } from "~/functions/utils/valid"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -60,7 +60,7 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
serverValid() {
|
serverValid() {
|
||||||
return sseValid(this.server)
|
return httpValid(this.server)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -81,7 +81,7 @@ export default {
|
|||||||
if (typeof EventSource !== "undefined") {
|
if (typeof EventSource !== "undefined") {
|
||||||
try {
|
try {
|
||||||
this.sse = new EventSource(this.server)
|
this.sse = new EventSource(this.server)
|
||||||
this.sse.onopen = event => {
|
this.sse.onopen = (event) => {
|
||||||
this.connectionSSEState = true
|
this.connectionSSEState = true
|
||||||
this.events.log = [
|
this.events.log = [
|
||||||
{
|
{
|
||||||
@@ -95,10 +95,10 @@ export default {
|
|||||||
icon: "sync",
|
icon: "sync",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.sse.onerror = event => {
|
this.sse.onerror = (event) => {
|
||||||
this.handleSSEError()
|
this.handleSSEError()
|
||||||
}
|
}
|
||||||
this.sse.onclose = event => {
|
this.sse.onclose = (event) => {
|
||||||
this.connectionSSEState = false
|
this.connectionSSEState = false
|
||||||
this.events.log.push({
|
this.events.log.push({
|
||||||
payload: this.$t("disconnected_from", { name: this.server }),
|
payload: this.$t("disconnected_from", { name: this.server }),
|
||||||
@@ -110,7 +110,7 @@ export default {
|
|||||||
icon: "sync_disabled",
|
icon: "sync_disabled",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.sse.onmessage = event => {
|
this.sse.onmessage = (event) => {
|
||||||
this.events.log.push({
|
this.events.log.push({
|
||||||
payload: event.data,
|
payload: event.data,
|
||||||
source: "server",
|
source: "server",
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export function wsValid(url) {
|
|||||||
/**
|
/**
|
||||||
* valid url for http/https
|
* valid url for http/https
|
||||||
*/
|
*/
|
||||||
export function sseValid(url) {
|
export function httpValid(url) {
|
||||||
return sseRegexIP.test(url) || sseRegexHostname.test(url)
|
return sseRegexIP.test(url) || sseRegexHostname.test(url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user