Fix a bug where searching in web app using iOS causes page to reload (#645)
* Fix a bug where searching in web app using iOS causes page to reload * Add cors handler in prod
This commit is contained in:
1 parent
06326d084e
commit
58e2b48409
4 files changed
+18
-1
No files matched your search
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Fixed
|
||||
|
||||
- A bug where it says "(Failed to load)" when switching profiles
|
||||
- A bug where searching in web app using iOS causes page to reload
|
||||
|
||||
### Changed
|
||||
|
||||
|
||||
@@ -40,6 +40,8 @@ function SetupRoutes(server as object)
|
||||
#if DEBUG
|
||||
'CORS is mostly for developing the web app
|
||||
server.UseRouter(new Http.CorsMiddleware())
|
||||
#else
|
||||
server.UseRouter(new Http.CorsMiddleware(""))
|
||||
#end if
|
||||
if server.settings.WebSocketsEnabled
|
||||
server.UseRouter(new Http.WebSocketMiddleware())
|
||||
|
||||
@@ -20,9 +20,17 @@ namespace Http
|
||||
request = context.request
|
||||
response = context.response
|
||||
|
||||
if not StringUtils.IsNullOrEmpty(m.origin)
|
||||
response.headers["Access-Control-Allow-Origin"] = m.origin
|
||||
end if
|
||||
|
||||
if not StringUtils.IsNullOrEmpty(m.headers)
|
||||
response.headers["Access-Control-Allow-Headers"] = m.headers
|
||||
end if
|
||||
|
||||
if not StringUtils.IsNullOrEmpty(m.methods)
|
||||
response.headers["Access-Control-Allow-Methods"] = m.methods
|
||||
end if
|
||||
|
||||
if request.method = "OPTIONS"
|
||||
response.header_only = true
|
||||
|
||||
@@ -99,6 +99,8 @@
|
||||
|
||||
try {
|
||||
isLoading = true;
|
||||
// blur to hide the keyboard on mobile
|
||||
searchBox.blur();
|
||||
const response = await invidiousApi.search(
|
||||
searchBoxText,
|
||||
searchFilters,
|
||||
@@ -120,7 +122,7 @@
|
||||
|
||||
<div class={visibility ? "" : "hidden"}>
|
||||
<div class="m-4">
|
||||
<!-- TODO:P2 use search HTML element -->
|
||||
<search>
|
||||
<form
|
||||
on:submit={async (e) => {
|
||||
e.preventDefault();
|
||||
@@ -148,6 +150,7 @@
|
||||
}}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
class="join-item btn w-16"
|
||||
on:click={async () => {
|
||||
page = 1;
|
||||
@@ -161,6 +164,7 @@
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="btn border border-neutral rounded-full mt-1"
|
||||
on:click={searchFiltersComponent.show()}
|
||||
>
|
||||
@@ -187,6 +191,7 @@
|
||||
</ul>
|
||||
{/if}
|
||||
</form>
|
||||
</search>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@@ -207,6 +212,7 @@
|
||||
{#if !isLoading && videos.length > 0 && searchBoxText}
|
||||
<div class="flex justify-center items-center">
|
||||
<button
|
||||
type="button"
|
||||
class="btn w-1/2"
|
||||
on:click={async () => {
|
||||
page++;
|
||||
|
||||
Reference in new issue
Block a user