diff options
author | Yorhel <git@yorhel.nl> | 2021-01-10 12:29:52 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2021-01-10 12:29:52 +0100 |
commit | bc87360592b827abd454b3c2fc9697ceb66e0148 (patch) | |
tree | 12169043a46d1be8dc7a71e239a15b523eeb42e0 /lib/VNWeb | |
parent | a9812a77315b9d9a77f6be663bb46b0425e3b7bb (diff) |
v2rw: Convert /opensearch.xml description + ancient typo fix
Diffstat (limited to 'lib/VNWeb')
-rw-r--r-- | lib/VNWeb/HTML.pm | 2 | ||||
-rw-r--r-- | lib/VNWeb/Misc/OpenSearch.pm | 22 |
2 files changed, 23 insertions, 1 deletions
diff --git a/lib/VNWeb/HTML.pm b/lib/VNWeb/HTML.pm index 9d4c82fb..cb6c01e9 100644 --- a/lib/VNWeb/HTML.pm +++ b/lib/VNWeb/HTML.pm @@ -165,7 +165,7 @@ sub _head_ { base_ href => tuwf->reqURI(); link_ rel => 'shortcut icon', href => '/favicon.ico', type => 'image/x-icon'; link_ rel => 'stylesheet', href => config->{url_static}.'/s/'.$skin.'/style.css?'.config->{version}, type => 'text/css', media => 'all'; - link_ rel => 'search', type => 'application/opensearchdescription+xml', title => 'VNDB VN Search', href => tuwf->reqBaseURI().'/opensearch.xml'; + link_ rel => 'search', type => 'application/opensearchdescription+xml', title => 'VNDB Visual Novel Search', href => tuwf->reqBaseURI().'/opensearch.xml'; style_ type => 'text/css', sub { lit_ _sanitize_css $customcss } if $customcss; if($o->{feeds}) { link_ rel => 'alternate', type => 'application/atom+xml', href => "/feeds/announcements.atom", title => 'Site Announcements'; diff --git a/lib/VNWeb/Misc/OpenSearch.pm b/lib/VNWeb/Misc/OpenSearch.pm new file mode 100644 index 00000000..1f74496b --- /dev/null +++ b/lib/VNWeb/Misc/OpenSearch.pm @@ -0,0 +1,22 @@ +package VNWeb::Misc::OpenSearch; + +use VNWeb::Prelude; +use TUWF::XML 'xml', 'tag'; + +TUWF::get qr{/opensearch\.xml}, sub { + my $h = tuwf->reqBaseURI; + tuwf->resHeader('Content-Type' => 'application/opensearchdescription+xml'); + xml; + tag 'OpenSearchDescription', xmlns => 'http://a9.com/-/spec/opensearch/1.1/', 'xmlns:moz' => 'http://www.mozilla.org/2006/browser/search/', sub { + tag 'ShortName', 'VNDB'; + tag 'LongName', 'VNDB.org Visual Vovel Search'; + tag 'Description', 'Search visual novels on VNDB.org'; + tag 'Image', width => 16, height => 16, type => 'image/x-icon', "$h/favicon.ico"; + tag 'Url', type => 'text/html', method => 'get', template => "$h/v?q={searchTerms}", undef; + tag 'Url', type => 'application/opensearchdescription+xml', rel => 'self', template => "$h/opensearch.xml", undef; + tag 'Query', role => 'example', searchTerms => 'Tsukihime', undef; + tag 'moz:SearchForm', "$h/v"; + } +}; + +1; |