Rename sseValid to httpValid

This commit is contained in:
Andrew Bastin
2020-05-22 02:28:14 -04:00
parent f4093d04d9
commit 76d7a3f6d4
2 changed files with 7 additions and 7 deletions

View File

@@ -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",

View File

@@ -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)
} }