Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
5 changed files with 21 additions and 10 deletions
Showing only changes of commit 07cae83e15 - Show all commits

View File

@ -30,7 +30,7 @@ return array_merge($tomlConfig, [
'asset_dir' => "{$ROOT_DIR}/public", 'asset_dir' => "{$ROOT_DIR}/public",
'base_config_dir' => __DIR__, 'base_config_dir' => __DIR__,
'config_dir' => "{$APP_DIR}/config", 'config_dir' => "{$APP_DIR}/config",
// No config defaults // No config defaults
'kitsu_username' => 'timw4mail', 'kitsu_username' => 'timw4mail',
'whose_list' => 'Someone', 'whose_list' => 'Someone',
@ -38,6 +38,7 @@ return array_merge($tomlConfig, [
'connection' => [], 'connection' => [],
'driver' => 'null', 'driver' => 'null',
], ],
'secure_urls' => TRUE,
// Routing defaults // Routing defaults
'asset_path' => '/public', 'asset_path' => '/public',

View File

@ -23,4 +23,14 @@ default_list = "anime" # anime or manga
# Default pages for anime/manga # Default pages for anime/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
################################################################################
# Not on Settings Page
#
# These settings are not available to change on the settings page
################################################################################
# Use HTTPs for URLs
# It is not recommended to change this setting
secure_urls = true

View File

@ -29,6 +29,7 @@ class Config extends AbstractType {
public $default_manga_list_path; public $default_manga_list_path;
public $default_view_type; public $default_view_type;
public $kitsu_username; public $kitsu_username;
public $secure_urls = TRUE;
public $show_anime_collection; public $show_anime_collection;
public $show_manga_collection; public $show_manga_collection;
public $whose_list; public $whose_list;

View File

@ -34,19 +34,20 @@ class UrlGenerator extends RoutingBase {
* Constructor * Constructor
* *
* @param ContainerInterface $container * @param ContainerInterface $container
* @throws \Aviat\Ion\Di\ContainerException * @throws \Aviat\Ion\Di\Exception\ContainerException
* @throws \Aviat\Ion\Di\NotFoundException * @throws \Aviat\Ion\Di\Exception\NotFoundException
*/ */
public function __construct(ContainerInterface $container) public function __construct(ContainerInterface $container)
{ {
parent::__construct($container); parent::__construct($container);
$this->host = $container->get('request')->getServerParams()['HTTP_HOST']; $this->host = $container->get('request')->getServerParams()['HTTP_HOST'];
} }
/** /**
* Get the base url for css/js/images * Get the base url for css/js/images
* *
* @param string[] ...$args * @param string ...$args
* @return string * @return string
*/ */
public function assetUrl(string ...$args): string public function assetUrl(string ...$args): string
@ -88,9 +89,7 @@ class UrlGenerator extends RoutingBase {
} }
$path = implode('/', $path_segments); $path = implode('/', $path_segments);
$isHttps = $_SERVER['SERVER_PORT'] === '443' || isset($_SERVER['HTTPS']); $scheme = $this->config->get('secure_urls') !== FALSE ? 'https:' : 'http:';
$scheme = ($isHttps) ? 'https:' : 'http:';
return "{$scheme}//{$this->host}/{$path}"; return "{$scheme}//{$this->host}/{$path}";
} }

View File

@ -28,13 +28,13 @@ class UrlGeneratorTest extends AnimeClientTestCase {
'args' => [ 'args' => [
'images' 'images'
], ],
'expected' => 'http://localhost/assets/images', 'expected' => 'https://localhost/assets/images',
], ],
'multiple arguments' => [ 'multiple arguments' => [
'args' => [ 'args' => [
'images', 'anime', 'foo.png' 'images', 'anime', 'foo.png'
], ],
'expected' => 'http://localhost/assets/images/anime/foo.png' 'expected' => 'https://localhost/assets/images/anime/foo.png'
] ]
]; ];
} }