Rename JellyfinValidator to ServerValidator

This commit is contained in:
Bill Thornton 2020-12-08 11:19:00 -05:00
parent f11326c1e3
commit 77addc3167
3 changed files with 7 additions and 7 deletions

View File

@ -14,7 +14,7 @@ import { observer } from 'mobx-react';
import { useStores } from '../hooks/useStores';
import Colors from '../constants/Colors';
import { getIconName } from '../utils/Icons';
import JellyfinValidator from '../utils/JellyfinValidator';
import ServerValidator from '../utils/ServerValidator';
const sanitizeHost = (url = '') => url.trim();
@ -38,7 +38,7 @@ const ServerInput = observer(({ onSuccess, ...props }) => {
// Parse the entered url
let url;
try {
url = JellyfinValidator.parseUrl(host);
url = ServerValidator.parseUrl(host);
console.log('parsed url', url);
} catch (err) {
console.info(err);
@ -49,7 +49,7 @@ const ServerInput = observer(({ onSuccess, ...props }) => {
}
// Validate the server is available
const validation = await JellyfinValidator.validate({ url });
const validation = await ServerValidator.validate({ url });
console.log(`Server is ${validation.isValid ? '' : 'not '}valid`);
if (!validation.isValid) {
const message = validation.message || 'invalid';

View File

@ -7,7 +7,7 @@ import { action, autorun, computed, decorate, observable } from 'mobx';
import { ignore } from 'mobx-sync';
import { task } from 'mobx-task';
import JellyfinValidator from '../utils/JellyfinValidator';
import ServerValidator from '../utils/ServerValidator';
export default class ServerModel {
id
@ -34,14 +34,14 @@ export default class ServerModel {
get parseUrlString() {
try {
return JellyfinValidator.getServerUrl(this);
return ServerValidator.getServerUrl(this);
} catch (ex) {
return '';
}
}
fetchInfo = task(async () => {
return await JellyfinValidator.fetchServerInfo(this)
return await ServerValidator.fetchServerInfo(this)
.then(action(info => {
this.online = true;
this.info = info;

View File

@ -6,7 +6,7 @@
/* globals fetch, AbortController */
import Url from 'url';
export default class JellyfinValidator {
export default class ServerValidator {
static TIMEOUT_DURATION = 5000 // timeout request after 5s
static parseUrl(host = '', port = '') {