Большое обновление
- проект переписан на flight + twig, laravel-like хелперы - docker-окружение - новая страница с подробностями о плейлисте - улучшен json о плейлисте - нормальный роутинг - нормальная статусная система - попытка перекодировки при не utf-8 + предупреждение об этом - дополнены FAQ + README
This commit is contained in:
7
src/public/css/bootstrap.min.css
vendored
Normal file
7
src/public/css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
17
src/public/index.php
Normal file
17
src/public/index.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types = 1);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Bootstrap all classes, settings, etc.
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
require '../bootstrap.php';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Start application
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
Flight::start();
|
||||
7
src/public/js/bootstrap.bundle.min.js
vendored
Normal file
7
src/public/js/bootstrap.bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
46
src/public/js/checker.js
Normal file
46
src/public/js/checker.js
Normal file
@@ -0,0 +1,46 @@
|
||||
document.querySelectorAll('tr.pls').forEach((tr) => {
|
||||
const id = tr.attributes['data-playlist-id'].value
|
||||
const xhr = new XMLHttpRequest()
|
||||
xhr.responseType = 'json'
|
||||
xhr.timeout = 60000 // ms = 1 min
|
||||
let el_status = tr.querySelector('span.status')
|
||||
let el_count = tr.querySelector('td.count')
|
||||
xhr.onreadystatechange = () => {
|
||||
if (xhr.readyState === XMLHttpRequest.DONE) {
|
||||
console.log('[' + id + '] DONE', xhr.response)
|
||||
el_status.classList.remove('bg-secondary')
|
||||
el_status.innerText = xhr.response.status
|
||||
el_count.innerText = xhr.response.count
|
||||
switch (xhr.response.status) {
|
||||
case 'online':
|
||||
el_status.classList.add('bg-success')
|
||||
break
|
||||
case 'timeout':
|
||||
el_status.classList.add('bg-warning')
|
||||
break
|
||||
default:
|
||||
el_status.classList.add('bg-danger')
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
xhr.onerror = () => {
|
||||
console.log('[' + id + '] ERROR', xhr.response)
|
||||
el_status.classList.add('bg-danger')
|
||||
el_status.innerText = 'error'
|
||||
el_count.innerText = '-'
|
||||
}
|
||||
xhr.onabort = () => {
|
||||
console.log('[' + id + '] ABORTED', xhr.response)
|
||||
el_status.classList.add('bg-secondary')
|
||||
el_count.innerText = '-'
|
||||
}
|
||||
xhr.ontimeout = () => {
|
||||
console.log('[' + id + '] TIMEOUT', xhr.response)
|
||||
el_status.classList.add('bg-secondary')
|
||||
el_status.innerText = 'timeout'
|
||||
el_count.innerText = '-'
|
||||
}
|
||||
xhr.open('GET', '/' + id + '/json')
|
||||
xhr.send()
|
||||
})
|
||||
Reference in New Issue
Block a user