Cleanup config a bit

This commit is contained in:
Timothy Warren 2018-08-24 14:23:01 -04:00
parent 0cb09dc4b8
commit 45b545d32d
6 changed files with 40 additions and 7 deletions

View File

@ -43,7 +43,6 @@ Update your anime/manga list on Kitsu.io and MyAnimeList.net
3. Configure settings in `app/config/config.toml` to your liking 3. Configure settings in `app/config/config.toml` to your liking
4. Create the following directories if they don't exist, and make sure they are world writable 4. Create the following directories if they don't exist, and make sure they are world writable
* app/logs * app/logs
* public/js/cache
* public/images/avatars * public/images/avatars
* public/images/anime * public/images/anime
* public/images/characters * public/images/characters

View File

@ -28,6 +28,8 @@ $tomlConfig = loadToml(__DIR__);
return array_merge($tomlConfig, [ return array_merge($tomlConfig, [
'asset_dir' => "{$ROOT_DIR}/public", 'asset_dir' => "{$ROOT_DIR}/public",
'base_config_dir' => __DIR__,
'config_dir' => "{$APP_DIR}/config",
// Template file path // Template file path
'view_path' => "{$APP_DIR}/views", 'view_path' => "{$APP_DIR}/views",

View File

@ -215,6 +215,12 @@ return [
'controller' => DEFAULT_CONTROLLER, 'controller' => DEFAULT_CONTROLLER,
'verb' => 'get', 'verb' => 'get',
], ],
'settings-post' => [
'path' => '/settings',
'action' => 'settings',
'controller' => DEFAULT_CONTROLLER,
'verb' => 'post',
],
'login' => [ 'login' => [
'path' => '/login', 'path' => '/login',
'action' => 'login', 'action' => 'login',

View File

@ -15,5 +15,3 @@ default_list = "anime" # anime or manga
default_anime_list_path = "watching" # watching|plan_to_watch|on_hold|dropped|completed|all default_anime_list_path = "watching" # watching|plan_to_watch|on_hold|dropped|completed|all
default_manga_list_path = "reading" # reading|plan_to_read|on_hold|dropped|completed|all default_manga_list_path = "reading" # reading|plan_to_read|on_hold|dropped|completed|all
# Default view type (cover_view/list_view)
default_view_type = "cover_view"

View File

@ -1,4 +1,4 @@
<?php declare(strict_types=1); <?php
/** /**
* Hummingbird Anime List Client * Hummingbird Anime List Client
* *
@ -51,6 +51,7 @@ use Amp\Socket\{
use Amp\Uri\{ use Amp\Uri\{
InvalidUriException, Uri InvalidUriException, Uri
}; };
use const Aviat\AnimeClient\USER_AGENT;
use function Amp\{ use function Amp\{
asyncCall, call asyncCall, call
}; };
@ -63,7 +64,7 @@ use function Amp\{
* @see Client * @see Client
*/ */
final class HummingbirdClient implements Client { final class HummingbirdClient implements Client {
const DEFAULT_USER_AGENT = 'Hummingbird Anime Client/5.0'; const DEFAULT_USER_AGENT = USER_AGENT;
private $cookieJar; private $cookieJar;
private $socketPool; private $socketPool;

View File

@ -19,7 +19,7 @@ namespace Aviat\AnimeClient\Types;
use ArrayAccess; use ArrayAccess;
use LogicException; use LogicException;
class AbstractType implements ArrayAccess { abstract class AbstractType implements ArrayAccess {
/** /**
* Populate values for unserializing data * Populate values for unserializing data
* *
@ -154,4 +154,31 @@ class AbstractType implements ArrayAccess {
unset($this->$offset); unset($this->$offset);
} }
} }
/**
* Recursively cast properties to an array
*
* @param null $parent
* @return mixed
*/
public function toArray($parent = null)
{
$object = $parent ?? $this;
if (is_scalar($object))
{
return $object;
}
$output = [];
foreach ($object as $key => $value)
{
$output[$key] = is_scalar($value)
? $value
: $this->toArray((array) $value);
}
return $output;
}
} }