diff --git a/.gitignore b/.gitignore index 0e6920f7..cf44b717 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,7 @@ app/config/*.toml phinx.yml .idea/ Caddyfile -build/humbuglog.txt \ No newline at end of file +build/humbuglog.txt +public/images/anime/** +public/images/manga/** +public/images/characters/** \ No newline at end of file diff --git a/app/appConf/routes.php b/app/appConf/routes.php index d8b81816..0d3e5971 100644 --- a/app/appConf/routes.php +++ b/app/appConf/routes.php @@ -147,6 +147,16 @@ return [ // --------------------------------------------------------------------- // Default / Shared routes // --------------------------------------------------------------------- + 'image_proxy' => [ + 'path' => '/public/images/{type}/{file}', + 'action' => 'images', + 'controller' => DEFAULT_CONTROLLER, + 'verb' => 'get', + 'tokens' => [ + 'type' => '[a-z0-9\-]+', + 'file' => '[a-z0-9\-]+\.[a-z]{3}' + ] + ], 'cache_purge' => [ 'path' => '/cache_purge', 'action' => 'clearCache', diff --git a/app/views/anime/details.php b/app/views/anime/details.php index 127a5706..f354f277 100644 --- a/app/views/anime/details.php +++ b/app/views/anime/details.php @@ -1,7 +1,7 @@
- + " alt="" />

@@ -80,7 +80,7 @@ 0): ?>

Characters

- + $char): ?>
generate('character', ['slug' => $char['slug']]) ?> @@ -88,7 +88,7 @@ a($link, $char['name']); ?> - img($char['image']['original'], [ + img($urlGenerator->assetUrl("images/characters/{$id}.jpg"), [ 'width' => '225' ]) ?> diff --git a/app/views/character.php b/app/views/character.php index d499f213..8b0dfb3c 100644 --- a/app/views/character.php +++ b/app/views/character.php @@ -2,7 +2,7 @@
- + " alt="" />

@@ -18,14 +18,14 @@

Anime

- + $anime): ?>
generate('anime.details', ['id' => $anime['attributes']['slug']]); $titles = Kitsu::filterTitles($anime['attributes']); ?> - + " width="220" alt="" />
@@ -45,14 +45,14 @@

Manga

- + $manga): ?>
generate('manga.details', ['id' => $manga['attributes']['slug']]); $titles = Kitsu::filterTitles($manga['attributes']); ?> - + " width="220" alt="" />
diff --git a/app/views/collection/cover.php b/app/views/collection/cover.php index 94690f56..d35f1274 100644 --- a/app/views/collection/cover.php +++ b/app/views/collection/cover.php @@ -11,7 +11,7 @@
- " alt=" cover image" />
diff --git a/public/css.js b/public/css.js index 083577a7..1db6c13e 100644 --- a/public/css.js +++ b/public/css.js @@ -11,10 +11,11 @@ const css = fs.readFileSync('css/base.css', 'utf8'); postcss() .use(atImport()) - .use(cssNext({ - warnForDuplicates: false - })) + .use(cssNext()) .use(cssNano({ + autoprefixer: false, + colormin: false, + minifyFontValues: false, options: { sourcemap: false } diff --git a/public/css/app.min.css b/public/css/app.min.css index 7d565419..4f637cee 100644 --- a/public/css/app.min.css +++ b/public/css/app.min.css @@ -1 +1 @@ -:root{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;box-sizing:border-box;cursor:default;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;line-height:1.4;overflow-y:scroll;text-size-adjust:100%;scroll-behavior:smooth}audio:not([controls]){display:none}details{display:block}input[type=search]{-webkit-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}main{margin:0 auto;padding:0 1.6em 1.6em;padding:0 16px 16px;padding:0 1.6rem 1.6rem}main,pre,summary{display:block}pre{background:#efefef;color:#444;font-family:Anonymous Pro,Fira Code,Menlo,Monaco,Consolas,Courier New,monospace;font-size:1.4em;font-size:14px;font-size:1.4rem;margin:1.6em 0;margin:16px 0;margin:1.6rem 0;overflow:auto;padding:1.6em;padding:16px;padding:1.6rem;word-break:break-all;word-wrap:break-word}progress{display:inline-block}small{color:#777;font-size:75%}big{font-size:125%}template{display:none}textarea{border:1px solid #ccc;border:.1rem solid #ccc;border-radius:0;display:block;margin-bottom:8px;margin-bottom:.8rem;overflow:auto;padding:8px;padding:.8rem;resize:vertical;vertical-align:middle}[hidden]{display:none}[unselectable]{-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;user-select:none}*,:after,:before{border-style:solid;border-width:0;box-sizing:inherit}*{font-size:inherit;line-height:inherit;margin:0;padding:0}:after,:before{text-decoration:inherit;vertical-align:inherit}a{-webkit-transition:.25s ease;color:#1271db;text-decoration:none;transition:.25s ease}audio,canvas,iframe,img,svg,video{vertical-align:middle}button,input,select,textarea{border:1px solid #ccc;border:.1rem solid #ccc;color:inherit;font-family:inherit;font-style:inherit;font-weight:inherit;min-height:1.4em}code,kbd,pre,samp{font-family:Anonymous Pro,Fira Code,Menlo,Monaco,Consolas,Courier New,monospace}table{border-collapse:collapse;border-spacing:0;margin-bottom:16px;margin-bottom:1.6rem}::-moz-selection{background-color:#b3d4fc;text-shadow:none}::selection{background-color:#b3d4fc;text-shadow:none}button::-moz-focus-inner{border:0}body{color:#444;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:16px;font-size:1.6rem;font-style:normal;font-weight:400;padding:0}p{margin:0 0 16px;margin:0 0 1.6rem}h1,h2,h3,h4,h5,h6{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;margin:2em 0 1.6em;margin:20px 0 16px;margin:2rem 0 1.6rem}h1{border-bottom:1px solid rgba(0,0,0,.2);border-bottom:.1rem solid rgba(0,0,0,.2);font-size:3.6em;font-size:36px;font-size:3.6rem}h1,h2{font-style:normal;font-weight:500}h2{font-size:3em;font-size:30px;font-size:3rem}h3{font-size:2.4em;font-size:24px;font-size:2.4rem;font-style:normal;font-weight:500;margin:16px 0 4px;margin:1.6rem 0 .4rem}h4{font-size:1.8em;font-size:18px;font-size:1.8rem}h4,h5{font-style:normal;font-weight:600;margin:16px 0 4px;margin:1.6rem 0 .4rem}h5{font-size:1.6em;font-size:16px;font-size:1.6rem}h6{color:#777;font-size:1.4em;font-style:normal;font-weight:600;margin:16px 0 4px;margin:1.6rem 0 .4rem}code,h6{font-size:14px;font-size:1.4rem}code{background:#efefef;color:#444;font-family:Anonymous Pro,Fira Code,Menlo,Monaco,Consolas,Courier New,monospace;word-break:break-all;word-wrap:break-word}a:focus,a:hover{text-decoration:none}dl{margin-bottom:16px;margin-bottom:1.6rem}dd{margin-left:40px;margin-left:4rem}ol,ul{margin-bottom:8px;margin-bottom:.8rem;padding-left:20px;padding-left:2rem}blockquote{border-left:2px solid #1271db;border-left:.2rem solid #1271db;font-style:italic;margin:16px 0;margin:1.6rem 0;padding-left:16px;padding-left:1.6rem}blockquote,figcaption{font-family:Georgia,Times,Times New Roman,serif}html{font-size:62.5%}article,aside,details,footer,header,main,section,summary{display:block;height:auto;margin:0 auto;width:100%}footer{clear:both;display:inline-block;float:left;max-width:100%;padding:10px 0;padding:1rem 0;text-align:center}footer,hr{border-top:1px solid rgba(0,0,0,.2);border-top:.1rem solid rgba(0,0,0,.2)}hr{display:block;margin-bottom:16px;margin-bottom:1.6rem;width:100%}img{height:auto;vertical-align:baseline}input[type=color],input[type=date],input[type=datetime-local],input[type=datetime],input[type=email],input[type=month],input[type=number],input[type=password],input[type=search],input[type=tel],input[type=text],input[type=time],input[type=url],input[type=week],select{border:1px solid #ccc;border:.1rem solid #ccc;border-radius:0;display:inline-block;padding:8px;padding:.8rem;vertical-align:middle}input:not([type]){-webkit-appearance:none;background-clip:padding-box;background-color:#fff;border:1px solid #ccc;border:.1rem solid #ccc;border-radius:0;color:#444;display:inline-block;padding:8px;padding:.8rem;text-align:left}input[type=color]{padding:8px 16px;padding:.8rem 1.6rem}input:not([type]):focus,input[type=color]:focus,input[type=date]:focus,input[type=datetime-local]:focus,input[type=datetime]:focus,input[type=email]:focus,input[type=month]:focus,input[type=number]:focus,input[type=password]:focus,input[type=search]:focus,input[type=tel]:focus,input[type=text]:focus,input[type=time]:focus,input[type=url]:focus,input[type=week]:focus,select:focus,textarea:focus{border-color:#b3d4fc}input[type=checkbox],input[type=radio]{vertical-align:middle}input[type=checkbox]:focus,input[type=file]:focus,input[type=radio]:focus{outline:thin solid #444}input:not([type])[disabled],input[type=color][disabled],input[type=date][disabled],input[type=datetime-local][disabled],input[type=datetime][disabled],input[type=email][disabled],input[type=month][disabled],input[type=number][disabled],input[type=password][disabled],input[type=search][disabled],input[type=tel][disabled],input[type=text][disabled],input[type=time][disabled],input[type=url][disabled],input[type=week][disabled],select[disabled],textarea[disabled]{background-color:#efefef;color:#777;cursor:not-allowed}input[readonly],select[readonly],textarea[readonly]{background-color:#efefef;border-color:#ccc;color:#777}input:focus:invalid,select:focus:invalid,textarea:focus:invalid{border-color:#e9322d;color:#b94a48}input[type=checkbox]:focus:invalid:focus,input[type=file]:focus:invalid:focus,input[type=radio]:focus:invalid:focus{outline-color:#ff4136}select{background-color:#fff;border:1px solid #ccc;border:.1rem solid #ccc}select[multiple]{height:auto}label{line-height:2}fieldset{border:0;margin:0;padding:8px 0;padding:.8rem 0}legend{border-bottom:1px solid #ccc;border-bottom:.1rem solid #ccc;display:block;padding:8px 0;padding:.8rem 0;width:100%}button,input[type=submit],legend{color:#444;margin-bottom:8px;margin-bottom:.8rem}button,input[type=submit]{-moz-user-select:none;-ms-user-select:none;-webkit-transition:.25s ease;-webkit-user-drag:none;-webkit-user-select:none;border:2px solid #444;border:.2rem solid #444;border-radius:0;cursor:pointer;display:inline-block;margin-right:4px;margin-right:.4rem;padding:8px 16px;padding:.8rem 1.6rem;text-align:center;text-decoration:none;text-transform:uppercase;transition:.25s ease;user-select:none;vertical-align:baseline}button a,input[type=submit] a{color:#444}button::-moz-focus-inner,input[type=submit]::-moz-focus-inner{padding:0}button:hover,input[type=submit]:hover{background:#444;border-color:#444;color:#fff}button:hover a,input[type=submit]:hover a{color:#fff}button:active,input[type=submit]:active{background:#6a6a6a;border-color:#6a6a6a;color:#fff}button:active a,input[type=submit]:active a{color:#fff}button:disabled,input[type=submit]:disabled{box-shadow:none;cursor:not-allowed;opacity:.4}nav ul{list-style:none;margin:0;padding:0;text-align:center}nav ul li{display:inline}nav a{-webkit-transition:.25s ease;border-bottom:2px solid transparent;border-bottom:.2rem solid transparent;color:#444;padding:8px 16px;padding:.8rem 1.6rem;text-decoration:none;transition:.25s ease}nav a:hover,nav li.selected a{border-color:rgba(0,0,0,.2)}nav a:active{border-color:rgba(0,0,0,.56)}caption{padding:8px 0;padding:.8rem 0}thead th{background:#efefef;color:#444}tr{background:#fff;margin-bottom:8px;margin-bottom:.8rem}td,th{border:1px solid #ccc;border:.1rem solid #ccc;padding:8px 16px;padding:.8rem 1.6rem;text-align:center;vertical-align:inherit}tfoot tr{background:none}tfoot td{color:#efefef;font-size:8px;font-size:.8rem;font-style:italic;padding:16px 4px;padding:1.6rem .4rem}@media screen{[hidden~=screen]{display:inherit}[hidden~=screen]:not(:active):not(:focus):not(:target){clip:rect(0)!important;position:absolute!important}}@media screen and max-width 40rem{article,aside,section{clear:both;display:block;max-width:100%}img{margin-right:1.6rem}}.media[hidden],[hidden=hidden],template{display:none}body{margin:.5em}button{background:hsla(0,0%,100%,.65);margin:0}table{min-width:85%;margin:0 auto}td{padding:1em;padding:10px;padding:1rem}thead td,thead th{padding:.5em;padding:5px;padding:.5rem}input[type=number]{width:4em}tbody>tr:nth-child(odd){background:#ddd}a:active,a:hover{color:#7d12db}.bracketed{color:#12db18}.bracketed,h1 a{text-shadow:1px 1px 1px #000}.bracketed:before{content:"[\00a0"}.bracketed:after{content:"\00a0]"}.bracketed:active,.bracketed:hover{color:#db7d12}.grow-1{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.flex-wrap{-ms-flex-wrap:wrap;flex-wrap:wrap}.flex-no-wrap{-ms-flex-wrap:nowrap;flex-wrap:nowrap}.flex-align-end{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}.flex-align-space-around{-ms-flex-line-pack:distribute;align-content:space-around}.flex-justify-space-around{-ms-flex-pack:distribute;justify-content:space-around}.flex-self-center{-ms-flex-item-align:center;-ms-grid-row-align:center;align-self:center}.flex{display:-webkit-box;display:-ms-flexbox;display:flex}.small-font{font-size:16px;font-size:1.6rem}.justify{text-align:justify}.align_center{text-align:center!important}.align_left{text-align:left!important}.align_right{text-align:right!important}.valign_top{vertical-align:top}.no_border{border:none}.media-wrap{text-align:center;margin:0 auto}.danger{background-color:#ff4136;border-color:#924949;color:#fff}.danger:active,.danger:hover{background-color:#924949;border-color:#ff4136;color:#fff}.user-btn{border-color:#12db18;color:#12db18;text-shadow:1px 1px 1px #000;padding:0 .5em;padding:0 5px;padding:0 .5rem}.user-btn:active,.user-btn:hover{border-color:#db7d12;background-color:#db7d12}.full_width{width:100%}.cssload-loader{position:relative;left:calc(50% - 31px);width:62px;height:62px;border-radius:50%;-webkit-perspective:780px;perspective:780px}.cssload-inner{position:absolute;width:100%;height:100%;box-sizing:border-box;border-radius:50%}.cssload-inner.cssload-one{left:0;top:0;-webkit-animation:a 1.15s linear infinite;animation:a 1.15s linear infinite;border-bottom:3px solid #000}.cssload-inner.cssload-two{right:0;top:0;-webkit-animation:b 1.15s linear infinite;animation:b 1.15s linear infinite;border-right:3px solid #000}.cssload-inner.cssload-three{right:0;bottom:0;-webkit-animation:c 1.15s linear infinite;animation:c 1.15s linear infinite;border-top:3px solid #000}@-webkit-keyframes a{0%{-webkit-transform:rotateX(35deg) rotateY(-45deg) rotate(0deg);transform:rotateX(35deg) rotateY(-45deg) rotate(0deg)}to{-webkit-transform:rotateX(35deg) rotateY(-45deg) rotate(1turn);transform:rotateX(35deg) rotateY(-45deg) rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotateX(35deg) rotateY(-45deg) rotate(0deg);transform:rotateX(35deg) rotateY(-45deg) rotate(0deg)}to{-webkit-transform:rotateX(35deg) rotateY(-45deg) rotate(1turn);transform:rotateX(35deg) rotateY(-45deg) rotate(1turn)}}@-webkit-keyframes b{0%{-webkit-transform:rotateX(50deg) rotateY(10deg) rotate(0deg);transform:rotateX(50deg) rotateY(10deg) rotate(0deg)}to{-webkit-transform:rotateX(50deg) rotateY(10deg) rotate(1turn);transform:rotateX(50deg) rotateY(10deg) rotate(1turn)}}@keyframes b{0%{-webkit-transform:rotateX(50deg) rotateY(10deg) rotate(0deg);transform:rotateX(50deg) rotateY(10deg) rotate(0deg)}to{-webkit-transform:rotateX(50deg) rotateY(10deg) rotate(1turn);transform:rotateX(50deg) rotateY(10deg) rotate(1turn)}}@-webkit-keyframes c{0%{-webkit-transform:rotateX(35deg) rotateY(55deg) rotate(0deg);transform:rotateX(35deg) rotateY(55deg) rotate(0deg)}to{-webkit-transform:rotateX(35deg) rotateY(55deg) rotate(1turn);transform:rotateX(35deg) rotateY(55deg) rotate(1turn)}}@keyframes c{0%{-webkit-transform:rotateX(35deg) rotateY(55deg) rotate(0deg);transform:rotateX(35deg) rotateY(55deg) rotate(0deg)}to{-webkit-transform:rotateX(35deg) rotateY(55deg) rotate(1turn);transform:rotateX(35deg) rotateY(55deg) rotate(1turn)}}.sorting,.sorting_asc,.sorting_desc{vertical-align:text-bottom}.sorting:before{content:" ↕\00a0"}.sorting_asc:before{content:" ↑\00a0"}.sorting_desc:before{content:" ↓\00a0"}.form{width:100%}.form thead th,.form thead tr{background:inherit;border:0}.form tr>td:nth-child(odd){text-align:right;min-width:25px;max-width:30%}.form tr>td:nth-child(2n){text-align:left;width:70%}.invisible tbody>tr:nth-child(odd){background:inherit}.invisible td,.invisible th,.invisible tr{border:0}.message{position:relative;margin:.5em auto;padding:.5em;width:95%}.message .close{width:1em;height:1em;position:absolute;right:.5em;top:.5em;text-align:center;vertical-align:middle;line-height:1em}.message:hover .close:after{content:"☒"}.message:hover{cursor:pointer}.message .icon{left:.5em;top:.5em;margin-right:1em}.message.error{border:1px solid #924949;background:#f3e6e6}.message.error .icon:after{content:"✘"}.message.success{border:1px solid #1f8454;background:#70dda9}.message.success .icon:after{content:"✔"}.message.info{border:1px solid #bfbe3a;background:#ffc}.message.info .icon:after{content:"⚠"}.character,.media,.small_character{position:relative;vertical-align:top;display:inline-block;text-align:center;width:220px;height:311px;margin:.25em .125em}.character>img,.media>img,.small_character>img{width:100%}.media .edit_buttons>button{margin:.5em auto}.media_metadata>div,.medium_metadata>div,.name,.row{text-shadow:1px 2px 1px rgba(0,0,0,.85);background:#000;background:rgba(0,0,0,.45);color:#fff;padding:.25em .125em;text-align:right}.age_rating,.media_type{text-align:left}.media>.media_metadata{position:absolute;bottom:0;right:0}.media>.medium_metadata{position:absolute;bottom:0;left:0}.media>.name{position:absolute;top:0}.character:hover>.name,.media:hover>.media_metadata>div,.media:hover>.medium_metadata>div,.media:hover>.name,.media:hover>.table .row,.small_character:hover>.name{-webkit-transition:.25s ease;transition:.25s ease;background:rgba(0,0,0,.75)}.media:hover>.edit_buttons[hidden],.media:hover>button[hidden]{-webkit-transition:.25s ease;transition:.25s ease;display:block}.character>.name a,.character>.name a small,.media>.name a,.media>.name a small,.small_character>.name a,.small_character>.name a small{background:none;color:#fff;text-shadow:1px 2px 1px rgba(0,0,0,.85)}.anime .name,.manga .name{text-align:center;width:100%;padding:.5em .25em}.anime .age_rating,.anime .airing_status,.anime .completion,.anime .delete,.anime .edit,.anime .media_type,.anime .user_rating{background:none;text-align:center}.anime .table,.manga .table{position:absolute;bottom:0;left:0;width:100%}.anime .row,.manga .row{width:100%;background:#000;background:rgba(0,0,0,.45);display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-line-pack:distribute;align-content:space-around;-ms-flex-pack:distribute;justify-content:space-around;text-align:center;padding:0 inherit}.anime .row>span,.manga .row>span{text-align:left}.anime .row>div,.manga .row>div{font-size:.8em;display:flex-item;-ms-flex-item-align:center;align-self:center;text-align:center;vertical-align:middle}.anime .media>button.plus_one{position:absolute;top:138px;top:calc(50% - 21.5px);left:44px;left:calc(50% - 66.5px)}.manga .row{padding:1px}.manga .media{border:1px solid #ddd;height:310px;margin:.25em}.manga .media>.edit_buttons{position:absolute;top:86px;top:calc(50% - 58.5px);left:43.5px;left:calc(50% - 66.5px)}.media.search>.name{background-color:#555;background-color:rgba(0,0,0,.35);background-size:cover;background-size:contain;background-repeat:no-repeat}.big-check{display:none}.big-check:checked+label{-webkit-transition:.25s ease;transition:.25s ease;background:rgba(0,0,0,.75)}.big-check:checked+label:after{content:"✓";font-size:15em;font-size:150px;font-size:15rem;text-align:center;color:#adff2f;position:absolute;top:147px;left:0;height:100%;width:100%}#series_list article.media{position:relative}#series_list .name,#series_list .name label{position:absolute;display:block;top:0;left:0;height:100%;width:100%;vertical-align:middle;line-height:1.25em}#series_list .name small{color:#fff}.details{margin:15px auto 0;margin:1.5rem auto 0;padding:10px;padding:1rem;font-size:inherit}.description{max-width:800px;max-width:80rem}.fixed{max-width:930px;max-width:93rem}.details .cover{display:block;width:284px}.details h2{margin-top:0}.details .flex>div{margin:10px;margin:1rem}.details .media_details{max-width:300px}.details .media_details td{padding:0 15px;padding:0 1.5rem}.details p{text-align:justify}.details .media_details td:nth-child(odd){width:1%;white-space:nowrap;text-align:right}.details .media_details td:nth-child(2n){text-align:left}.character,.small_character{background:rgba(0,0,0,.5);width:225px;height:350px;vertical-align:middle;white-space:nowrap}.small_character a{display:inline-block;width:100%;height:100%}.character .name,.small_character .name{position:absolute;bottom:0;left:0;z-index:2}.character img,.small_character img{position:relative;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);z-index:1;width:100%}.min-table{min-width:0;margin-left:0}.small_character{width:160px;height:250px}.user-page .media-wrap{text-align:left}.media a{display:inline-block;width:100%;height:100%}@media screen and (max-width:40em){nav a{line-height:4em;line-height:4rem}.media{margin:2px 0}main{padding:0 0,5em .5em;padding:0 .5rem .5rem}}.streaming-logo{width:50px;height:50px;vertical-align:middle}.cover_streaming_link .streaming-logo{width:20px;height:20px} \ No newline at end of file +:root{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;box-sizing:border-box;cursor:default;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;line-height:1.4;overflow-y:scroll;text-size-adjust:100%;scroll-behavior:smooth}audio:not([controls]){display:none}details{display:block}input[type=search]{-webkit-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}main{margin:0 auto;padding:0 1.6em 1.6em;padding:0 16px 16px;padding:0 1.6rem 1.6rem}main,pre,summary{display:block}pre{background:#efefef;color:#444;font-family:"Anonymous Pro","Fira Code",Menlo,Monaco,Consolas,"Courier New",monospace;font-size:1.4em;font-size:14px;font-size:1.4rem;margin:1.6em 0;margin:16px 0;margin:1.6rem 0;overflow:auto;padding:1.6em;padding:16px;padding:1.6rem;word-break:break-all;word-wrap:break-word}progress{display:inline-block}small{color:#777;font-size:75%}big{font-size:125%}template{display:none}textarea{border:1px solid #ccc;border:.1rem solid #ccc;border-radius:0;display:block;margin-bottom:8px;margin-bottom:.8rem;overflow:auto;padding:8px;padding:.8rem;resize:vertical;vertical-align:middle}[hidden]{display:none}[unselectable]{-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;user-select:none}*,:after,:before{border-style:solid;border-width:0;box-sizing:inherit}*{font-size:inherit;line-height:inherit;margin:0;padding:0}:after,:before{text-decoration:inherit;vertical-align:inherit}a{-webkit-transition:.25s ease;color:#1271db;text-decoration:none;transition:.25s ease}audio,canvas,iframe,img,svg,video{vertical-align:middle}button,input,select,textarea{border:1px solid #ccc;border:.1rem solid #ccc;color:inherit;font-family:inherit;font-style:inherit;font-weight:inherit;min-height:1.4em}code,kbd,pre,samp{font-family:"Anonymous Pro","Fira Code",Menlo,Monaco,Consolas,"Courier New",monospace}table{border-collapse:collapse;border-spacing:0;margin-bottom:16px;margin-bottom:1.6rem}::-moz-selection{background-color:#b3d4fc;text-shadow:none}::selection{background-color:#b3d4fc;text-shadow:none}button::-moz-focus-inner{border:0}body{color:#444;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:16px;font-size:1.6rem;font-style:normal;font-weight:400;padding:0}p{margin:0 0 16px;margin:0 0 1.6rem}h1,h2,h3,h4,h5,h6{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;margin:2em 0 1.6em;margin:20px 0 16px;margin:2rem 0 1.6rem}h1{border-bottom:1px solid rgba(0,0,0,.2);border-bottom:.1rem solid rgba(0,0,0,.2);font-size:3.6em;font-size:36px;font-size:3.6rem}h1,h2{font-style:normal;font-weight:500}h2{font-size:3em;font-size:30px;font-size:3rem}h3{font-size:2.4em;font-size:24px;font-size:2.4rem;font-style:normal;font-weight:500;margin:16px 0 4px;margin:1.6rem 0 .4rem}h4{font-size:1.8em;font-size:18px;font-size:1.8rem}h4,h5{font-style:normal;font-weight:600;margin:16px 0 4px;margin:1.6rem 0 .4rem}h5{font-size:1.6em;font-size:16px;font-size:1.6rem}h6{color:#777;font-size:1.4em;font-style:normal;font-weight:600;margin:16px 0 4px;margin:1.6rem 0 .4rem}code,h6{font-size:14px;font-size:1.4rem}code{background:#efefef;color:#444;font-family:"Anonymous Pro","Fira Code",Menlo,Monaco,Consolas,"Courier New",monospace;word-break:break-all;word-wrap:break-word}a:focus,a:hover{text-decoration:none}dl{margin-bottom:16px;margin-bottom:1.6rem}dd{margin-left:40px;margin-left:4rem}ol,ul{margin-bottom:8px;margin-bottom:.8rem;padding-left:20px;padding-left:2rem}blockquote{border-left:2px solid #1271db;border-left:.2rem solid #1271db;font-style:italic;margin:16px 0;margin:1.6rem 0;padding-left:16px;padding-left:1.6rem}blockquote,figcaption{font-family:Georgia,Times,"Times New Roman",serif}html{font-size:62.5%}article,aside,details,footer,header,main,section,summary{display:block;height:auto;margin:0 auto;width:100%}footer{clear:both;display:inline-block;float:left;max-width:100%;padding:10px 0;padding:1rem 0;text-align:center}footer,hr{border-top:1px solid rgba(0,0,0,.2);border-top:.1rem solid rgba(0,0,0,.2)}hr{display:block;margin-bottom:16px;margin-bottom:1.6rem;width:100%}img{height:auto;vertical-align:baseline}input[type=color],input[type=date],input[type=datetime-local],input[type=datetime],input[type=email],input[type=month],input[type=number],input[type=password],input[type=search],input[type=tel],input[type=text],input[type=time],input[type=url],input[type=week],select{border:1px solid #ccc;border:.1rem solid #ccc;border-radius:0;display:inline-block;padding:8px;padding:.8rem;vertical-align:middle}input:not([type]){-webkit-appearance:none;background-clip:padding-box;background-color:#fff;border:1px solid #ccc;border:.1rem solid #ccc;border-radius:0;color:#444;display:inline-block;padding:8px;padding:.8rem;text-align:left}input[type=color]{padding:8px 16px;padding:.8rem 1.6rem}input:not([type]):focus,input[type=color]:focus,input[type=date]:focus,input[type=datetime-local]:focus,input[type=datetime]:focus,input[type=email]:focus,input[type=month]:focus,input[type=number]:focus,input[type=password]:focus,input[type=search]:focus,input[type=tel]:focus,input[type=text]:focus,input[type=time]:focus,input[type=url]:focus,input[type=week]:focus,select:focus,textarea:focus{border-color:#b3d4fc}input[type=checkbox],input[type=radio]{vertical-align:middle}input[type=checkbox]:focus,input[type=file]:focus,input[type=radio]:focus{outline:thin solid #444}input:not([type])[disabled],input[type=color][disabled],input[type=date][disabled],input[type=datetime-local][disabled],input[type=datetime][disabled],input[type=email][disabled],input[type=month][disabled],input[type=number][disabled],input[type=password][disabled],input[type=search][disabled],input[type=tel][disabled],input[type=text][disabled],input[type=time][disabled],input[type=url][disabled],input[type=week][disabled],select[disabled],textarea[disabled]{background-color:#efefef;color:#777;cursor:not-allowed}input[readonly],select[readonly],textarea[readonly]{background-color:#efefef;border-color:#ccc;color:#777}input:focus:invalid,select:focus:invalid,textarea:focus:invalid{border-color:#e9322d;color:#b94a48}input[type=checkbox]:focus:invalid:focus,input[type=file]:focus:invalid:focus,input[type=radio]:focus:invalid:focus{outline-color:#ff4136}select{background-color:#fff;border:1px solid #ccc;border:.1rem solid #ccc}select[multiple]{height:auto}label{line-height:2}fieldset{border:0;margin:0;padding:8px 0;padding:.8rem 0}legend{border-bottom:1px solid #ccc;border-bottom:.1rem solid #ccc;display:block;padding:8px 0;padding:.8rem 0;width:100%}button,input[type=submit],legend{color:#444;margin-bottom:8px;margin-bottom:.8rem}button,input[type=submit]{-moz-user-select:none;-ms-user-select:none;-webkit-transition:.25s ease;-webkit-user-drag:none;-webkit-user-select:none;border:2px solid #444;border:.2rem solid #444;border-radius:0;cursor:pointer;display:inline-block;margin-right:4px;margin-right:.4rem;padding:8px 16px;padding:.8rem 1.6rem;text-align:center;text-decoration:none;text-transform:uppercase;transition:.25s ease;user-select:none;vertical-align:baseline}button a,input[type=submit] a{color:#444}button::-moz-focus-inner,input[type=submit]::-moz-focus-inner{padding:0}button:hover,input[type=submit]:hover{background:#444;border-color:#444;color:#fff}button:hover a,input[type=submit]:hover a{color:#fff}button:active,input[type=submit]:active{background:#6a6a6a;border-color:#6a6a6a;color:#fff}button:active a,input[type=submit]:active a{color:#fff}button:disabled,input[type=submit]:disabled{box-shadow:none;cursor:not-allowed;opacity:.4}nav ul{list-style:none;margin:0;padding:0;text-align:center}nav ul li{display:inline}nav a{-webkit-transition:.25s ease;border-bottom:2px solid transparent;border-bottom:.2rem solid transparent;color:#444;padding:8px 16px;padding:.8rem 1.6rem;text-decoration:none;transition:.25s ease}nav a:hover,nav li.selected a{border-color:rgba(0,0,0,.2)}nav a:active{border-color:rgba(0,0,0,.56)}caption{padding:8px 0;padding:.8rem 0}thead th{background:#efefef;color:#444}tr{background:#fff;margin-bottom:8px;margin-bottom:.8rem}td,th{border:1px solid #ccc;border:.1rem solid #ccc;padding:8px 16px;padding:.8rem 1.6rem;text-align:center;vertical-align:inherit}tfoot tr{background:none}tfoot td{color:#efefef;font-size:8px;font-size:.8rem;font-style:italic;padding:16px 4px;padding:1.6rem .4rem}@media screen{[hidden~=screen]{display:inherit}[hidden~=screen]:not(:active):not(:focus):not(:target){clip:rect(0)!important;position:absolute!important}}@media screen and max-width 40rem{article,aside,section{clear:both;display:block;max-width:100%}img{margin-right:1.6rem}}.media[hidden],[hidden=hidden],template{display:none}body{margin:.5em}button{background:rgba(255,255,255,.65);margin:0}table{min-width:85%;margin:0 auto}td{padding:1em;padding:10px;padding:1rem}thead td,thead th{padding:.5em;padding:5px;padding:.5rem}input[type=number]{width:4em}tbody>tr:nth-child(odd){background:#ddd}a:active,a:hover{color:#7d12db}.bracketed{color:#12db18}.bracketed,h1 a{text-shadow:1px 1px 1px #000}.bracketed:before{content:"[\00a0"}.bracketed:after{content:"\00a0]"}.bracketed:active,.bracketed:hover{color:#db7d12}.grow-1{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.flex-wrap{-ms-flex-wrap:wrap;flex-wrap:wrap}.flex-no-wrap{-ms-flex-wrap:nowrap;flex-wrap:nowrap}.flex-align-end{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}.flex-align-space-around{-ms-flex-line-pack:distribute;align-content:space-around}.flex-justify-space-around{-ms-flex-pack:distribute;justify-content:space-around}.flex-self-center{-ms-flex-item-align:center;-ms-grid-row-align:center;align-self:center}.flex{display:-webkit-box;display:-ms-flexbox;display:flex}.small-font{font-size:16px;font-size:1.6rem}.justify{text-align:justify}.align_center{text-align:center!important}.align_left{text-align:left!important}.align_right{text-align:right!important}.valign_top{vertical-align:top}.no_border{border:none}.media-wrap{text-align:center;margin:0 auto}.danger{background-color:#ff4136;border-color:#924949;color:#fff}.danger:active,.danger:hover{background-color:#924949;border-color:#ff4136;color:#fff}.user-btn{border-color:#12db18;color:#12db18;text-shadow:1px 1px 1px #000;padding:0 .5em;padding:0 5px;padding:0 .5rem}.user-btn:active,.user-btn:hover{border-color:#db7d12;background-color:#db7d12}.full_width{width:100%}.cssload-loader{position:relative;left:calc(50% - 31px);width:62px;height:62px;border-radius:50%;-webkit-perspective:780px;perspective:780px}.cssload-inner{position:absolute;width:100%;height:100%;box-sizing:border-box;border-radius:50%}.cssload-inner.cssload-one{left:0;top:0;-webkit-animation:a 1.15s linear infinite;animation:a 1.15s linear infinite;border-bottom:3px solid rgb(0,0,0)}.cssload-inner.cssload-two{right:0;top:0;-webkit-animation:b 1.15s linear infinite;animation:b 1.15s linear infinite;border-right:3px solid rgb(0,0,0)}.cssload-inner.cssload-three{right:0;bottom:0;-webkit-animation:c 1.15s linear infinite;animation:c 1.15s linear infinite;border-top:3px solid rgb(0,0,0)}@-webkit-keyframes a{0%{-webkit-transform:rotateX(35deg) rotateY(-45deg) rotate(0deg);transform:rotateX(35deg) rotateY(-45deg) rotate(0deg)}to{-webkit-transform:rotateX(35deg) rotateY(-45deg) rotate(1turn);transform:rotateX(35deg) rotateY(-45deg) rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotateX(35deg) rotateY(-45deg) rotate(0deg);transform:rotateX(35deg) rotateY(-45deg) rotate(0deg)}to{-webkit-transform:rotateX(35deg) rotateY(-45deg) rotate(1turn);transform:rotateX(35deg) rotateY(-45deg) rotate(1turn)}}@-webkit-keyframes b{0%{-webkit-transform:rotateX(50deg) rotateY(10deg) rotate(0deg);transform:rotateX(50deg) rotateY(10deg) rotate(0deg)}to{-webkit-transform:rotateX(50deg) rotateY(10deg) rotate(1turn);transform:rotateX(50deg) rotateY(10deg) rotate(1turn)}}@keyframes b{0%{-webkit-transform:rotateX(50deg) rotateY(10deg) rotate(0deg);transform:rotateX(50deg) rotateY(10deg) rotate(0deg)}to{-webkit-transform:rotateX(50deg) rotateY(10deg) rotate(1turn);transform:rotateX(50deg) rotateY(10deg) rotate(1turn)}}@-webkit-keyframes c{0%{-webkit-transform:rotateX(35deg) rotateY(55deg) rotate(0deg);transform:rotateX(35deg) rotateY(55deg) rotate(0deg)}to{-webkit-transform:rotateX(35deg) rotateY(55deg) rotate(1turn);transform:rotateX(35deg) rotateY(55deg) rotate(1turn)}}@keyframes c{0%{-webkit-transform:rotateX(35deg) rotateY(55deg) rotate(0deg);transform:rotateX(35deg) rotateY(55deg) rotate(0deg)}to{-webkit-transform:rotateX(35deg) rotateY(55deg) rotate(1turn);transform:rotateX(35deg) rotateY(55deg) rotate(1turn)}}.sorting,.sorting_asc,.sorting_desc{vertical-align:text-bottom}.sorting:before{content:" ↕\00a0"}.sorting_asc:before{content:" ↑\00a0"}.sorting_desc:before{content:" ↓\00a0"}.form{width:100%}.form thead th,.form thead tr{background:inherit;border:0}.form tr>td:nth-child(odd){text-align:right;min-width:25px;max-width:30%}.form tr>td:nth-child(2n){text-align:left;width:70%}.invisible tbody>tr:nth-child(odd){background:inherit}.invisible td,.invisible th,.invisible tr{border:0}.message{position:relative;margin:.5em auto;padding:.5em;width:95%}.message .close{width:1em;height:1em;position:absolute;right:.5em;top:.5em;text-align:center;vertical-align:middle;line-height:1em}.message:hover .close:after{content:"☒"}.message:hover{cursor:pointer}.message .icon{left:.5em;top:.5em;margin-right:1em}.message.error{border:1px solid #924949;background:#f3e6e6}.message.error .icon:after{content:"✘"}.message.success{border:1px solid #1f8454;background:#70dda9}.message.success .icon:after{content:"✔"}.message.info{border:1px solid #bfbe3a;background:#FFFFCC}.message.info .icon:after{content:"⚠"}.character,.media,.small_character{position:relative;vertical-align:top;display:inline-block;text-align:center;width:220px;height:311px;margin:.25em .125em}.character>img,.media>img,.small_character>img{width:100%}.media .edit_buttons>button{margin:.5em auto}.media_metadata>div,.medium_metadata>div,.name,.row{text-shadow:1px 2px 1px rgba(0,0,0,.85);background:#000;background:rgba(0,0,0,.45);color:#ffffff;padding:.25em .125em;text-align:right}.age_rating,.media_type{text-align:left}.media>.media_metadata{position:absolute;bottom:0;right:0}.media>.medium_metadata{position:absolute;bottom:0;left:0}.media>.name{position:absolute;top:0}.character:hover>.name,.media:hover>.media_metadata>div,.media:hover>.medium_metadata>div,.media:hover>.name,.media:hover>.table .row,.small_character:hover>.name{-webkit-transition:.25s ease;transition:.25s ease;background:rgba(0,0,0,.75)}.media:hover>.edit_buttons[hidden],.media:hover>button[hidden]{-webkit-transition:.25s ease;transition:.25s ease;display:block}.character>.name a,.character>.name a small,.media>.name a,.media>.name a small,.small_character>.name a,.small_character>.name a small{background:none;color:#fff;text-shadow:1px 2px 1px rgba(0,0,0,.85)}.anime .name,.manga .name{text-align:center;width:100%;padding:.5em .25em}.anime .age_rating,.anime .airing_status,.anime .completion,.anime .delete,.anime .edit,.anime .media_type,.anime .user_rating{background:none;text-align:center}.anime .table,.manga .table{position:absolute;bottom:0;left:0;width:100%}.anime .row,.manga .row{width:100%;background:#000;background:rgba(0,0,0,.45);display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-line-pack:distribute;align-content:space-around;-ms-flex-pack:distribute;justify-content:space-around;text-align:center;padding:0 inherit}.anime .row>span,.manga .row>span{text-align:left}.anime .row>div,.manga .row>div{font-size:.8em;display:flex-item;-ms-flex-item-align:center;align-self:center;text-align:center;vertical-align:middle}.anime .media>button.plus_one{position:absolute;top:138px;top:calc(50% - 21.5px);left:44px;left:calc(50% - 66.5px)}.manga .row{padding:1px}.manga .media{border:1px solid #ddd;height:310px;margin:.25em}.manga .media>.edit_buttons{position:absolute;top:86px;top:calc(50% - 58.5px);left:43.5px;left:calc(50% - 66.5px)}.media.search>.name{background-color:#555;background-color:rgba(0,0,0,.35);background-size:cover;background-size:contain;background-repeat:no-repeat}.big-check{display:none}.big-check:checked+label{-webkit-transition:.25s ease;transition:.25s ease;background:rgba(0,0,0,.75)}.big-check:checked+label:after{content:"✓";font-size:15em;font-size:150px;font-size:15rem;text-align:center;color:greenyellow;position:absolute;top:147px;left:0;height:100%;width:100%}#series_list article.media{position:relative}#series_list .name,#series_list .name label{position:absolute;display:block;top:0;left:0;height:100%;width:100%;vertical-align:middle;line-height:1.25em}#series_list .name small{color:#fff}.details{margin:15px auto 0;margin:1.5rem auto 0;padding:10px;padding:1rem;font-size:inherit}.description{max-width:800px;max-width:80rem}.fixed{max-width:930px;max-width:93rem}.details .cover{display:block;width:284px}.details h2{margin-top:0}.details .flex>div{margin:10px;margin:1rem}.details .media_details{max-width:300px}.details .media_details td{padding:0 15px;padding:0 1.5rem}.details p{text-align:justify}.details .media_details td:nth-child(odd){width:1%;white-space:nowrap;text-align:right}.details .media_details td:nth-child(2n){text-align:left}.character,.small_character{background:rgba(0,0,0,.5);width:225px;height:350px;vertical-align:middle;white-space:nowrap}.small_character a{display:inline-block;width:100%;height:100%}.character .name,.small_character .name{position:absolute;bottom:0;left:0;z-index:2}.character img,.small_character img{position:relative;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);z-index:1;width:100%}.min-table{min-width:0;margin-left:0}.small_character{width:160px;height:250px}.user-page .media-wrap{text-align:left}.media a{display:inline-block;width:100%;height:100%}@media screen and (max-width:40em){nav a{line-height:4em;line-height:4rem}.media{margin:2px 0}main{padding:0 0,5em .5em;padding:0 .5rem .5rem}}.streaming-logo{width:50px;height:50px;vertical-align:middle}.cover_streaming_link .streaming-logo{width:20px;height:20px} \ No newline at end of file diff --git a/public/css/marx.css b/public/css/marx.css index 426fefe8..db716220 100644 --- a/public/css/marx.css +++ b/public/css/marx.css @@ -1,5 +1,5 @@ :root { - --default-font-list:system-ui,sans-serif; + --default-font-list: system-ui,sans-serif; --monospace-font-list:'Anonymous Pro','Fira Code',Menlo,Monaco,Consolas,'Courier New',monospace; --serif-font-list:Georgia,Times,'Times New Roman',serif; -ms-text-size-adjust:100%; diff --git a/public/images/characters/.gitkeep b/public/images/characters/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/src/API/Kitsu/Model.php b/src/API/Kitsu/Model.php index e5924714..1f5d6891 100644 --- a/src/API/Kitsu/Model.php +++ b/src/API/Kitsu/Model.php @@ -829,6 +829,7 @@ class Model { } $baseData = $data['data']['attributes']; + $baseData['id'] = $data['id']; $baseData['included'] = $data['included']; return $baseData; } @@ -864,6 +865,7 @@ class Model { } $baseData = $data['data'][0]['attributes']; + $baseData['id'] = $data['data'][0]['id']; $baseData['included'] = $data['included']; return $baseData; } diff --git a/src/API/Kitsu/Transformer/AnimeTransformer.php b/src/API/Kitsu/Transformer/AnimeTransformer.php index 42323166..b04a8c73 100644 --- a/src/API/Kitsu/Transformer/AnimeTransformer.php +++ b/src/API/Kitsu/Transformer/AnimeTransformer.php @@ -36,10 +36,11 @@ class AnimeTransformer extends AbstractTransformer { $item['included'] = JsonAPI::organizeIncludes($item['included']); $item['genres'] = array_column($item['included']['genres'], 'name') ?? []; sort($item['genres']); - + $titles = Kitsu::filterTitles($item); return [ + 'id' => $item['id'], 'slug' => $item['slug'], 'title' => $titles[0], 'titles' => $titles, diff --git a/src/Controller/Index.php b/src/Controller/Index.php index 411aac26..79555f73 100644 --- a/src/Controller/Index.php +++ b/src/Controller/Index.php @@ -16,10 +16,16 @@ namespace Aviat\AnimeClient\Controller; +use function Amp\wait; + +use Amp\Artax\Client; use Aviat\AnimeClient\Controller as BaseController; use Aviat\AnimeClient\API\JsonAPI; use Aviat\Ion\View\HtmlView; +/** + * Controller for handling routes that don't fit elsewhere + */ class Index extends BaseController { /** @@ -113,6 +119,44 @@ class Index extends BaseController { ]); } + /** + * Get image covers from kitsu + * + * @return void + */ + public function images($type, $file) + { + $kitsuUrl = 'https://media.kitsu.io/'; + list($id, $ext) = explode('.', basename($file)); + switch ($type) + { + case 'anime': + $kitsuUrl .= "anime/poster_images/{$id}/small.{$ext}"; + break; + + case 'manga': + $kitsuUrl .= "manga/poster_images/{$id}/small.{$ext}"; + break; + + case 'characters': + $kitsuUrl .= "characters/images/{$id}/original.{$ext}"; + break; + + default: + $this->notFound(); + return; + } + + $promise = (new Client)->request($kitsuUrl); + $response = wait($promise); + $data = (string) $response->getBody(); + + $baseSavePath = $this->config->get('img_cache_path'); + file_put_contents("{$baseSavePath}/{$type}/{$id}.{$ext}", $data); + header('Content-type: ' . $response->getHeader('content-type')[0]); + echo (string) $response->getBody(); + } + private function organizeFavorites(array $rawfavorites): array { // return $rawfavorites; diff --git a/tests/API/Kitsu/Transformer/AnimeTransformerTest.php b/tests/API/Kitsu/Transformer/AnimeTransformerTest.php index cb761d35..d9b84a8e 100644 --- a/tests/API/Kitsu/Transformer/AnimeTransformerTest.php +++ b/tests/API/Kitsu/Transformer/AnimeTransformerTest.php @@ -22,29 +22,27 @@ use Aviat\Ion\Friend; use Aviat\Ion\Json; class AnimeTransformerTest extends AnimeClientTestCase { - + protected $dir; protected $beforeTransform; protected $afterTransform; protected $transformer; - + public function setUp() { parent::setUp(); $this->dir = AnimeClientTestCase::TEST_DATA_DIR . '/Kitsu'; - + $this->beforeTransform = Json::decodeFile("{$this->dir}/animeBeforeTransform.json"); - $this->afterTransform = Json::decodeFile("{$this->dir}/animeAfterTransform.json"); - + $this->transformer = new AnimeTransformer(); } - + public function testTransform() { $expected = $this->afterTransform; $actual = $this->transformer->transform($this->beforeTransform); - // Json::encodeFile("{$this->dir}/animeAfterTransform.json", $actual); - - $this->assertEquals($expected, $actual); + + $this->assertMatchesSnapshot($actual); } } \ No newline at end of file diff --git a/tests/API/Kitsu/Transformer/__snapshots__/AnimeTransformerTest__testTransform__1.php b/tests/API/Kitsu/Transformer/__snapshots__/AnimeTransformerTest__testTransform__1.php new file mode 100644 index 00000000..36bc8262 --- /dev/null +++ b/tests/API/Kitsu/Transformer/__snapshots__/AnimeTransformerTest__testTransform__1.php @@ -0,0 +1,104 @@ + 32344, + 'slug' => 'attack-on-titan', + 'title' => 'Attack on Titan', + 'titles' => + array ( + 0 => 'Attack on Titan', + 1 => 'Shingeki no Kyojin', + 2 => '進撃の巨人', + ), + 'status' => 'Finished Airing', + 'cover_image' => 'https://media.kitsu.io/anime/poster_images/7442/small.jpg?1418580054', + 'show_type' => 'TV', + 'episode_count' => 25, + 'episode_length' => 24, + 'synopsis' => 'Several hundred years ago, humans were nearly exterminated by titans. Titans are typically several stories tall, seem to have no intelligence, devour human beings and, worst of all, seem to do it for the pleasure rather than as a food source. A small percentage of humanity survived by enclosing themselves in a city protected by extremely high walls, even taller than the biggest of titans. Flash forward to the present and the city has not seen a titan in over 100 years. Teenage boy Eren and his foster sister Mikasa witness something horrific as the city walls are destroyed by a colossal titan that appears out of thin air. As the smaller titans flood the city, the two kids watch in horror as their mother is eaten alive. Eren vows that he will murder every single titan and take revenge for all of mankind. + +(Source: ANN)', + 'age_rating' => 'R', + 'age_rating_guide' => 'Violence, Profanity', + 'url' => 'https://kitsu.io/anime/attack-on-titan', + 'genres' => + array ( + 0 => 'Action', + 1 => 'Drama', + 2 => 'Fantasy', + 3 => 'Super Power', + ), + 'streaming_links' => + array ( + 0 => + array ( + 'meta' => + array ( + 'name' => 'Crunchyroll', + 'link' => true, + 'image' => 'streaming-logos/crunchyroll.svg', + ), + 'link' => 'http://www.crunchyroll.com/attack-on-titan', + 'subs' => + array ( + 0 => 'en', + ), + 'dubs' => + array ( + 0 => 'ja', + ), + ), + 1 => + array ( + 'meta' => + array ( + 'name' => 'Hulu', + 'link' => true, + 'image' => 'streaming-logos/hulu.svg', + ), + 'link' => 'http://www.hulu.com/attack-on-titan', + 'subs' => + array ( + 0 => 'en', + ), + 'dubs' => + array ( + 0 => 'ja', + ), + ), + 2 => + array ( + 'meta' => + array ( + 'name' => 'Funimation', + 'link' => true, + 'image' => 'streaming-logos/funimation.svg', + ), + 'link' => 'http://www.funimation.com/shows/attack-on-titan/videos/episodes', + 'subs' => + array ( + 0 => 'en', + ), + 'dubs' => + array ( + 0 => 'ja', + ), + ), + 3 => + array ( + 'meta' => + array ( + 'name' => 'Netflix', + 'link' => false, + 'image' => 'streaming-logos/netflix.svg', + ), + 'link' => 't', + 'subs' => + array ( + 0 => 'en', + ), + 'dubs' => + array ( + 0 => 'ja', + ), + ), + ), +); diff --git a/tests/test_data/Kitsu/animeBeforeTransform.json b/tests/test_data/Kitsu/animeBeforeTransform.json index 2a996e20..e64bc419 100644 --- a/tests/test_data/Kitsu/animeBeforeTransform.json +++ b/tests/test_data/Kitsu/animeBeforeTransform.json @@ -1,4 +1,5 @@ { + "id": 32344, "slug": "attack-on-titan", "synopsis": "Several hundred years ago, humans were nearly exterminated by titans. Titans are typically several stories tall, seem to have no intelligence, devour human beings and, worst of all, seem to do it for the pleasure rather than as a food source. A small percentage of humanity survived by enclosing themselves in a city protected by extremely high walls, even taller than the biggest of titans. Flash forward to the present and the city has not seen a titan in over 100 years. Teenage boy Eren and his foster sister Mikasa witness something horrific as the city walls are destroyed by a colossal titan that appears out of thin air. As the smaller titans flood the city, the two kids watch in horror as their mother is eaten alive. Eren vows that he will murder every single titan and take revenge for all of mankind.\n\n(Source: ANN)", "coverImageTopOffset": 263,