mirror of
https://github.com/jellyfin/jellyfin-expo.git
synced 2024-11-27 00:00:26 +00:00
Rename JellyfinValidator to ServerValidator
This commit is contained in:
parent
f11326c1e3
commit
77addc3167
@ -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';
|
||||
|
@ -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;
|
||||
|
@ -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 = '') {
|
Loading…
Reference in New Issue
Block a user