diff --git a/assets/css/styles.css b/assets/css/styles.css index ca1d095..654f077 100644 --- a/assets/css/styles.css +++ b/assets/css/styles.css @@ -23,8 +23,8 @@ button { cursor:pointer; } a { text-decoration:none; color:var(--link); } a:hover { text-decoration:underline; } small { padding:5px 0; color:var(--meta); font-size:.8rem; } - input[type="text"]:invalid ~ input[type="submit"] { opacity:0.5; pointer-events:none; } + input[type="search"]::-webkit-search-cancel-button { -webkit-appearance:none; -webkit-mask-image:url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pjxzdmcgdmlld0JveD0iMCAwIDI0IDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xMy40MSwxMmw0LjMtNC4yOWExLDEsMCwxLDAtMS40Mi0xLjQyTDEyLDEwLjU5LDcuNzEsNi4yOUExLDEsMCwwLDAsNi4yOSw3LjcxTDEwLjU5LDEybC00LjMsNC4yOWExLDEsMCwwLDAsMCwxLjQyLDEsMSwwLDAsMCwxLjQyLDBMMTIsMTMuNDFsNC4yOSw0LjNhMSwxLDAsMCwwLDEuNDIsMCwxLDEsMCwwLDAsMC0xLjQyWiIgZmlsbD0iIzY1NjNmZiIvPjwvc3ZnPg=="); } /* Page structure */ diff --git a/engines/special/definition.php b/engines/special/definition.php index 24901f7..d16ac84 100644 --- a/engines/special/definition.php +++ b/engines/special/definition.php @@ -46,7 +46,7 @@ public function parse_results($response) { if(empty($json_response)) return $engine_result; // No results - if(array_key_exists('title', $json_response)) return $engine_result; + if(!array_key_exists('title', $json_response)) return $engine_result; // Grab first result if there are multiple $result = $json_response[0]; diff --git a/engines/special/php.php b/engines/special/php.php index a8b2042..d6723c7 100644 --- a/engines/special/php.php +++ b/engines/special/php.php @@ -12,13 +12,15 @@ class PHPnetRequest extends EngineRequest { public function get_request_url() { $query = str_replace('%22', '\"', $this->query); + + // Format query/url for php.net $query = str_replace('php ', '', $query); $query = str_replace('_', '-', $query); // Is there no query left? Bail! if(empty($query)) return false; - $url = 'https://www.php.net/manual/function.'.urlencode($query); + $url = 'https://www.php.net/manual/function.'.urlencode($query).'.php'; unset($query); @@ -61,7 +63,7 @@ public function parse_results($response) { // Required 'title' => "Function: ".sanitize($title), 'text' => "

".sanitize($php_versions)."

".sanitize($purpose)."

".highlight_string("", 1)."

".$summary."

", - 'source' => "https://www.php.net/manual/function.".urlencode($query) + 'source' => "https://www.php.net/manual/function.".urlencode($query).".php" ); } unset($response, $xpath, $scrape); diff --git a/functions/tools-update.php b/functions/tools-update.php index 2f5faee..78684fb 100644 --- a/functions/tools-update.php +++ b/functions/tools-update.php @@ -17,7 +17,7 @@ function check_update() { $cache_file = ABSPATH.'cache/version.data'; // Currently installed version - $current_version = "1.5"; + $current_version = "1.5.1"; if(!is_file($cache_file)) { // Create update cache file if it doesn't exist @@ -28,6 +28,9 @@ function check_update() { $version = unserialize(file_get_contents($cache_file)); } + // TODO: Remove in a future version + if(!isset($version['current'])) $version['current'] = "1.5.1"; + // Update check, every week if($version['checked'] < time() - 604800) { $response = do_curl_request( @@ -58,7 +61,7 @@ function show_version() { $version = unserialize(file_get_contents($cache_file)); // TODO: Remove in a future version - if(!isset($version['current'])) $version['current'] = "1.5"; + if(!isset($version['current'])) $version['current'] = "1.5.1"; // Format current version for footer $show_version = "Goosle ".$version['current']."."; diff --git a/goosle-cron.php b/goosle-cron.php index aa2b4e2..0000dcb 100644 --- a/goosle-cron.php +++ b/goosle-cron.php @@ -26,7 +26,7 @@ if(verify_hash($opts->hash_auth, $opts->hash, $auth)) { // Check for updates check_update(); - echo "Update cached updated!
"; + echo "Update cache updated!
"; // Clear out old cached files? if($opts->cache_type == 'file') { @@ -45,19 +45,27 @@ // Is the token expired? if($registration['expires'] < time()) { - $new_token = do_curl_request( + $response = do_curl_request( 'https://api.openverse.org/v1/auth_tokens/token/', // (string) Where? array('Accept: application/json, */*;q=0.8', 'User-Agent: '.$opts->user_agents[0].';', 'Authorization: Bearer'.$registration['client_id']), // (array) Headers 'post', // (string) post/get array('grant_type' => 'client_credentials', 'client_id' => $registration['client_id'], 'client_secret' => $registration['client_secret']) // (assoc array) Post body ); - $new_token = json_decode($new_token, true); + $json_response = json_decode($response, true); - $new_token['expires_in'] = time() + ($new_token['expires_in'] - 3600); - - oauth_store_token($token_file, 'openverse', array('client_id' => $registration['client_id'], 'client_secret' => $registration['client_secret'], 'access_token' => $new_token['access_token'], 'expires' => $new_token['expires_in'])); - - echo "New Openverse token stored!
"; + // Got a response + if(!empty($json_response)) { + // Got some data? + if(array_key_exists('access_token', $json_response)) { + + $json_response['expires_in'] = time() + ($json_response['expires_in'] - 3600); + + oauth_store_token($token_file, 'openverse', array('client_id' => $registration['client_id'], 'client_secret' => $registration['client_secret'], 'access_token' => $json_response['access_token'], 'expires' => $json_response['expires_in'])); + + echo "New Openverse token stored!
"; + } + } + unset($response, $json_response); } } } diff --git a/help.php b/help.php index e1656e6..0078711 100644 --- a/help.php +++ b/help.php @@ -170,8 +170,7 @@

Most browsers ask that you add %s for the search query as shown in the examples. If your browser has a different value for this simply replace %s with what your browser requires.

Colorschemes

-

Goose comes with several colorschemes. If you don't like the selected colorscheme you can override it with the c argument in your search url. For example: https://example.com/?c=dark.

-

You can add this to your bookmark too to always override the colorscheme.

+

Goose comes with several colorschemes, configurable through the config.php file.

Available colorschemes are:

    diff --git a/index.php b/index.php index d0466c6..5caf19e 100644 --- a/index.php +++ b/index.php @@ -50,7 +50,7 @@

    Goosle

    - +
    diff --git a/readme.md b/readme.md index 33dea2c..60ffed6 100644 --- a/readme.md +++ b/readme.md @@ -124,7 +124,13 @@ You can post your questions on Github Discussions or say hi on [Mastodon](https: - Sometimes TV Show episodes on the box office are not properly merged despite all required data matching. ## Changelog -1.5 - June ??, 2024 +1.5.1 - June 22, 2024 +- [fix] Updated help.php, removed incorrect colorscheme information +- [fix] Typo in text output for goosle-cron.php +- [fix] Various php errors/warnings in goosle-cron.php +- [fix] Url formatting for php function special searches + +1.5 - June 19, 2024 - NOTICE: config.default.php has changed, re-create your config.php!! - [fix] No longer caches empty results - [fix] No longer make a request if the search query is empty