Compare commits
371 Commits
Author | SHA1 | Date |
---|---|---|
KodeStar | 61a5a1a8b0 | 4 years ago |
Jesper Have | e51cdd7f7a | 4 years ago |
Jesper Have | a626222ff3 | 4 years ago |
Jesper Have | af68a45a3d | 4 years ago |
Jesper Have | 7969df9344 | 4 years ago |
KodeStar | 3a9bdd2c43 | 5 years ago |
AndrazKorenc | 0292e9976e | 5 years ago |
KodeStar | c058e1a452 | 5 years ago |
vinanrra | 7f42967b67 | 5 years ago |
KodeStar | 994961de54 | 5 years ago |
KodeStar | 049d20536c | 5 years ago |
LeoShivas | c9c8171a52 | 5 years ago |
KodeStar | e7a6ac5a75 | 5 years ago |
KodeStar | 3a372107ba | 5 years ago |
KodeStar | 493374de65 | 5 years ago |
Vincent Bitter | c43fc929f7 | 5 years ago |
Vincent Bitter | 895d5f2ebe | 5 years ago |
VorpalHex | cb4768e2cf | 5 years ago |
panigrc | 6ca4bfb9ee | 5 years ago |
panigrc | 1f7de03d90 | 5 years ago |
Scott Holodak | 861d287750 | 5 years ago |
KodeStar | e2cc32fd0a | 5 years ago |
KodeStar | 762df25c45 | 5 years ago |
KodeStar | 0b114e7dc1 | 5 years ago |
Oliver Cervera | 981876c43c | 5 years ago |
Oliver Cervera | 7fe9c477e3 | 5 years ago |
Oliver Cervera | 5b3a7f4e02 | 5 years ago |
Kode | 60e20c4023 | 5 years ago |
Chris | 9e1bb6c075 | 5 years ago |
KodeStar | 9c05d0d803 | 5 years ago |
KodeStar | 3d1393c0b3 | 5 years ago |
KodeStar | 9914fdb111 | 5 years ago |
alxlaxv | 9b24c9f1b5 | 5 years ago |
Oscar Sánchez | 81b8c646d2 | 5 years ago |
Chris | f734832e0f | 5 years ago |
KodeStar | 1bde11b30b | 5 years ago |
Kode | 9e80c3fe40 | 5 years ago |
Kode | f272dd13ce | 5 years ago |
Chris | 9f26de89a4 | 5 years ago |
Chris | e23964ebad | 5 years ago |
Chris | d0584ac941 | 5 years ago |
Chris | 1410c41f48 | 5 years ago |
Chris | 5f524563cf | 5 years ago |
Chris | 3d181623c3 | 5 years ago |
KodeStar | 1919dbfd96 | 5 years ago |
Chris | 8e1615ac5f | 5 years ago |
Chris | 7966f07fdb | 5 years ago |
Chris | ac8fe7012b | 5 years ago |
Chris | 51d89dae82 | 5 years ago |
KodeStar | ef21ac0fe7 | 5 years ago |
KodeStar | 02697687cc | 5 years ago |
Kode | fd2f7f27a6 | 5 years ago |
Kode | 21b1ef5e4b | 5 years ago |
Chris | e452d3b5f6 | 5 years ago |
Chris | 1419882455 | 5 years ago |
KodeStar | d79202ed87 | 5 years ago |
KodeStar | aa05c947a9 | 5 years ago |
Chris | eb69ea05fa | 5 years ago |
Chris | 244b0998f9 | 5 years ago |
Chris | 1f608b1c21 | 5 years ago |
Chris | 7d6df3843b | 5 years ago |
Kalle Laine | dd4b94ba71 | 5 years ago |
Chris | edb9397a47 | 5 years ago |
KodeStar | 66815a8487 | 5 years ago |
KodeStar | 5ee19bceb6 | 5 years ago |
KodeStar | deba7d0279 | 5 years ago |
KodeStar | 38e93d33f1 | 5 years ago |
KodeStar | f182f305fc | 5 years ago |
KodeStar | 03c675ed57 | 5 years ago |
KodeStar | 3916b2d4dc | 5 years ago |
KodeStar | 698a7a9bbc | 5 years ago |
KodeStar | 9954d1b6bf | 5 years ago |
KodeStar | a98b981efe | 5 years ago |
KodeStar | dd2ca62eaf | 5 years ago |
Agurato | dc2a42ad6d | 5 years ago |
Guillaume Taquet Gasperini | b5b25458db | 5 years ago |
David | ac4bbceb2f | 6 years ago |
Kode | 4980bfab12 | 6 years ago |
Chris | 63e0d07d50 | 6 years ago |
Kode | 2b76520e3a | 6 years ago |
Kode | 6631b8a23b | 6 years ago |
Kode | 04d34017c1 | 6 years ago |
KodeStar | 6dcbcb452e | 6 years ago |
Kode | 7c74b3bb13 | 6 years ago |
Kode | b76a9ee118 | 6 years ago |
Kode | 40da649b10 | 6 years ago |
Chris | cd64d762e7 | 6 years ago |
Chris | b91c52820a | 6 years ago |
KodeStar | 1204ffd306 | 6 years ago |
Chris | 978267dd14 | 6 years ago |
Chris | f935fd94c6 | 6 years ago |
Chris | fb2428e21b | 6 years ago |
Chris | e36a126c01 | 6 years ago |
Chris | b186978624 | 6 years ago |
Chris | 49773d7654 | 6 years ago |
Chris | 53c03751a1 | 6 years ago |
Chris | 9d2908449a | 6 years ago |
KodeStar | caf92bcf6d | 6 years ago |
KodeStar | cbef469e02 | 6 years ago |
Chris | a6bfc1d76c | 6 years ago |
KodeStar | 0446a74de9 | 6 years ago |
KodeStar | 1a14079b39 | 6 years ago |
KodeStar | d9c1919ddc | 6 years ago |
KodeStar | f42ac0c5ba | 6 years ago |
KodeStar | c073929895 | 6 years ago |
KodeStar | 02df7844a4 | 6 years ago |
l1904l | e43aba0111 | 6 years ago |
Kode | ac7446ffe6 | 6 years ago |
Kode | e45d3ca6ec | 6 years ago |
Chris | 603550a453 | 6 years ago |
Kode | 4463ef4a9a | 6 years ago |
Kode | 49b8dc0079 | 6 years ago |
Kode | ab83c3a551 | 6 years ago |
Chris | 98c6093674 | 6 years ago |
Chris | e1f51521bf | 6 years ago |
Chris | e85bc98dcc | 6 years ago |
Chris | 4ba52baa5c | 6 years ago |
Chris | a82077b4de | 6 years ago |
Chris | b8f04f3d11 | 6 years ago |
Chris | e91f65f833 | 6 years ago |
Chris | 575ab9be2d | 6 years ago |
Chris | 64071bb60f | 6 years ago |
Chris | 44621a1a61 | 6 years ago |
Chris | c56043e1f9 | 6 years ago |
Kode | e8e4cbfd41 | 6 years ago |
Kode | 4b2bbe0614 | 6 years ago |
Kode | 9adfa14e62 | 6 years ago |
Kode | 067f82b632 | 6 years ago |
Chris | e24e7979be | 6 years ago |
Chris | c7c2b6e6f2 | 6 years ago |
Chris | 96798963d6 | 6 years ago |
Chris | 75508a81ef | 6 years ago |
Chris | f7f4efadb7 | 6 years ago |
Kode | 4cc80b98db | 6 years ago |
Kode | b07efaa7d0 | 6 years ago |
Kode | 7ba8ea6dd4 | 6 years ago |
KodeStar | 479461821f | 6 years ago |
Kode | d25aea38fb | 6 years ago |
Kode | 0067502b37 | 6 years ago |
Kode | d321af6085 | 6 years ago |
Kode | b30f1730e4 | 6 years ago |
KodeStar | 7a02986982 | 6 years ago |
Kode | a4107cba25 | 6 years ago |
KodeStar | ba187aa345 | 6 years ago |
Conny Sjöblom | b400cef734 | 6 years ago |
Conny Sjöblom | 03b72b8d2e | 6 years ago |
Conny Sjöblom | 0c7e20dee0 | 6 years ago |
Conny Sjöblom | aa42c71a06 | 6 years ago |
Kode | 041c0b81a3 | 6 years ago |
Chris | fe6776ee9d | 6 years ago |
Chris | 125b9f4160 | 6 years ago |
Kode | 488fee7b4b | 6 years ago |
Kode | 4fba596909 | 6 years ago |
Chris | af04781830 | 6 years ago |
Chris | 2507cda94c | 6 years ago |
Kode | 21c1401859 | 6 years ago |
Kode | 4351f55225 | 6 years ago |
Kode | d1956c4e88 | 6 years ago |
Chris | d76d056ed1 | 6 years ago |
Chris | e081cc31a2 | 6 years ago |
Chris | 88153b0e32 | 6 years ago |
Chris | 2b2d51cb6f | 6 years ago |
Kode | abd8c7227d | 6 years ago |
Kode | 50d6dc7b71 | 6 years ago |
Kode | b4a1ecc305 | 6 years ago |
Kode | 540bead0db | 6 years ago |
Kode | 6e9f25d680 | 6 years ago |
Kode | 268afe7006 | 6 years ago |
Kode | 7b9d3f0ec6 | 6 years ago |
Kode | de116030bc | 6 years ago |
Chris | 4fb59385b7 | 6 years ago |
Chris | 40d6808067 | 6 years ago |
Chris | 3572bd8068 | 6 years ago |
Chris | 380a0e8623 | 6 years ago |
Chris | 4f6a0cb7c6 | 6 years ago |
Chris | 56cce8233b | 6 years ago |
KodeStar | af8afcf931 | 6 years ago |
Kode | 7f997d60cd | 6 years ago |
Kode | d45f5a805e | 6 years ago |
Kode | fc9c624509 | 6 years ago |
KodeStar | 33372509eb | 6 years ago |
Kode | bca0b02925 | 6 years ago |
Kode | 24995135e6 | 6 years ago |
Chris | c1e4103edd | 6 years ago |
Chris | 6eda423156 | 6 years ago |
Chris | 7dc72d3519 | 6 years ago |
Chris | 907c22179b | 6 years ago |
Chris | cdafbab7b1 | 6 years ago |
Chris | e0064504e7 | 6 years ago |
KodeStar | b22117dd01 | 6 years ago |
KodeStar | c88efa8dbc | 6 years ago |
Kode | 7d060ff803 | 6 years ago |
KodeStar | d5f8b6aae0 | 6 years ago |
KodeStar | 2416993c5e | 6 years ago |
KodeStar | 494165a03a | 6 years ago |
KodeStar | 88e607533c | 6 years ago |
KodeStar | 035d2f9209 | 6 years ago |
alxlaxv | 53903daa87 | 6 years ago |
alxlaxv | 567994be1a | 6 years ago |
alxlaxv | 32fa27337a | 6 years ago |
Chris | e1bb7646ac | 6 years ago |
KodeStar | 108b636def | 6 years ago |
keranoz | 4abb14bf54 | 6 years ago |
Chris | f8f96593c1 | 6 years ago |
Chris | cb21b0f8f1 | 6 years ago |
Chris | 4c8c5fa27f | 6 years ago |
Chris | 6093119dde | 6 years ago |
Chris | 15755a3fd1 | 6 years ago |
Chris | 0213c81e0d | 6 years ago |
Chris | c47f296f17 | 6 years ago |
Chris | 75133474f7 | 6 years ago |
Kode | ddbe171f3a | 6 years ago |
Kode | 12e109f82c | 6 years ago |
Kode | e095589172 | 6 years ago |
Kode | d0293c785b | 6 years ago |
Chris | aa351e31bf | 6 years ago |
Chris | aceed3d13b | 6 years ago |
Chris | 10b70d4a09 | 6 years ago |
Chris | cb9e014cf3 | 6 years ago |
Chris | 99017d834e | 6 years ago |
Chris | fb73f5ca24 | 6 years ago |
dgw | 4369f1aeda | 6 years ago |
Kode | 6501aacb1b | 6 years ago |
Kode | c3da17befc | 6 years ago |
Kode | 46bb073001 | 6 years ago |
Kode | e8b47776ce | 6 years ago |
Kode | 6941fd3e2d | 6 years ago |
Andy Bottom | f5937879df | 6 years ago |
Andy Bottom | 93877b7025 | 6 years ago |
Andy Bottom | 6612631cc3 | 6 years ago |
Chris | 30c3079a90 | 6 years ago |
Chris | e86e681c53 | 6 years ago |
Chris | 48f72652da | 6 years ago |
Chris | a3f7bafedb | 6 years ago |
KodeStar | d30d610042 | 6 years ago |
Kode | 882e406266 | 6 years ago |
Kode | 45d421256c | 6 years ago |
Kode | a2f20fc18f | 6 years ago |
KodeStar | 988364cb7c | 6 years ago |
chbmb | a3816ed8a1 | 6 years ago |
chbmb | d48805ee2c | 6 years ago |
chbmb | e820b81259 | 6 years ago |
chbmb | 8b1046ce17 | 6 years ago |
chbmb | a138b65842 | 6 years ago |
KodeStar | c344de3f04 | 6 years ago |
chbmb | 427659a897 | 6 years ago |
chbmb | a6543970e7 | 6 years ago |
KodeStar | 399ea088dc | 6 years ago |
chbmb | 3f87833e52 | 6 years ago |
chbmb | 6dcb77023c | 6 years ago |
KodeStar | 4d37135bdf | 6 years ago |
KodeStar | d109047fa5 | 6 years ago |
KodeStar | b6112501e2 | 6 years ago |
KodeStar | 0663e236b4 | 6 years ago |
chbmb | f25cea1749 | 6 years ago |
chbmb | 03e16415aa | 6 years ago |
chbmb | 9a55e05943 | 6 years ago |
chbmb | c06fa4eab6 | 6 years ago |
chbmb | 5575b082ea | 6 years ago |
chbmb | 1c6da858bc | 6 years ago |
chbmb | f0a14641c1 | 6 years ago |
chbmb | c6d07cd8a4 | 6 years ago |
chbmb | df9f07faf4 | 6 years ago |
chbmb | a3dcc278d7 | 6 years ago |
chbmb | 5de473fa44 | 6 years ago |
chbmb | 763c1545a6 | 6 years ago |
chbmb | ecde7a0f32 | 6 years ago |
chbmb | 7fc5e0abb5 | 6 years ago |
chbmb | 06a655ac0c | 6 years ago |
chbmb | 875ddaa834 | 6 years ago |
chbmb | 030fccbb50 | 6 years ago |
chbmb | 908f70d90a | 6 years ago |
chbmb | 8724ced531 | 6 years ago |
KodeStar | aa1a3a95ca | 6 years ago |
Birger J. Nordølum | 0767dc075e | 6 years ago |
KodeStar | c8a6c89036 | 6 years ago |
KodeStar | cafe386cc4 | 6 years ago |
KodeStar | 0184c9695b | 6 years ago |
KodeStar | 19536edf28 | 6 years ago |
KodeStar | 045e4a20fa | 6 years ago |
Birger J. Nordølum | 6cb8487a52 | 6 years ago |
Birger J. Nordølum | c39e9aa13f | 6 years ago |
KodeStar | 0203440b06 | 6 years ago |
Birger J. Nordølum | 7f7bf60456 | 6 years ago |
KodeStar | e8673634bc | 6 years ago |
KodeStar | 53e52c93ee | 6 years ago |
Birger J. Nordølum | c239c0ea5a | 6 years ago |
Birger J. Nordølum | 7142f755f5 | 6 years ago |
Birger J. Nordølum | 9fbc8dc1f9 | 6 years ago |
Birger J. Nordølum | d3819a6a88 | 6 years ago |
Birger J. Nordølum | 6e93ed8e5f | 6 years ago |
Birger J. Nordølum | 98543d49a9 | 6 years ago |
KodeStar | 9195eead27 | 6 years ago |
KodeStar | e5b384736d | 6 years ago |
Daniel Soares | 4def720d1a | 6 years ago |
Daniel Soares | 2a0404ea17 | 6 years ago |
Birger J. Nordølum | 6d22c4f02e | 6 years ago |
KodeStar | 24ac12da65 | 6 years ago |
Birger J. Nordølum | 3f19882df8 | 6 years ago |
Birger J. Nordølum | dd54c16c1f | 6 years ago |
Kode | 223e9289dc | 6 years ago |
Kode | 2e301bdd51 | 6 years ago |
Kode | e3ec7de23a | 6 years ago |
KodeStar | 18ec208381 | 6 years ago |
KodeStar | 8666daa07d | 6 years ago |
KodeStar | 926a9bdb03 | 6 years ago |
Birger J. Nordølum | fc2d837a2c | 6 years ago |
KodeStar | 3f69ccab99 | 6 years ago |
KodeStar | b6ee82ee52 | 6 years ago |
KodeStar | da1eb859a9 | 6 years ago |
KodeStar | 2b5269b823 | 6 years ago |
ullbergm | 6c8eeb0ced | 6 years ago |
Magnus Ullberg | c5e0f3abc8 | 6 years ago |
Birger J. Nordølum | c6dbe22c57 | 6 years ago |
KodeStar | 51776e2aa3 | 6 years ago |
KodeStar | c9d24607f6 | 6 years ago |
KodeStar | 46f7a3d4f3 | 6 years ago |
KodeStar | 56cf450c89 | 6 years ago |
KodeStar | 38c350b020 | 6 years ago |
KodeStar | 1f46040f1b | 6 years ago |
KodeStar | 63b95319cd | 6 years ago |
Birger J. Nordølum | a25d92be9e | 6 years ago |
Scott Carlson | a161210a4a | 6 years ago |
shuaiscott | 24469eb2fa | 6 years ago |
ullbergm | a93fb49875 | 6 years ago |
ullbergm | 08d7cdf95b | 6 years ago |
ullbergm | a9334bc247 | 6 years ago |
ullbergm | 2357d0c466 | 6 years ago |
ullbergm | b003d51276 | 6 years ago |
ullbergm | 503cbf9830 | 6 years ago |
ullbergm | 2466058c5a | 6 years ago |
Magnus Ullberg | 6b1f422456 | 6 years ago |
Birger J. Nordølum | 1d16d67733 | 6 years ago |
Birger J. Nordølum | 6f9d15aed8 | 6 years ago |
ullbergm | 8725f974da | 6 years ago |
ullbergm | 2551c949ae | 6 years ago |
ullbergm | 30c6020ce7 | 6 years ago |
ullbergm | d00b1ce1a1 | 6 years ago |
Caleb Dunn | 2c43d79585 | 6 years ago |
Caleb Dunn | 3e4aacb2b0 | 6 years ago |
KodeStar | 67cd22371b | 6 years ago |
ullbergm | 586941ece7 | 6 years ago |
ullbergm | 32a57cbfa6 | 6 years ago |
ullbergm | 1837a69b3e | 6 years ago |
ullbergm | aa8bfcfd92 | 6 years ago |
ullbergm | 9e0c658470 | 6 years ago |
ullbergm | 66aefff4f3 | 6 years ago |
ullbergm | bd0fdeecee | 6 years ago |
Magnus Ullberg | 1055eeb01b | 6 years ago |
Magnus Ullberg | 263a4578d4 | 6 years ago |
Magnus Ullberg | c446b8a5af | 6 years ago |
Magnus Ullberg | 847b34cdcb | 6 years ago |
Magnus Ullberg | 5a57f90b8f | 6 years ago |
Magnus Ullberg | f8eb9f5bd0 | 6 years ago |
Magnus Ullberg | c8c336b574 | 6 years ago |
KodeStar | 43f1410974 | 6 years ago |
KodeStar | 1df110b3fb | 7 years ago |
KodeStar | 9bedce0df5 | 7 years ago |
chbmb | ae1d879e5a | 7 years ago |
KodeStar | caab2e0952 | 7 years ago |
ninthwalker | a29d6517d3 | 7 years ago |
ninthwalker | dae2781818 | 7 years ago |
ninthwalker | c1de609b1a | 7 years ago |
KodeStar | 4e84807950 | 7 years ago |
chbmb | 41c9cb45d6 | 7 years ago |
chbmb | 2d72772f86 | 7 years ago |
chbmb | 1cf1f0e04d | 7 years ago |
chbmb | 324b88ec2b | 7 years ago |
chbmb | ec64c7ba0b | 7 years ago |
KodeStar | 67e0f8570e | 7 years ago |
KodeStar | 1745100705 | 7 years ago |
4965 changed files with 268295 additions and 89013 deletions
@ -1,31 +0,0 @@ |
|||
APP_NAME=Heimdall |
|||
APP_ENV=local |
|||
APP_KEY=base64:I206O8ibx+GQyRE7BeOxDobn04Mfmyyc5Ptzns/C0mY= |
|||
APP_DEBUG=true |
|||
APP_LOG_LEVEL=debug |
|||
APP_URL=http://localhost |
|||
|
|||
DB_CONNECTION=sqlite |
|||
DB_DATABASE=app.sqlite |
|||
|
|||
BROADCAST_DRIVER=log |
|||
CACHE_DRIVER=file |
|||
SESSION_DRIVER=file |
|||
SESSION_LIFETIME=120 |
|||
QUEUE_DRIVER=sync |
|||
|
|||
REDIS_HOST=127.0.0.1 |
|||
REDIS_PASSWORD=null |
|||
REDIS_PORT=6379 |
|||
|
|||
MAIL_DRIVER=smtp |
|||
MAIL_HOST=smtp.mailtrap.io |
|||
MAIL_PORT=2525 |
|||
MAIL_USERNAME=null |
|||
MAIL_PASSWORD=null |
|||
MAIL_ENCRYPTION=null |
|||
|
|||
PUSHER_APP_ID= |
|||
PUSHER_APP_KEY= |
|||
PUSHER_APP_SECRET= |
|||
PUSHER_APP_CLUSTER=mt1 |
@ -1,5 +1,49 @@ |
|||
# Configuration file for Git attributes |
|||
|
|||
# Core Settings {{{ |
|||
# .gitattributes |
|||
.gitattributes !filter !diff |
|||
|
|||
# Line Endings |
|||
* text=auto |
|||
|
|||
# Set binary to none-text files |
|||
*.png -text |
|||
|
|||
# }}} |
|||
|
|||
|
|||
# GitHub Linguist {{{ |
|||
|
|||
# Exclude files/folder from being detected by the GitHub linguist |
|||
# statistic. |
|||
node_modules/* linguist-vendored |
|||
public/* linguist-generated=true |
|||
vendor/* linguist-vendored |
|||
|
|||
# Remove Vue as it's currently not used in the project. |
|||
resources/assets/js/components/ExampleComponent.vue linguist-vendored |
|||
|
|||
# System Wide |
|||
*.css linguist-vendored |
|||
*.scss linguist-vendored |
|||
*.js linguist-vendored |
|||
|
|||
# Include user generated files that's removed bu the setting above. |
|||
resources/assets/js/app.js linguist-vendored=false |
|||
resources/assets/sass/_app.scss linguist-vendored=false |
|||
resources/assets/sass/_rune.scss linguist-vendored=false |
|||
resources/assets/sass/_variables.scss linguist-vendored=false |
|||
|
|||
# }}} |
|||
|
|||
|
|||
# Archive Exlude {{{ |
|||
# Exclude files/folders from being exported when creating an archive. |
|||
|
|||
.gitattributes export-ignore |
|||
.gitignore export-ignore |
|||
.travis.yml export-ignore |
|||
CHANGELOG.md export-ignore |
|||
|
|||
# }}} |
|||
|
@ -0,0 +1,63 @@ |
|||
<?php |
|||
|
|||
namespace App; |
|||
|
|||
use Illuminate\Database\Eloquent\Model; |
|||
|
|||
class Application extends Model |
|||
{ |
|||
public $incrementing = false; |
|||
|
|||
protected $primaryKey = 'appid'; |
|||
|
|||
// |
|||
public function icon() |
|||
{ |
|||
if(!file_exists(storage_path('app/public/'.$this->icon))) { |
|||
$img_src = app_path('SupportedApps/'.$this->name.'/'.str_replace('icons/', '', $this->icon)); |
|||
$img_dest = storage_path('app/public/'.$this->icon); |
|||
//die("i: ".$img_src); |
|||
@copy($img_src, $img_dest); |
|||
} |
|||
|
|||
|
|||
return $this->icon; |
|||
} |
|||
|
|||
public function iconView() |
|||
{ |
|||
return asset('storage/'.$this->icon); |
|||
} |
|||
|
|||
public function defaultColour() |
|||
{ |
|||
// check if light or dark |
|||
if($this->tile_background == 'light') return '#fafbfc'; |
|||
return '#161b1f'; |
|||
} |
|||
|
|||
public function class() |
|||
{ |
|||
$name = $this->name; |
|||
$name = preg_replace('/\PL/u', '', $name); |
|||
|
|||
$class = '\App\SupportedApps\\'.$name.'\\'.$name; |
|||
return $class; |
|||
} |
|||
|
|||
public static function applist() |
|||
{ |
|||
$list = []; |
|||
$all = self::orderBy('name')->get()->sortBy('name', SORT_NATURAL|SORT_FLAG_CASE); |
|||
$list['null'] = 'None'; |
|||
foreach($all as $app) { |
|||
$name = $app->name; |
|||
$name = preg_replace('/\PL/u', '', $name); |
|||
|
|||
$list['\App\SupportedApps\\'.$name.'\\'.$name] = $app->name; |
|||
} |
|||
return $list; |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,79 @@ |
|||
<?php |
|||
|
|||
namespace App\Console\Commands; |
|||
|
|||
use Illuminate\Console\Command; |
|||
use App\Application; |
|||
use App\SupportedApps; |
|||
|
|||
class RegisterApp extends Command |
|||
{ |
|||
/** |
|||
* The name and signature of the console command. |
|||
* |
|||
* @var string |
|||
*/ |
|||
protected $signature = 'register:app {folder}'; |
|||
|
|||
/** |
|||
* The console command description. |
|||
* |
|||
* @var string |
|||
*/ |
|||
protected $description = 'Add a local app to the registry'; |
|||
|
|||
/** |
|||
* Create a new command instance. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function __construct() |
|||
{ |
|||
parent::__construct(); |
|||
} |
|||
|
|||
/** |
|||
* Execute the console command. |
|||
* |
|||
* @return mixed |
|||
*/ |
|||
public function handle() |
|||
{ |
|||
$folder = $this->argument('folder'); |
|||
if($folder == 'all') { |
|||
$apps = scandir(app_path('SupportedApps')); |
|||
foreach($apps as $folder) { |
|||
if($folder == '.' || $folder == '..') continue; |
|||
$this->addApp($folder); |
|||
} |
|||
|
|||
} else { |
|||
$this->addApp($folder); |
|||
} |
|||
|
|||
} |
|||
|
|||
public function addApp($folder) |
|||
{ |
|||
$json = app_path('SupportedApps/'.$folder.'/app.json'); |
|||
if(file_exists($json)) { |
|||
$app = json_decode(file_get_contents($json)); |
|||
if(isset($app->appid)) { |
|||
$exists = Application::find($app->appid); |
|||
if($exists) { |
|||
$this->error('Application already registered - '.$exists->name." - ".$exists->appid); |
|||
} else { |
|||
// Doesn't exist so add it |
|||
SupportedApps::saveApp($app, new Application); |
|||
$this->info("Application Added - ".$app->name." - ".$app->appid); |
|||
} |
|||
} else { |
|||
$this->error('No App ID for - '.$folder); |
|||
} |
|||
|
|||
} else { |
|||
$this->error('Could not find '.$json); |
|||
} |
|||
|
|||
} |
|||
} |
@ -0,0 +1,12 @@ |
|||
<?php namespace App; |
|||
|
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
|
|||
interface EnhancedApps |
|||
{ |
|||
public function test(); |
|||
public function livestats(); |
|||
public function url($endpoint); |
|||
|
|||
} |
@ -0,0 +1,28 @@ |
|||
<?php |
|||
|
|||
namespace App\Http\Controllers; |
|||
|
|||
use Illuminate\Http\Request; |
|||
|
|||
class HomeController extends Controller |
|||
{ |
|||
/** |
|||
* Create a new controller instance. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function __construct() |
|||
{ |
|||
$this->middleware('auth'); |
|||
} |
|||
|
|||
/** |
|||
* Show the application dashboard. |
|||
* |
|||
* @return \Illuminate\Http\Response |
|||
*/ |
|||
public function index() |
|||
{ |
|||
return redirect()->route('dash'); |
|||
} |
|||
} |
@ -0,0 +1,28 @@ |
|||
<?php |
|||
|
|||
namespace App\Http\Controllers; |
|||
|
|||
use Illuminate\Http\Request; |
|||
use App\Http\Controllers\Controller; |
|||
use App\Search; |
|||
|
|||
class SearchController extends Controller |
|||
{ |
|||
public function index(Request $request) |
|||
{ |
|||
$requestprovider = $request->input('provider'); |
|||
$query = $request->input('q'); |
|||
|
|||
$provider = Search::providerDetails($requestprovider); |
|||
|
|||
if($provider->type == 'standard') { |
|||
return redirect($provider->url.'?'.$provider->var.'='.urlencode($query)); |
|||
} elseif($provider->type == 'external') { |
|||
$class = new $provider->class; |
|||
//print_r($provider); |
|||
return $class->getResults($query, $provider); |
|||
} |
|||
|
|||
//print_r($provider); |
|||
} |
|||
} |
@ -0,0 +1,175 @@ |
|||
<?php |
|||
|
|||
namespace App\Http\Controllers; |
|||
|
|||
use Illuminate\Http\Request; |
|||
use App\Http\Controllers\Controller; |
|||
use App\User; |
|||
use Illuminate\Support\Str; |
|||
use Illuminate\Support\Facades\Auth; |
|||
|
|||
class UserController extends Controller |
|||
{ |
|||
public function __construct() |
|||
{ |
|||
$this->middleware('allowed')->except(['selectUser']); |
|||
} |
|||
/** |
|||
* Display a listing of the resource. |
|||
* |
|||
* @return \Illuminate\Http\Response |
|||
*/ |
|||
public function index() |
|||
{ |
|||
$data['users'] = User::all(); |
|||
return view('users.index', $data); |
|||
} |
|||
|
|||
/** |
|||
* Show the form for creating a new resource. |
|||
* |
|||
* @return \Illuminate\Http\Response |
|||
*/ |
|||
public function create() |
|||
{ |
|||
$data = []; |
|||
return view('users.create', $data); |
|||
} |
|||
|
|||
public function selectUser() |
|||
{ |
|||
Auth::logout(); |
|||
$data['users'] = User::all(); |
|||
return view('userselect', $data); |
|||
|
|||
} |
|||
|
|||
/** |
|||
* Store a newly created resource in storage. |
|||
* |
|||
* @param \Illuminate\Http\Request $request |
|||
* @return \Illuminate\Http\Response |
|||
*/ |
|||
public function store(Request $request) |
|||
{ |
|||
$validatedData = $request->validate([ |
|||
'username' => 'required|max:255|unique:users', |
|||
'email' => 'required|email', |
|||
'password' => 'nullable|confirmed', |
|||
'password_confirmation' => 'nullable' |
|||
|
|||
]); |
|||
$user = new User; |
|||
$user->username = $request->input('username'); |
|||
$user->email = $request->input('email'); |
|||
$user->public_front = $request->input('public_front'); |
|||
|
|||
$password = $request->input('password'); |
|||
if(!empty($password)) { |
|||
$user->password = bcrypt($password); |
|||
} |
|||
|
|||
if($request->hasFile('file')) { |
|||
$path = $request->file('file')->store('avatars'); |
|||
$user->avatar = $path; |
|||
} |
|||
|
|||
if ((bool)$request->input('autologin_allow') === true) { |
|||
$user->autologin = (string)Str::uuid(); |
|||
} |
|||
|
|||
$user->save(); |
|||
|
|||
$route = route('dash', []); |
|||
return redirect($route) |
|||
->with('success',__('app.alert.success.user_updated')); |
|||
} |
|||
|
|||
/** |
|||
* Display the specified resource. |
|||
* |
|||
* @param int $id |
|||
* @return \Illuminate\Http\Response |
|||
*/ |
|||
public function show($id) |
|||
{ |
|||
// |
|||
} |
|||
|
|||
/** |
|||
* Show the form for editing the specified resource. |
|||
* |
|||
* @param int $id |
|||
* @return \Illuminate\Http\Response |
|||
*/ |
|||
public function edit(User $user) |
|||
{ |
|||
$data['user'] = $user; |
|||
return view('users.edit', $data); |
|||
|
|||
} |
|||
|
|||
/** |
|||
* Update the specified resource in storage. |
|||
* |
|||
* @param \Illuminate\Http\Request $request |
|||
* @param int $id |
|||
* @return \Illuminate\Http\Response |
|||
*/ |
|||
public function update(Request $request, User $user) |
|||
{ |
|||
$validatedData = $request->validate([ |
|||
'username' => 'required|max:255|unique:users,username,'.$user->id, |
|||
'email' => 'required|email', |
|||
'password' => 'nullable|confirmed', |
|||
'password_confirmation' => 'nullable' |
|||
]); |
|||
//die(print_r($request->all())); |
|||
|
|||
$user->username = $request->input('username'); |
|||
$user->email = $request->input('email'); |
|||
$user->public_front = $request->input('public_front'); |
|||
|
|||
$password = $request->input('password'); |
|||
if(!empty($password)) { |
|||
$user->password = bcrypt($password); |
|||
} elseif($password == 'null') { |
|||
$user->password = null; |
|||
} |
|||
|
|||
if($request->hasFile('file')) { |
|||
$path = $request->file('file')->store('avatars'); |
|||
$user->avatar = $path; |
|||
} |
|||
|
|||
if ((bool)$request->input('autologin_allow') === true) { |
|||
$user->autologin = (is_null($user->autologin)) ? (string)Str::uuid() : $user->autologin; |
|||
} else { |
|||
$user->autologin = null; |
|||
} |
|||
|
|||
$user->save(); |
|||
|
|||
$route = route('dash', []); |
|||
return redirect($route) |
|||
->with('success',__('app.alert.success.user_updated')); |
|||
|
|||
} |
|||
|
|||
/** |
|||
* Remove the specified resource from storage. |
|||
* |
|||
* @param int $id |
|||
* @return \Illuminate\Http\Response |
|||
*/ |
|||
public function destroy(User $user) |
|||
{ |
|||
if($user->id !== 1) { |
|||
$user->delete(); |
|||
$route = route('dash', []); |
|||
return redirect($route) |
|||
->with('success',__('app.alert.success.user_deleted')); |
|||
|
|||
} |
|||
} |
|||
} |
@ -0,0 +1,48 @@ |
|||
<?php |
|||
|
|||
namespace App\Http\Middleware; |
|||
|
|||
use Closure; |
|||
use Illuminate\Support\Facades\Auth; |
|||
use App\User; |
|||
use Illuminate\Support\Facades\Route; |
|||
use Session; |
|||
|
|||
class CheckAllowed |
|||
{ |
|||
/** |
|||
* Handle an incoming request. |
|||
* |
|||
* @param \Illuminate\Http\Request $request |
|||
* @param \Closure $next |
|||
* @return mixed |
|||
*/ |
|||
public function handle($request, Closure $next) |
|||
{ |
|||
$route = Route::currentRouteName(); |
|||
$current_user = User::currentUser(); |
|||
|
|||
if(str_is('users*', $route)) { |
|||
if($current_user->id !== 1) { |
|||
return redirect()->route('dash'); |
|||
} |
|||
} |
|||
|
|||
if($route == 'dash') { |
|||
//print_r(User::all()); |
|||
//die("here".var_dump($current_user->password)); |
|||
if((bool)$current_user->public_front === true) return $next($request); |
|||
} |
|||
|
|||
if(empty($current_user->password)) return $next($request); |
|||
|
|||
// Check if user is logged in as $current_user |
|||
if (Auth::check()) { |
|||
$loggedin_user = Auth::user(); |
|||
if($loggedin_user->id === $current_user->id) return $next($request); |
|||
} |
|||
|
|||
return Auth::authenticate(); |
|||
|
|||
} |
|||
} |
@ -0,0 +1,10 @@ |
|||
<?php |
|||
|
|||
namespace App; |
|||
|
|||
use Illuminate\Database\Eloquent\Relations\Pivot; |
|||
|
|||
class ItemTag extends Pivot |
|||
{ |
|||
|
|||
} |
@ -0,0 +1,66 @@ |
|||
<?php |
|||
|
|||
namespace App\Jobs; |
|||
|
|||
use Illuminate\Bus\Queueable; |
|||
use Illuminate\Queue\SerializesModels; |
|||
use Illuminate\Queue\InteractsWithQueue; |
|||
use Illuminate\Contracts\Queue\ShouldQueue; |
|||
use Illuminate\Foundation\Bus\Dispatchable; |
|||
use App\Application; |
|||
use App\SupportedApps; |
|||
|
|||
class ProcessApps implements ShouldQueue |
|||
{ |
|||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; |
|||
|
|||
/** |
|||
* Create a new job instance. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function __construct() |
|||
{ |
|||
// |
|||
} |
|||
|
|||
/** |
|||
* Execute the job. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function handle() |
|||
{ |
|||
$localapps = Application::all(); |
|||
$list = json_decode(SupportedApps::getList()->getBody()); |
|||
$validapps = []; |
|||
|
|||
foreach($list->apps as $app) { |
|||
$validapps[] = $app->appid; |
|||
$localapp = $localapps->where('appid', $app->appid)->first(); |
|||
|
|||
$application = ($localapp) ? $localapp : new Application; |
|||
|
|||
if(!file_exists(app_path('SupportedApps/'.className($app->name)))) { |
|||
SupportedApps::getFiles($app); |
|||
SupportedApps::saveApp($app, $application); |
|||
} else { |
|||
// check if there has been an update for this app |
|||
$localapp = $localapps->where('appid', $app->appid)->first(); |
|||
if($localapp) { |
|||
if($localapp->sha !== $app->sha) { |
|||
SupportedApps::getFiles($app); |
|||
SupportedApps::saveApp($app, $application); |
|||
} |
|||
} else { |
|||
SupportedApps::getFiles($app); |
|||
SupportedApps::saveApp($app, $application); |
|||
|
|||
} |
|||
} |
|||
} |
|||
//$delete = Application::whereNotIn('appid', $validapps)->delete(); // delete any apps not in list |
|||
// removed the delete so local apps can be added |
|||
|
|||
} |
|||
} |
@ -0,0 +1,155 @@ |
|||
<?php namespace App; |
|||
|
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
use App\Item; |
|||
use App\Setting; |
|||
use Form; |
|||
use Cache; |
|||
|
|||
abstract class Search |
|||
{ |
|||
|
|||
/** |
|||
* List of all search providers |
|||
* |
|||
* @return Array |
|||
*/ |
|||
public static function providers() |
|||
{ |
|||
$providers = self::standardProviders(); |
|||
$providers = $providers + self::appProviders(); |
|||
return $providers; |
|||
} |
|||
|
|||
/** |
|||
* Gets details for a single provider |
|||
* |
|||
* @return Object |
|||
*/ |
|||
public static function providerDetails($provider) |
|||
{ |
|||
$providers = self::providers(); |
|||
if(!isset($providers[$provider])) return false; |
|||
return (object)$providers[$provider] ?? false; |
|||
} |
|||
|
|||
/** |
|||
* Array of the standard providers |
|||
* |
|||
* @return Array |
|||
*/ |
|||
public static function standardProviders() |
|||
{ |
|||
return [ |
|||
'google' => [ |
|||
'url' => 'https://www.google.com/search', |
|||
'var' => 'q', |
|||
'method' => 'get', |
|||
'type' => 'standard', |
|||
], |
|||
'ddg' => [ |
|||
'url' => 'https://duckduckgo.com/', |
|||
'var' => 'q', |
|||
'method' => 'get', |
|||
'type' => 'standard', |
|||
], |
|||
'bing' => [ |
|||
'url' => 'https://www.bing.com/search', |
|||
'var' => 'q', |
|||
'method' => 'get', |
|||
'type' => 'standard', |
|||
], |
|||
'qwant' => [ |
|||
'url' => 'https://www.qwant.com/', |
|||
'var' => 'q', |
|||
'method' => 'get', |
|||
'type' => 'standard', |
|||
], |
|||
'startpage' => [ |
|||
'url' => 'https://www.startpage.com/do/dsearch', |
|||
'var' => 'query', |
|||
'method' => 'get', |
|||
'type' => 'standard', |
|||
], |
|||
]; |
|||
} |
|||
|
|||
/** |
|||
* Loops through users apps to see if app is a search provider, might be worth |
|||
* looking into caching this at some point |
|||
* |
|||
* @return Array |
|||
*/ |
|||
public static function appProviders() |
|||
{ |
|||
$providers = []; |
|||
$userapps = Item::all(); |
|||
foreach($userapps as $app) { |
|||
if(empty($app->class)) continue; |
|||
if(($provider = Item::isSearchProvider($app->class)) !== false) { |
|||
$name = Item::nameFromClass($app->class); |
|||
$providers[$app->id] = [ |
|||
'type' => $provider->type, |
|||
'class' => $app->class, |
|||
'url' => $app->url, |
|||
'title' => $app->title, |
|||
'colour' => $app->colour, |
|||
'icon' => $app->icon, |
|||
'description' => $app->description |
|||
]; |
|||
|
|||
} |
|||
} |
|||
return $providers; |
|||
} |
|||
|
|||
/** |
|||
* Outputs the search form |
|||
* |
|||
* @return html |
|||
*/ |
|||
public static function form() |
|||
{ |
|||
$output = ''; |
|||
$homepage_search = Setting::fetch('homepage_search'); |
|||
$search_provider = Setting::where('key', '=', 'search_provider')->first(); |
|||
$user_search_provider = Setting::fetch('search_provider'); |
|||
//die(print_r($search_provider)); |
|||
|
|||
//die(var_dump($user_search_provider)); |
|||
// return early if search isn't applicable |
|||
if((bool)$homepage_search !== true) return $output; |
|||
$user_search_provider = $user_search_provider ?? 'none'; |
|||
|
|||
if((bool)$homepage_search && (bool)$search_provider) { |
|||
|
|||
if((bool)$user_search_provider) { |
|||
$name = 'app.options.'.$user_search_provider; |
|||
$provider = self::providerDetails($user_search_provider); |
|||
|
|||
$output .= '<div class="searchform">'; |
|||
$output .= '<form action="'.url('search').'"'.getLinkTargetAttribute().' method="get">'; |
|||
$output .= '<div id="search-container" class="input-container">'; |
|||
$output .= '<select name="provider">'; |
|||
foreach(self::providers() as $key => $searchprovider) { |
|||
$selected = ($key === $user_search_provider) ? ' selected="selected"' : ''; |
|||
if (is_numeric($key)) { |
|||
$output .= '<option value="'.$key.'"'.$selected.'>'.$searchprovider['title'].'</option>'; |
|||
} else { |
|||
$output .= '<option value="'.$key.'"'.$selected.'>'.__('app.options.'.$key).'</option>'; |
|||
} |
|||
} |
|||
$output .= '</select>'; |
|||
$output .= Form::text('q', null, ['class' => 'homesearch', 'autofocus' => 'autofocus', 'placeholder' => __('app.settings.search').'...']); |
|||
$output .= '<button type="submit">'.ucwords(__('app.settings.search')).'</button>'; |
|||
$output .= '</div>'; |
|||
$output .= '</form>'; |
|||
$output .= '</div>'; |
|||
} |
|||
} |
|||
return $output; |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,10 @@ |
|||
<?php namespace App; |
|||
|
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
|
|||
interface SearchInterface |
|||
{ |
|||
public function getResults($query, $providerdetails); |
|||
|
|||
} |
@ -0,0 +1,10 @@ |
|||
<?php |
|||
|
|||
namespace App; |
|||
|
|||
use Illuminate\Database\Eloquent\Relations\Pivot; |
|||
|
|||
class SettingUser extends Pivot |
|||
{ |
|||
// |
|||
} |
@ -0,0 +1,172 @@ |
|||
<?php namespace App; |
|||
|
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
use Illuminate\Support\Facades\Log; |
|||
|
|||
abstract class SupportedApps |
|||
{ |
|||
|
|||
protected $jar = false; |
|||
protected $method = 'GET'; |
|||
protected $error; |
|||
|
|||
public function appTest($url, $attrs = [], $overridevars=false) |
|||
{ |
|||
if(empty($this->config->url)) { |
|||
return (object)[ |
|||
'code' => 404, |
|||
'status' => 'No URL has been specified', |
|||
'response' => 'No URL has been specified', |
|||
]; |
|||
} |
|||
$res = $this->execute($url, $attrs); |
|||
if($res == null) { |
|||
return (object)[ |
|||
'code' => null, |
|||
'status' => $this->error, |
|||
'response' => 'Connection failed', |
|||
]; |
|||
} |
|||
switch($res->getStatusCode()) { |
|||
case 200: |
|||
$status = 'Successfully communicated with the API'; |
|||
break; |
|||
case 401: |
|||
$status = 'Failed: Invalid credentials'; |
|||
break; |
|||
case 404: |
|||
$status = 'Failed: Please make sure your URL is correct and that there is a trailing slash'; |
|||
break; |
|||
default: |
|||
$status = 'Something went wrong... Code: '.$res->getStatusCode(); |
|||
break; |
|||
} |
|||
return (object)[ |
|||
'code' => $res->getStatusCode(), |
|||
'status' => $status, |
|||
'response' => $res->getBody(), |
|||
]; |
|||
} |
|||
|
|||
public function execute($url, $attrs = [], $overridevars=false, $overridemethod=false) |
|||
{ |
|||
$res = null; |
|||
|
|||
$vars = ($overridevars !== false) ? |
|||
$overridevars : [ |
|||
'http_errors' => false, |
|||
'timeout' => 15, |
|||
'connect_timeout' => 15, |
|||
]; |
|||
|
|||
$client = new Client($vars); |
|||
|
|||
$method = ($overridemethod !== false) ? $overridemethod : $this->method; |
|||
|
|||
try { |
|||
return $client->request($method, $url, $attrs); |
|||
} catch (\GuzzleHttp\Exception\ConnectException $e) { |
|||
Log::error("Connection refused"); |
|||
Log::debug($e->getMessage()); |
|||
$this->error = "Connection refused - ".(string) $e->getMessage(); |
|||
} catch (\GuzzleHttp\Exception\ServerException $e) { |
|||
Log::debug($e->getMessage()); |
|||
$this->error = (string) $e->getResponse()->getBody(); |
|||
} |
|||
$this->error = 'General error connecting with API'; |
|||
return $res; |
|||
} |
|||
|
|||
public function login() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public function normaliseurl($url, $addslash=true) |
|||
{ |
|||
|
|||
$url = rtrim($url, '/'); |
|||
if($addslash) $url .= '/'; |
|||
|
|||
return $url; |
|||
|
|||
} |
|||
|
|||
|
|||
public function getLiveStats($status, $data) |
|||
{ |
|||
$className = get_class($this); |
|||
$explode = explode('\\', $className); |
|||
$name = end($explode); |
|||
|
|||
$html = view('SupportedApps::'.$name.'.livestats', $data)->with('data', $data)->render(); |
|||
return json_encode(['status' => $status, 'html' => $html]); |
|||
//return |
|||
} |
|||
|
|||
public static function getList() |
|||
{ |
|||
$list_url = 'https://apps.heimdall.site/list'; |
|||
$client = new Client(['http_errors' => false, 'timeout' => 15, 'connect_timeout' => 15]); |
|||
return $client->request('GET', $list_url); |
|||
} |
|||
|
|||
public static function configValue($item=null, $key=null) |
|||
{ |
|||
if(isset($item) && !empty($item)) { |
|||
return $item->getconfig()->$key; |
|||
} else return null; |
|||
} |
|||
|
|||
public static function getFiles($app) |
|||
{ |
|||
$zipurl = $app->files; |
|||
$client = new Client(['http_errors' => false, 'timeout' => 60, 'connect_timeout' => 15]); |
|||
$res = $client->request('GET', $zipurl); |
|||
|
|||
if(!file_exists(app_path('SupportedApps'))) { |
|||
mkdir(app_path('SupportedApps'), 0777, true); |
|||
} |
|||
|
|||
$src = app_path('SupportedApps/'.className($app->name).'.zip'); |
|||
file_put_contents($src, $res->getBody()); |
|||
|
|||
$zip = new \ZipArchive(); |
|||
$x = $zip->open($src); // open the zip file to extract |
|||
if ($x === true) { |
|||
$zip->extractTo(app_path('SupportedApps')); // place in the directory with same name |
|||
$zip->close(); |
|||
unlink($src); //Deleting the Zipped file |
|||
} |
|||
} |
|||
|
|||
public static function saveApp($details, $app) |
|||
{ |
|||
if(!file_exists(storage_path('app/public/icons'))) { |
|||
mkdir(storage_path('app/public/icons'), 0777, true); |
|||
} |
|||
|
|||
$img_src = app_path('SupportedApps/'.className($details->name).'/'.$details->icon); |
|||
$img_dest = storage_path('app/public/icons/'.$details->icon); |
|||
//die("i: ".$img_src); |
|||
@copy($img_src, $img_dest); |
|||
|
|||
$app->appid = $details->appid; |
|||
$app->name = $details->name; |
|||
$app->sha = $details->sha ?? null; |
|||
$app->icon = 'icons/'.$details->icon; |
|||
$app->website = $details->website; |
|||
$app->license = $details->license; |
|||
$app->description = $details->description; |
|||
|
|||
$appclass = $app->class(); |
|||
$application = new $appclass; |
|||
$enhanced = (bool)($application instanceof \App\EnhancedApps); |
|||
|
|||
$app->enhanced = $enhanced; |
|||
$app->tile_background = $details->tile_background; |
|||
$app->save(); |
|||
} |
|||
|
|||
} |
@ -1,11 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
class AirSonic implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#08F'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/airsonic.png'; |
|||
} |
|||
} |
@ -1,11 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
class Cardigann implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#753'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/cardigann.png'; |
|||
} |
|||
} |
@ -1,9 +0,0 @@ |
|||
<?php namespace App\SupportedApps\Contracts; |
|||
|
|||
interface Applications { |
|||
|
|||
public function defaultColour(); |
|||
|
|||
public function icon(); |
|||
|
|||
} |
@ -1,11 +0,0 @@ |
|||
<?php namespace App\SupportedApps\Contracts; |
|||
|
|||
interface Livestats { |
|||
|
|||
public function configDetails(); |
|||
|
|||
public function testConfig(); |
|||
|
|||
public function executeConfig(); |
|||
|
|||
} |
@ -1,122 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
use Illuminate\Support\Facades\Log; |
|||
|
|||
class CouchPotato implements Contracts\Applications, Contracts\Livestats |
|||
{ |
|||
|
|||
private $_client; |
|||
|
|||
public function __construct() |
|||
{ |
|||
$this->_client = new Client( |
|||
['http_errors' => false, |
|||
'timeout' => 10] |
|||
); |
|||
} |
|||
|
|||
public function defaultColour() |
|||
{ |
|||
return '#363840'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/couchpotato.png'; |
|||
} |
|||
public function configDetails() |
|||
{ |
|||
return 'couchpotato'; |
|||
} |
|||
public function testConfig() |
|||
{ |
|||
$res = $this->sendRequest(); |
|||
if ($res == null) { |
|||
echo 'CouchPotato connection failed'; |
|||
return; |
|||
} |
|||
switch($res->getStatusCode()) { |
|||
case 200: |
|||
echo "Successfully connected to CouchPotato"; |
|||
break; |
|||
case 401: |
|||
echo 'Failed: Invalid credentials'; |
|||
break; |
|||
case 404: |
|||
echo 'Failed: Please make sure your URL is correct and includes the port'; |
|||
break; |
|||
case 409: |
|||
echo 'Failed: Incorrect session id'; |
|||
break; |
|||
default: |
|||
echo 'Something went wrong... Code: '.$res->getStatusCode(); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
public function executeConfig() |
|||
{ |
|||
$html = ''; |
|||
$res = $this->sendRequest(); |
|||
if ($res == null) { |
|||
Log::debug('CouchPotato connection failed'); |
|||
return ''; |
|||
} |
|||
$data = json_decode($res->getBody()); |
|||
if (! isset($data->movies)) { |
|||
Log::debug('Failed to fetch data from CouchPotato'); |
|||
return ''; |
|||
} |
|||
$movies = $data->movies; |
|||
$wantedMovies = $availableMovies = 0; |
|||
foreach ($movies as $v) { |
|||
switch ($v->status) { |
|||
case 'active': |
|||
$wantedMovies++; |
|||
break; |
|||
case 'done': |
|||
$availableMovies++; |
|||
break; |
|||
default: |
|||
Log::warning('Unexpected CouchPotato status received: '.$v['status']); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
$html = ' |
|||
<ul class="livestats"> |
|||
<li><span class="title">Wanted</span><sub>'.$wantedMovies.'</sub></li> |
|||
<li><span class="title">Available</span><sub>'.$availableMovies.'</sub></li> |
|||
</ul> |
|||
'; |
|||
return json_encode(['status' => 'inactive', 'html' => $html]); |
|||
} |
|||
|
|||
private function sendRequest() |
|||
{ |
|||
$res = null; |
|||
try{ |
|||
$res = $this->_client->request( |
|||
'GET', |
|||
$this->getApiUrl() |
|||
); |
|||
}catch(\GuzzleHttp\Exception\BadResponseException $e){ |
|||
Log::error("Connection to {$e->getRequest()->getUrl()} failed"); |
|||
Log::debug($e->getMessage()); |
|||
$res = $e->getRequest(); |
|||
}catch(\GuzzleHttp\Exception\ConnectException $e) { |
|||
Log::error("CouchPotato connection refused"); |
|||
Log::debug($e->getMessage()); |
|||
} |
|||
return $res; |
|||
} |
|||
|
|||
private function getApiUrl() |
|||
{ |
|||
$url = $this->config->url; |
|||
$url = rtrim($url, '/'); |
|||
$apiUrl = $url.'/api/'.$this->config->apikey.'/movie.list'; |
|||
return $apiUrl; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Deluge implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#357'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/deluge.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Dokuwiki implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#9d7056'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/dokuwiki.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Duplicati implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#2c3744'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/duplicati.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Emby implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#222'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/emby.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Gitea implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#585e52'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/gitea.png'; |
|||
} |
|||
} |
@ -1,14 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Glances implements Contracts\Applications { |
|||
|
|||
public function defaultColour() |
|||
{ |
|||
return '#2c363f'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/glances.png'; |
|||
} |
|||
|
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Grafana implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#a56e4d'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/grafana.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Graylog implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#158'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/graylog.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class HomeAssistant implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#073c52'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/homeassistant.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Jackett implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#484814'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/jackett.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Jdownloader implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#2b494f'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/jdownloader.png'; |
|||
} |
|||
} |
@ -1,11 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
class Krusader implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#5A5'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/krusader.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Lidarr implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#183c18'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/lidarr.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Mcmyadmin implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#30404b'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/mcmyadmin.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Medusa implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#4b5e55'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/medusa.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Netdata implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#543737'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/netdata.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Nextcloud implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#0e2c3e'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/nextcloud.png'; |
|||
} |
|||
} |
@ -1,84 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
|
|||
class Nzbget implements Contracts\Applications, Contracts\Livestats { |
|||
|
|||
public $config; |
|||
|
|||
public function defaultColour() |
|||
{ |
|||
return '#253827'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/nzbget.png'; |
|||
} |
|||
public function configDetails() |
|||
{ |
|||
return 'nzbget'; |
|||
} |
|||
public function testConfig() |
|||
{ |
|||
$res = $this->buildRequest('status'); |
|||
switch($res->getStatusCode()) { |
|||
case 200: |
|||
echo 'Successfully connected to the API'; |
|||
break; |
|||
case 401: |
|||
echo 'Failed: Invalid credentials'; |
|||
break; |
|||
case 404: |
|||
echo 'Failed: Please make sure your URL is correct and that there is a trailing slash'; |
|||
break; |
|||
default: |
|||
echo 'Something went wrong... Code: '.$res->getStatusCode(); |
|||
break; |
|||
} |
|||
} |
|||
public function executeConfig() |
|||
{ |
|||
$html = ''; |
|||
$active = 'inactive'; |
|||
$res = $this->buildRequest('status'); |
|||
$data = json_decode($res->getBody()); |
|||
//$data->result->RemainingSizeMB = '10000000'; |
|||
//$data->result->DownloadRate = '100000000'; |
|||
if($data) { |
|||
$size = $data->result->RemainingSizeMB; |
|||
$rate = $data->result->DownloadRate; |
|||
$queue_size = format_bytes($size*1000*1000, false, ' <span>', '</span>'); |
|||
$current_speed = format_bytes($rate, false, ' <span>'); |
|||
|
|||
$active = ($size > 0 || $rate > 0) ? 'active' : 'inactive'; |
|||
$html = ' |
|||
<ul class="livestats"> |
|||
<li><span class="title">Queue</span><strong>'.$queue_size.'</strong></li> |
|||
<li><span class="title">Speed</span><strong>'.$current_speed.'/s</span></strong></li> |
|||
</ul> |
|||
'; |
|||
} |
|||
return json_encode(['status' => $active, 'html' => $html]); |
|||
} |
|||
public function buildRequest($endpoint) |
|||
{ |
|||
$config = $this->config; |
|||
$url = $config->url; |
|||
$username = $config->username; |
|||
$password = $config->password; |
|||
|
|||
$rebuild_url = str_replace('http://', 'http://'.$username.':'.$password.'@', $url); |
|||
$rebuild_url = str_replace('https://', 'https://'.$username.':'.$password.'@', $rebuild_url); |
|||
$rebuild_url = rtrim($rebuild_url, '/'); |
|||
|
|||
|
|||
$api_url = $rebuild_url.'/jsonrpc/'.$endpoint; |
|||
|
|||
$client = new Client(['http_errors' => false, 'timeout' => 15, 'connect_timeout' => 15]); |
|||
$res = $client->request('GET', $api_url); |
|||
return $res; |
|||
|
|||
} |
|||
|
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Nzbhydra implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#53644d'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/nzbhydra.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Ombi implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#150f09'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/ombi.png'; |
|||
} |
|||
} |
@ -1,11 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
class OpenMediaVault implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#5AF'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/openmediavault.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Openhab implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#2b2525'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/openhab.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Opnsense implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#211914'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/opnsense.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Pfsense implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#4e4742'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/pfsense.png'; |
|||
} |
|||
} |
@ -1,73 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
|
|||
class Pihole implements Contracts\Applications, Contracts\Livestats { |
|||
public function defaultColour() |
|||
{ |
|||
return '#352222'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/pihole.png'; |
|||
} |
|||
|
|||
public function configDetails() |
|||
{ |
|||
return 'pihole'; |
|||
} |
|||
|
|||
public function testConfig() |
|||
{ |
|||
$res = $this->buildRequest(); |
|||
switch($res->getStatusCode()) { |
|||
case 200: |
|||
echo 'Successfully connected to the API'; |
|||
break; |
|||
case 401: |
|||
echo 'Failed: Invalid credentials'; |
|||
break; |
|||
case 404: |
|||
echo 'Failed: Please make sure your URL is correct and that there is a trailing slash'; |
|||
break; |
|||
default: |
|||
echo 'Something went wrong... Code: '.$res->getStatusCode(); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
public function executeConfig() |
|||
{ |
|||
$html = ''; |
|||
$active = 'active'; |
|||
$res = $this->buildRequest(); |
|||
$data = json_decode($res->getBody()); |
|||
|
|||
$html = ' |
|||
<ul class="livestats"> |
|||
<li><span class="title">Domains<br />Blocked</span><strong>'.$data->domains_being_blocked.'</strong></li> |
|||
<li><span class="title">Blocked<br />Today</span><strong>'.$data->ads_blocked_today.'</span></strong></li> |
|||
</ul> |
|||
'; |
|||
return json_encode(['status' => $active, 'html' => $html]); |
|||
} |
|||
|
|||
public function buildRequest() |
|||
{ |
|||
$config = $this->config; |
|||
$url = $config->url; |
|||
|
|||
$url = rtrim($url, '/'); |
|||
|
|||
$api_url = $url.'/api.php'; |
|||
//die( $api_url.' --- '); |
|||
|
|||
$client = new Client(['http_errors' => false, 'timeout' => 15, 'connect_timeout' => 15]); |
|||
$res = $client->request('GET', $api_url); |
|||
return $res; |
|||
|
|||
} |
|||
|
|||
|
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Plex implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#222'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/plex.png'; |
|||
} |
|||
} |
@ -1,77 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
|
|||
class Plexpy implements Contracts\Applications, Contracts\Livestats { |
|||
|
|||
public $config; |
|||
|
|||
public function defaultColour() |
|||
{ |
|||
return '#2d2208'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/plexpy.png'; |
|||
} |
|||
public function configDetails() |
|||
{ |
|||
return 'plexpy'; |
|||
} |
|||
public function testConfig() |
|||
{ |
|||
$res = $this->buildRequest('arnold'); |
|||
switch($res->getStatusCode()) { |
|||
case 200: |
|||
$data = json_decode($res->getBody()); |
|||
if(isset($data->error) && !empty($data->error)) { |
|||
echo 'Failed: '.$data->error; |
|||
} else { |
|||
echo 'Successfully connected to the API'; |
|||
} |
|||
break; |
|||
case 401: |
|||
echo 'Failed: Invalid credentials'; |
|||
break; |
|||
case 404: |
|||
echo 'Failed: Please make sure your URL is correct and that there is a trailing slash'; |
|||
break; |
|||
default: |
|||
echo 'Something went wrong... Code: '.$res->getStatusCode(); |
|||
break; |
|||
} |
|||
} |
|||
public function executeConfig() |
|||
{ |
|||
$html = ''; |
|||
$active = 'active'; |
|||
$res = $this->buildRequest('get_activity'); |
|||
$data = json_decode($res->getBody()); |
|||
$stream_count = $data->response->data->stream_count; |
|||
|
|||
$html = ' |
|||
<ul class="livestats"> |
|||
<li><span class="title">Stream Count</span><strong>'.$stream_count.'</strong></li> |
|||
</ul> |
|||
'; |
|||
|
|||
return json_encode(['status' => $active, 'html' => $html]); |
|||
} |
|||
public function buildRequest($endpoint) |
|||
{ |
|||
$config = $this->config; |
|||
$url = $config->url; |
|||
$apikey = $config->apikey; |
|||
|
|||
$url = rtrim($url, '/'); |
|||
|
|||
$api_url = $url.'/api/v2?apikey='.$apikey.'&cmd='.$endpoint; |
|||
|
|||
$client = new Client(['http_errors' => false, 'timeout' => 15, 'connect_timeout' => 15]); |
|||
$res = $client->request('GET', $api_url); |
|||
return $res; |
|||
|
|||
} |
|||
|
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Plexrequests implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#3c2d1c'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/plexrequests.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Portainer implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#283f44'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/portainer.png'; |
|||
} |
|||
} |
@ -1,80 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
|
|||
class Proxmox implements Contracts\Applications, Contracts\Livestats { |
|||
public function defaultColour() |
|||
{ |
|||
return '#542e0a'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/proxmox.png'; |
|||
} |
|||
|
|||
public function configDetails() |
|||
{ |
|||
//return 'proxmox'; |
|||
return null; |
|||
} |
|||
|
|||
public function testConfig() |
|||
{ |
|||
/*$res = $this->buildRequest(); |
|||
switch($res->getStatusCode()) { |
|||
case 200: |
|||
echo 'Successfully connected to the API'; |
|||
break; |
|||
case 401: |
|||
echo 'Failed: Invalid credentials'; |
|||
break; |
|||
case 404: |
|||
echo 'Failed: Please make sure your URL is correct and that there is a trailing slash'; |
|||
break; |
|||
default: |
|||
echo 'Something went wrong... Code: '.$res->getStatusCode(); |
|||
break; |
|||
}*/ |
|||
return null; |
|||
} |
|||
|
|||
public function executeConfig() |
|||
{ |
|||
/* |
|||
$output = ''; |
|||
$res = $this->buildRequest(); |
|||
$data = json_decode($res->getBody()); |
|||
|
|||
$output = ' |
|||
<ul class="livestats"> |
|||
<li><span class="title">Domains<br />Blocked</span><strong>'.$data->domains_being_blocked.'</strong></li> |
|||
<li><span class="title">Blocked<br />Today</span><strong>'.$data->ads_blocked_today.'</span></strong></li> |
|||
</ul> |
|||
'; |
|||
return $output; |
|||
*/ |
|||
return null; |
|||
} |
|||
|
|||
public function buildRequest($endpoint='') |
|||
{ |
|||
$config = $this->config; |
|||
|
|||
$username = $config->username; |
|||
$password = $config->password; |
|||
|
|||
$url = $config->url; |
|||
$url = rtrim($url, '/'); |
|||
|
|||
$api_url = $url.'/api2/json/'.$endpoint.'?username='.$username.'&password='.$password; |
|||
//die( $api_url.' --- '); |
|||
|
|||
$client = new Client(['http_errors' => false, 'verify' => false ]); |
|||
$res = $client->request('GET', $api_url); |
|||
return $res; |
|||
|
|||
} |
|||
|
|||
|
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Radarr implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#3e3726'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/radarr.png'; |
|||
} |
|||
} |
@ -1,95 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
|
|||
class Runeaudio implements Contracts\Applications, Contracts\Livestats { |
|||
public function defaultColour() |
|||
{ |
|||
return '#05A'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/runeaudio.png'; |
|||
} |
|||
|
|||
public function configDetails() |
|||
{ |
|||
return 'runeaudio'; |
|||
} |
|||
|
|||
public function testConfig() |
|||
{ |
|||
$res = $this->buildRequest('status'); |
|||
switch($res->getStatusCode()) { |
|||
case 200: |
|||
echo 'Successfully connected to the API'; |
|||
break; |
|||
case 401: |
|||
echo 'Failed: Invalid credentials'; |
|||
break; |
|||
case 404: |
|||
echo 'Failed: Please make sure your URL is correct and that there is a trailing slash'; |
|||
break; |
|||
default: |
|||
echo 'Something went wrong... Code: '.$res->getStatusCode(); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
public function executeConfig() |
|||
{ |
|||
$output = ''; |
|||
$active = 'active'; |
|||
$artist = ''; |
|||
$song_title = ''; |
|||
$res = $this->buildRequest('currentsong'); |
|||
$array = explode("\n", $res->getBody()); |
|||
foreach($array as $item) { |
|||
$item_array = explode(": ", $item); |
|||
if ($item_array[0] == 'Artist') { |
|||
$artist = $item_array[1]; |
|||
} elseif ($item_array[0] == 'Title') { |
|||
$song_title = $item_array[1]; |
|||
} |
|||
} |
|||
|
|||
$output = '<ul class="livestats">'; |
|||
|
|||
if (strlen($artist) > 12) { |
|||
$output = $output.'<li><span class="title-marquee"><span>'.$artist.'</span></span></li>'; |
|||
} else { |
|||
$output = $output.'<li><span class="title">'.$artist.'</span></li>'; |
|||
} |
|||
|
|||
$output = $output.'</ul><ul class="livestats">'; |
|||
|
|||
if (strlen($song_title) > 12) { |
|||
$output = $output.'<li><span class="title-marquee"><span>'.$song_title.'</span></span></li>'; |
|||
} else { |
|||
$output = $output.'<li><span class="title">'.$song_title.'</span></li>'; |
|||
} |
|||
|
|||
$output = $output.'</ul>'; |
|||
|
|||
return json_encode(['status' => $active, 'html' => $output]); |
|||
} |
|||
|
|||
public function buildRequest($endpoint) |
|||
{ |
|||
$config = $this->config; |
|||
$url = $config->url; |
|||
|
|||
$url = rtrim($url, '/'); |
|||
|
|||
$api_url = $url.'/command/?cmd='.$endpoint; |
|||
//die( $api_url.' --- '); |
|||
|
|||
$client = new Client(['http_errors' => false, 'timeout' => 15, 'connect_timeout' => 15]); |
|||
$res = $client->request('GET', $api_url); |
|||
return $res; |
|||
|
|||
} |
|||
|
|||
|
|||
} |
@ -1,89 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
|
|||
class Sabnzbd implements Contracts\Applications, Contracts\Livestats { |
|||
|
|||
public $config; |
|||
|
|||
public function defaultColour() |
|||
{ |
|||
return '#3e3924'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/sabnzbd.png'; |
|||
} |
|||
public function configDetails() |
|||
{ |
|||
return 'sabnzbd'; |
|||
} |
|||
public function testConfig() |
|||
{ |
|||
$res = $this->buildRequest('queue'); |
|||
switch($res->getStatusCode()) { |
|||
case 200: |
|||
$data = json_decode($res->getBody()); |
|||
if(isset($data->error) && !empty($data->error)) { |
|||
echo 'Failed: '.$data->error; |
|||
} else { |
|||
echo 'Successfully connected to the API'; |
|||
} |
|||
break; |
|||
case 401: |
|||
echo 'Failed: Invalid credentials'; |
|||
break; |
|||
case 404: |
|||
echo 'Failed: Please make sure your URL is correct and that there is a trailing slash'; |
|||
break; |
|||
default: |
|||
echo 'Something went wrong... Code: '.$res->getStatusCode(); |
|||
break; |
|||
} |
|||
} |
|||
public function executeConfig() |
|||
{ |
|||
$html = ''; |
|||
$active = 'inactive'; |
|||
$res = $this->buildRequest('queue'); |
|||
$data = json_decode($res->getBody()); |
|||
//$data->result->RemainingSizeMB = '10000000'; |
|||
//$data->result->DownloadRate = '100000000'; |
|||
if($data) { |
|||
$size = $data->queue->mbleft; |
|||
$rate = $data->queue->kbpersec; |
|||
$queue_size = format_bytes($size*1000*1000, false, ' <span>', '</span>'); |
|||
$current_speed = format_bytes($rate*1000, false, ' <span>'); |
|||
|
|||
$active = ($size > 0 || $rate > 0) ? 'active' : 'inactive'; |
|||
$html = ' |
|||
<ul class="livestats"> |
|||
<li><span class="title">Queue</span><strong>'.$queue_size.'</strong></li> |
|||
<li><span class="title">Speed</span><strong>'.$current_speed.'/s</span></strong></li> |
|||
</ul> |
|||
'; |
|||
} |
|||
return json_encode(['status' => $active, 'html' => $html]); |
|||
} |
|||
public function buildRequest($endpoint) |
|||
{ |
|||
$config = $this->config; |
|||
$url = $config->url; |
|||
$apikey = $config->apikey; |
|||
|
|||
//print_r($config); |
|||
//die(); |
|||
|
|||
$url = rtrim($url, '/'); |
|||
|
|||
$api_url = $url.'/api?output=json&apikey='.$apikey.'&mode='.$endpoint; |
|||
//die( $api_url.' --- '); |
|||
|
|||
$client = new Client(['http_errors' => false, 'timeout' => 15, 'connect_timeout' => 15]); |
|||
$res = $client->request('GET', $api_url); |
|||
return $res; |
|||
|
|||
} |
|||
|
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Sickrage implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#6185a6'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/sickrage.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Sonarr implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#163740'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/sonarr.png'; |
|||
} |
|||
} |
@ -1,11 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
class Syncthing implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#888'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/syncthing.png'; |
|||
} |
|||
} |
@ -1,77 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
|
|||
class Tautulli implements Contracts\Applications, Contracts\Livestats { |
|||
|
|||
public $config; |
|||
|
|||
public function defaultColour() |
|||
{ |
|||
return '#2d2208'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/tautulli.png'; |
|||
} |
|||
public function configDetails() |
|||
{ |
|||
return 'tautulli'; |
|||
} |
|||
public function testConfig() |
|||
{ |
|||
$res = $this->buildRequest('arnold'); |
|||
switch($res->getStatusCode()) { |
|||
case 200: |
|||
$data = json_decode($res->getBody()); |
|||
if(isset($data->error) && !empty($data->error)) { |
|||
echo 'Failed: '.$data->error; |
|||
} else { |
|||
echo 'Successfully connected to the API'; |
|||
} |
|||
break; |
|||
case 401: |
|||
echo 'Failed: Invalid credentials'; |
|||
break; |
|||
case 404: |
|||
echo 'Failed: Please make sure your URL is correct and that there is a trailing slash'; |
|||
break; |
|||
default: |
|||
echo 'Something went wrong... Code: '.$res->getStatusCode(); |
|||
break; |
|||
} |
|||
} |
|||
public function executeConfig() |
|||
{ |
|||
$html = ''; |
|||
$active = 'active'; |
|||
$res = $this->buildRequest('get_activity'); |
|||
$data = json_decode($res->getBody()); |
|||
$stream_count = $data->response->data->stream_count; |
|||
|
|||
$html = ' |
|||
<ul class="livestats"> |
|||
<li><span class="title">Stream Count</span><strong>'.$stream_count.'</strong></li> |
|||
</ul> |
|||
'; |
|||
|
|||
return json_encode(['status' => $active, 'html' => $html]); |
|||
} |
|||
public function buildRequest($endpoint) |
|||
{ |
|||
$config = $this->config; |
|||
$url = $config->url; |
|||
$apikey = $config->apikey; |
|||
|
|||
$url = rtrim($url, '/'); |
|||
|
|||
$api_url = $url.'/api/v2?apikey='.$apikey.'&cmd='.$endpoint; |
|||
|
|||
$client = new Client(['http_errors' => false, 'timeout' => 15, 'connect_timeout' => 15]); |
|||
$res = $client->request('GET', $api_url); |
|||
return $res; |
|||
|
|||
} |
|||
|
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Traefik implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#28434a'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/traefik.png'; |
|||
} |
|||
} |
@ -1,166 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
use Illuminate\Support\Facades\Log; |
|||
|
|||
class Transmission implements Contracts\Applications, Contracts\Livestats |
|||
{ |
|||
|
|||
private $_client; |
|||
private $_clientOptions = array(); |
|||
|
|||
public function __construct() |
|||
{ |
|||
$body = array(); |
|||
$body["method"] = "torrent-get"; |
|||
$body["arguments"] = array("fields" => ["percentDone","status","rateDownload","rateUpload"]); |
|||
$this->_client = new Client( |
|||
['http_errors' => false, |
|||
'timeout' => 10, |
|||
'body' => json_encode($body)] |
|||
); |
|||
} |
|||
|
|||
public function defaultColour() |
|||
{ |
|||
return '#950003'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/transmission.png'; |
|||
} |
|||
public function configDetails() |
|||
{ |
|||
return 'transmission'; |
|||
} |
|||
public function testConfig() |
|||
{ |
|||
$res = $this->sendRequest(); |
|||
if ($res == null) { |
|||
echo 'Transmission connection failed'; |
|||
return; |
|||
} |
|||
switch($res->getStatusCode()) { |
|||
case 200: |
|||
$data = json_decode($res->getBody()); |
|||
echo "Successfully connected with status: ".$data->result."\n"; |
|||
break; |
|||
case 401: |
|||
echo 'Failed: Invalid credentials'; |
|||
break; |
|||
case 404: |
|||
echo 'Failed: Please make sure your URL is correct and includes the port'; |
|||
break; |
|||
case 409: |
|||
echo 'Failed: Incorrect session id'; |
|||
break; |
|||
default: |
|||
echo 'Something went wrong... Code: '.$res->getStatusCode(); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
public function executeConfig() |
|||
{ |
|||
$html = ''; |
|||
$active = 'active'; |
|||
$res = $this->sendRequest(); |
|||
if ($res == null) { |
|||
Log::debug('Transmission connection failed'); |
|||
return ''; |
|||
} |
|||
$data = json_decode($res->getBody()); |
|||
if (! isset($data->arguments)) { |
|||
Log::debug('Failed to fetch data from Transmission'); |
|||
return ''; |
|||
} |
|||
$torrents = $data->arguments->torrents; |
|||
$torrentCount = count($torrents); |
|||
$rateDownload = $rateUpload = $completedTorrents = 0; |
|||
foreach ($torrents as $thisTorrent) { |
|||
$rateDownload += $thisTorrent->rateDownload; |
|||
$rateUpload += $thisTorrent->rateUpload; |
|||
if ($thisTorrent->percentDone == 1) { |
|||
$completedTorrents += 1; |
|||
} |
|||
} |
|||
if ($torrentCount - $completedTorrents == 0) { |
|||
// Don't poll as frequently if we don't have any active torrents |
|||
$active = 'inactive'; |
|||
} |
|||
|
|||
$html = ' |
|||
<ul class="livestats"> |
|||
<li><span class="title">Done</span><sub>'.$completedTorrents.' / '.$torrentCount.'</sub></li> |
|||
<li><span class="title">Down</span><sub>'.format_bytes($rateDownload).'</sub></li> |
|||
<li><span class="title">Up</span><sub>'.format_bytes($rateUpload).'</sub></li> |
|||
</ul> |
|||
'; |
|||
return json_encode(['status' => $active, 'html' => $html]);; |
|||
} |
|||
|
|||
private function sendRequest() |
|||
{ |
|||
$optionsSet = $this->setClientOptions(); |
|||
if (! $optionsSet) { |
|||
// Pass the failed response back up the chain |
|||
return null; |
|||
} |
|||
$res = $this->torrentGet(); |
|||
if ($res->getStatusCode() == 409) { |
|||
$this->setClientOptions(); |
|||
$res = $this->torrentGet(); |
|||
} |
|||
return $res; |
|||
} |
|||
|
|||
private function torrentGet() |
|||
{ |
|||
$res = null; |
|||
try{ |
|||
$res = $this->_client->request( |
|||
'POST', |
|||
$this->getApiUrl(), |
|||
$this->_clientOptions |
|||
); |
|||
}catch(\GuzzleHttp\Exception\BadResponseException $e){ |
|||
Log::error("Connection to {$e->getRequest()->getUrl()} failed"); |
|||
Log::debug($e->getMessage()); |
|||
$res = $e->getRequest(); |
|||
}catch(\GuzzleHttp\Exception\ConnectException $e) { |
|||
Log::error("Transmission connection refused"); |
|||
Log::debug($e->getMessage()); |
|||
} |
|||
return $res; |
|||
} |
|||
|
|||
private function setClientOptions() |
|||
{ |
|||
if ($this->config->username != '' || $this->config->password != '') { |
|||
$this->_clientOptions = ['auth'=> [$this->config->username, $this->config->password, 'Basic']]; |
|||
} |
|||
try{ |
|||
$res = $this->_client->request('HEAD', $this->getApiUrl(), $this->_clientOptions); |
|||
$xtId = $res->getHeaderLine('X-Transmission-Session-Id'); |
|||
if ($xtId != null) { |
|||
$this->_clientOptions['headers'] = ['X-Transmission-Session-Id' => $xtId]; |
|||
} else { |
|||
Log::error("Unable to get Transmission session information"); |
|||
Log::debug("Status Code: ".$res->getStatusCode()); |
|||
} |
|||
}catch(\GuzzleHttp\Exception\ConnectException $e){ |
|||
Log::error("Failed connection to Transmission"); |
|||
return false; |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
private function getApiUrl() |
|||
{ |
|||
$url = $this->config->url; |
|||
$url = rtrim($url, '/'); |
|||
$apiUrl = $url.'/transmission/rpc'; |
|||
return $apiUrl; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Ttrss implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#9d704c'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/tt-rss.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Unifi implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#363840'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/unifi.png'; |
|||
} |
|||
} |
@ -1,11 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
class Watcher3 implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#500'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/watcher3.png'; |
|||
} |
|||
} |
@ -1,11 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
class WebTools implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#555'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/webtools.png'; |
|||
} |
|||
} |
@ -1,11 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
class pyLoad implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#881'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/pyload.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class ruTorrent implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#004'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/rutorrent.png'; |
|||
} |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,91 @@ |
|||
<?php |
|||
|
|||
declare(strict_types=1); |
|||
|
|||
/* |
|||
* This file is part of Laravel GitHub. |
|||
* |
|||
* (c) Graham Campbell <graham@alt-three.com> |
|||
* |
|||
* For the full copyright and license information, please view the LICENSE |
|||
* file that was distributed with this source code. |
|||
*/ |
|||
|
|||
return [ |
|||
|
|||
/* |
|||
|-------------------------------------------------------------------------- |
|||
| Default Connection Name |
|||
|-------------------------------------------------------------------------- |
|||
| |
|||
| Here you may specify which of the connections below you wish to use as |
|||
| your default connection for all work. Of course, you may use many |
|||
| connections at once using the manager class. |
|||
| |
|||
*/ |
|||
|
|||
'default' => 'main', |
|||
|
|||
/* |
|||
|-------------------------------------------------------------------------- |
|||
| GitHub Connections |
|||
|-------------------------------------------------------------------------- |
|||
| |
|||
| Here are each of the connections setup for your application. Example |
|||
| configuration has been included, but you may add as many connections as |
|||
| you would like. Note that the 5 supported authentication methods are: |
|||
| "application", "jwt", "none", "password", and "token". |
|||
| |
|||
*/ |
|||
|
|||
'connections' => [ |
|||
|
|||
'main' => [ |
|||
'token' => 'your-token', |
|||
'method' => 'token', |
|||
// 'backoff' => false, |
|||
// 'cache' => false, |
|||
// 'version' => 'v3', |
|||
// 'enterprise' => false, |
|||
], |
|||
|
|||
'app' => [ |
|||
'clientId' => 'your-client-id', |
|||
'clientSecret' => 'your-client-secret', |
|||
'method' => 'application', |
|||
// 'backoff' => false, |
|||
// 'cache' => false, |
|||
// 'version' => 'v3', |
|||
// 'enterprise' => false, |
|||
], |
|||
|
|||
'jwt' => [ |
|||
'token' => 'your-jwt-token', |
|||
'method' => 'jwt', |
|||
// 'backoff' => false, |
|||
// 'cache' => false, |
|||
// 'version' => 'v3', |
|||
// 'enterprise' => false, |
|||
], |
|||
|
|||
'other' => [ |
|||
'username' => 'your-username', |
|||
'password' => 'your-password', |
|||
'method' => 'password', |
|||
// 'backoff' => false, |
|||
// 'cache' => false, |
|||
// 'version' => 'v3', |
|||
// 'enterprise' => false, |
|||
], |
|||
|
|||
'none' => [ |
|||
'method' => 'none', |
|||
// 'backoff' => false, |
|||
// 'cache' => false, |
|||
// 'version' => 'v3', |
|||
// 'enterprise' => false, |
|||
], |
|||
|
|||
], |
|||
|
|||
]; |
@ -0,0 +1,38 @@ |
|||
<?php |
|||
|
|||
use Illuminate\Support\Facades\Schema; |
|||
use Illuminate\Database\Schema\Blueprint; |
|||
use Illuminate\Database\Migrations\Migration; |
|||
|
|||
class CreateUsersTable extends Migration |
|||
{ |
|||
/** |
|||
* Run the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function up() |
|||
{ |
|||
Schema::create('users', function (Blueprint $table) { |
|||
$table->increments('id'); |
|||
$table->string('username')->unique(); |
|||
$table->string('email'); |
|||
$table->string('avatar')->nullable(); |
|||
$table->string('password')->nullable(); |
|||
$table->string('autologin')->nullable()->index(); |
|||
$table->boolean('public_front')->default(false); |
|||
$table->rememberToken(); |
|||
$table->timestamps(); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Reverse the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function down() |
|||
{ |
|||
Schema::dropIfExists('users'); |
|||
} |
|||
} |
@ -0,0 +1,32 @@ |
|||
<?php |
|||
|
|||
use Illuminate\Support\Facades\Schema; |
|||
use Illuminate\Database\Schema\Blueprint; |
|||
use Illuminate\Database\Migrations\Migration; |
|||
|
|||
class CreatePasswordResetsTable extends Migration |
|||
{ |
|||
/** |
|||
* Run the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function up() |
|||
{ |
|||
Schema::create('password_resets', function (Blueprint $table) { |
|||
$table->string('email')->index(); |
|||
$table->string('token'); |
|||
$table->timestamp('created_at')->nullable(); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Reverse the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function down() |
|||
{ |
|||
Schema::dropIfExists('password_resets'); |
|||
} |
|||
} |
@ -0,0 +1,32 @@ |
|||
<?php |
|||
|
|||
use Illuminate\Support\Facades\Schema; |
|||
use Illuminate\Database\Schema\Blueprint; |
|||
use Illuminate\Database\Migrations\Migration; |
|||
|
|||
class AddUserIdToItemsTable extends Migration |
|||
{ |
|||
/** |
|||
* Run the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function up() |
|||
{ |
|||
Schema::table('items', function (Blueprint $table) { |
|||
$table->integer('user_id')->default(1)->index(); // 0 = item, 1 = category |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Reverse the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function down() |
|||
{ |
|||
Schema::table('items', function (Blueprint $table) { |
|||
$table->dropColumn(['user_id']); |
|||
}); |
|||
} |
|||
} |
@ -0,0 +1,35 @@ |
|||
<?php |
|||
|
|||
use Illuminate\Support\Facades\Schema; |
|||
use Illuminate\Database\Schema\Blueprint; |
|||
use Illuminate\Database\Migrations\Migration; |
|||
|
|||
class CreateSettingUserPivotTable extends Migration |
|||
{ |
|||
/** |
|||
* Run the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function up() |
|||
{ |
|||
Schema::create('setting_user', function (Blueprint $table) { |
|||
$table->integer('setting_id')->unsigned()->index(); |
|||
$table->foreign('setting_id')->references('id')->on('settings')->onDelete('cascade'); |
|||
$table->integer('user_id')->unsigned()->index(); |
|||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); |
|||
$table->primary(['setting_id', 'user_id']); |
|||
$table->string('uservalue')->nullable(); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Reverse the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function down() |
|||
{ |
|||
Schema::dropIfExists('setting_user'); |
|||
} |
|||
} |
@ -0,0 +1,41 @@ |
|||
<?php |
|||
|
|||
use Illuminate\Support\Facades\Schema; |
|||
use Illuminate\Database\Schema\Blueprint; |
|||
use Illuminate\Database\Migrations\Migration; |
|||
|
|||
class CreateApplicationsTable extends Migration |
|||
{ |
|||
/** |
|||
* Run the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function up() |
|||
{ |
|||
Schema::create('applications', function (Blueprint $table) { |
|||
|
|||
$table->string('appid')->unique(); |
|||
$table->string('name')->unique(); |
|||
$table->string('sha')->unique()->nullable(); |
|||
$table->string('icon')->nullable(); |
|||
$table->string('website')->nullable(); |
|||
$table->string('license')->nullable(); |
|||
$table->mediumText('description')->nullable(); |
|||
$table->boolean('enhanced')->default(false); |
|||
$table->string('tile_background')->default('dark'); |
|||
|
|||
$table->timestamps(); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Reverse the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function down() |
|||
{ |
|||
Schema::dropIfExists('applications'); |
|||
} |
|||
} |
@ -0,0 +1,32 @@ |
|||
<?php |
|||
|
|||
use Illuminate\Support\Facades\Schema; |
|||
use Illuminate\Database\Schema\Blueprint; |
|||
use Illuminate\Database\Migrations\Migration; |
|||
|
|||
class AddClassToItemsTable extends Migration |
|||
{ |
|||
/** |
|||
* Run the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function up() |
|||
{ |
|||
Schema::table('items', function (Blueprint $table) { |
|||
$table->string('class')->nullable(); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Reverse the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function down() |
|||
{ |
|||
Schema::table('items', function (Blueprint $table) { |
|||
$table->dropColumn(['class']); |
|||
}); |
|||
} |
|||
} |
@ -0,0 +1,36 @@ |
|||
<?php |
|||
|
|||
use Illuminate\Support\Facades\Schema; |
|||
use Illuminate\Database\Schema\Blueprint; |
|||
use Illuminate\Database\Migrations\Migration; |
|||
|
|||
class CreateJobsTable extends Migration |
|||
{ |
|||
/** |
|||
* Run the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function up() |
|||
{ |
|||
Schema::create('jobs', function (Blueprint $table) { |
|||
$table->bigIncrements('id'); |
|||
$table->string('queue')->index(); |
|||
$table->longText('payload'); |
|||
$table->unsignedTinyInteger('attempts'); |
|||
$table->unsignedInteger('reserved_at')->nullable(); |
|||
$table->unsignedInteger('available_at'); |
|||
$table->unsignedInteger('created_at'); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Reverse the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function down() |
|||
{ |
|||
Schema::dropIfExists('jobs'); |
|||
} |
|||
} |
@ -0,0 +1,35 @@ |
|||
<?php |
|||
|
|||
use Illuminate\Support\Facades\Schema; |
|||
use Illuminate\Database\Schema\Blueprint; |
|||
use Illuminate\Database\Migrations\Migration; |
|||
|
|||
class CreateFailedJobsTable extends Migration |
|||
{ |
|||
/** |
|||
* Run the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function up() |
|||
{ |
|||
Schema::create('failed_jobs', function (Blueprint $table) { |
|||
$table->bigIncrements('id'); |
|||
$table->text('connection'); |
|||
$table->text('queue'); |
|||
$table->longText('payload'); |
|||
$table->longText('exception'); |
|||
$table->timestamp('failed_at')->useCurrent(); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Reverse the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function down() |
|||
{ |
|||
Schema::dropIfExists('failed_jobs'); |
|||
} |
|||
} |
@ -0,0 +1,27 @@ |
|||
<?php |
|||
|
|||
use Illuminate\Database\Seeder; |
|||
use App\User; |
|||
|
|||
class UsersSeeder extends Seeder |
|||
{ |
|||
/** |
|||
* Run the database seeds. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function run() |
|||
{ |
|||
// Groups |
|||
if(!$user = User::find(1)) { |
|||
$user = new User; |
|||
$user->id = 1; |
|||
$user->username = 'admin'; |
|||
$user->email = 'admin@test.com'; |
|||
$user->password = null; |
|||
$user->save(); |
|||
} else { |
|||
//$user->save(); |
|||
} |
|||
} |
|||
} |
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue