mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Compare commits
3 Commits
2f74cfb42c
...
fde4962ce3
Author | SHA1 | Date | |
---|---|---|---|
|
fde4962ce3 | ||
|
25019efda2 | ||
|
d14d3e607d |
@ -107,4 +107,7 @@ return [
|
||||
// Not directly used but available for convenience to users.
|
||||
'privacy_policy' => 'Privacy Policy',
|
||||
'terms_of_service' => 'Terms of Service',
|
||||
|
||||
// OpenSearch
|
||||
'opensearch_description' => 'Search :appName',
|
||||
];
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
|
||||
<ShortName>{{ mb_strimwidth(setting('app-name'), 0, 16) }}</ShortName>
|
||||
<Description>Search {{ setting('app-name') }}</Description>
|
||||
<Description>{{ trans('common.opensearch_description', ['appName' => setting('app-name')]) }}</Description>
|
||||
<Image width="256" height="256" type="image/png">{{ setting('app-icon') ?: url('/icon.png') }}</Image>
|
||||
<Image width="180" height="180" type="image/png">{{ setting('app-icon-180') ?: url('/icon-180.png') }}</Image>
|
||||
<Image width="128" height="128" type="image/png">{{ setting('app-icon-128') ?: url('/icon-128.png') }}</Image>
|
||||
|
3
storage/framework/cache/.gitignore
vendored
3
storage/framework/cache/.gitignore
vendored
@ -1,3 +0,0 @@
|
||||
*
|
||||
!data/
|
||||
!.gitignore
|
2
storage/framework/views/.gitignore
vendored
2
storage/framework/views/.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
*
|
||||
!.gitignore
|
42
tests/OpensearchTest.php
Normal file
42
tests/OpensearchTest.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Tests;
|
||||
|
||||
class OpensearchTest extends TestCase
|
||||
{
|
||||
public function test_opensearch_endpoint()
|
||||
{
|
||||
$appName = setting('app-name');
|
||||
$resultUrl = url('/search') . '?term={searchTerms}';
|
||||
$selfUrl = url('/opensearch.xml');
|
||||
|
||||
$resp = $this->get('/opensearch.xml');
|
||||
$resp->assertOk();
|
||||
|
||||
$html = $this->withHtml($resp);
|
||||
|
||||
$html->assertElementExists('OpenSearchDescription > ShortName');
|
||||
$html->assertElementContains('OpenSearchDescription > ShortName', mb_strimwidth($appName, 0, 16));
|
||||
|
||||
$html->assertElementExists('OpenSearchDescription > Description');
|
||||
$html->assertElementContains('OpenSearchDescription > Description', trans('common.opensearch_description', [
|
||||
'appName' => $appName,
|
||||
]));
|
||||
|
||||
$html->assertElementExists('OpenSearchDescription > Image');
|
||||
|
||||
$html->assertElementExists('OpenSearchDescription > Url[rel="results"][template="' . htmlspecialchars($resultUrl) . '"]');
|
||||
$html->assertElementExists('OpenSearchDescription > Url[rel="self"][template="' . htmlspecialchars($selfUrl) . '"]');
|
||||
}
|
||||
|
||||
public function test_opensearch_linked_to_from_home()
|
||||
{
|
||||
$appName = setting('app-name');
|
||||
$endpointUrl = url('/opensearch.xml');
|
||||
|
||||
$resp = $this->asViewer()->get('/');
|
||||
$html = $this->withHtml($resp);
|
||||
|
||||
$html->assertElementExists('head > link[rel="search"][type="application/opensearchdescription+xml"][title="' . htmlspecialchars($appName) . '"][href="' . htmlspecialchars($endpointUrl) . '"]');
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user