added validator js

ref #13
This commit is contained in:
Philipp Dormann 2021-04-07 19:03:48 +02:00
parent 517cfddc5f
commit 0cea262ac5
3 changed files with 50 additions and 31 deletions

View File

@ -1,3 +1,31 @@
# validator
**Author**: Chris O'Hara <cohara87@gmail.com>
**Repo**: https://github.com/chriso/validator.js
**License**: MIT
**Description**: String validation and sanitization
## License Text
Copyright (c) 2018 Chris O'Hara <cohara87@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# @odit/license-exporter
**Author**: ODIT.Services
**Repo**: https://git.odit.services/odit/license-exporter
@ -237,6 +265,21 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# svelte-i18n
**Author**: Christian Kaisermann <christian@kaisermann.me>
**Repo**: https://github.com/kaisermann/svelte-i18n
**License**: MIT
**Description**: Internationalization library for Svelte
## License Text
Copyright 2017 Christian Kaisermann <christian@kaisermann.me>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# svelte-preprocess
**Author**: Christian Kaisermann <christian@kaisermann.me>
**Repo**: https://github.com/sveltejs/svelte-preprocess
@ -4987,18 +5030,3 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# svelte-i18n
**Author**: Christian Kaisermann <christian@kaisermann.me>
**Repo**: https://github.com/kaisermann/svelte-i18n
**License**: MIT
**Description**: Internationalization library for Svelte
## License Text
Copyright 2017 Christian Kaisermann <christian@kaisermann.me>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -19,9 +19,12 @@
"prettier": "^2.2.1",
"prettier-plugin-svelte": "^2.2.0",
"svelte": "^3.35.0",
"svelte-i18n": "^3.3.7",
"svelte-preprocess": "^4.6.9",
"vite": "^2.1.2",
"vite-plugin-windicss": "^0.9.2",
"svelte-i18n": "^3.3.7"
"vite-plugin-windicss": "^0.9.2"
},
"dependencies": {
"validator": "^13.5.2"
}
}

View File

@ -1,5 +1,7 @@
<script>
import { apikey, lang, stationinfo } from "./store.js";
import isURL from 'validator/lib/isURL';
import isUUID from 'validator/lib/isUUID';
import axios from "axios";
import { _, locale } from "svelte-i18n";
let token;
@ -9,20 +11,6 @@
token?.length === 44 &&
token.split(".")[0].length === 7 &&
isUUID(token.split(".")[1]);
function isLocale(l) {
return $locale == l;
}
function isUUID(uuid) {
let s = "" + uuid;
s = s.match(
"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
);
if (s === null) {
return false;
}
return true;
}
</script>
<div class="w-full flex flex-wrap">