Popular New Releases in Progressive Web Application
ambianic-ui
v2.23.1
create-pwa
Fix current working directory
Mono-PWA
3.4.2 Hotfix 1
frappe_pwa
1.0.2
Popular Libraries in Progressive Web Application
by vaadin html
353 Apache-2.0
Progressive Web App (PWA) demo using Vaadin components
by jfadev javascript
248 MIT
⚡️ PWA Features to Any Website (very Fast & Easy)
by dr-mod python
246 MIT
Bitcoin stock price for RPi Zero
by johnpapa typescript
209
PWA Example
by IncredibleWeb javascript
183 MIT
A demo application that serves as a tutorial for Progressive Web Applications
by alienzhou javascript
167
📱some samples and blogs about how to start with your first PWA
by iondrimba javascript
143 MIT
⛅️ PWA Weather App made with ReactJS
by lavas-project javascript
122 GPL-3.0
这是一本 PWA 相关的书籍
by iondrimba javascript
112 MIT
:radio: PWA Music Player made with Reactjs
Trending New libraries in Progressive Web Application
by dr-mod python
246 MIT
Bitcoin stock price for RPi Zero
by pwa-builder typescript
33 MIT
A web component that adds a 2D inking canvas (and optional toolbar) to your PWA 🎨 ✨
by vinitshahdeo javascript
29 MIT
A simple Progressive Web App that brought news from a variety of sources using News API.
by CodeupClassroom html
22
This is a repository for Jupiter's exercises at Codeup
by webmaxru typescript
14
A demo application for "Automating a service worker with Workbox 6" tech talk
by Monogramm python
12 NOASSERTION
:snake: :alembic: PWA setup for Frappe website.
by GoogleChromeLabs javascript
11 Apache-2.0
by devpato javascript
7 Apache-2.0
by lecepin html
7
《PWA 入门与实践》图书代码
Top Authors in Progressive Web Application
1
4 Libraries
11
2
2 Libraries
250
3
2 Libraries
12
4
2 Libraries
255
5
1 Libraries
4
6
1 Libraries
2
7
1 Libraries
12
8
1 Libraries
2
9
1 Libraries
2
10
1 Libraries
2
1
4 Libraries
11
2
2 Libraries
250
3
2 Libraries
12
4
2 Libraries
255
5
1 Libraries
4
6
1 Libraries
2
7
1 Libraries
12
8
1 Libraries
2
9
1 Libraries
2
10
1 Libraries
2
Trending Kits in Progressive Web Application
The use of Java PWA libraries is recommended because it is a very powerful tool to make your website look and perform better than any other website. It allows you to add all the features that you need on a single page without having to install another app or another browser. It also gives you a great opportunity to learn about how data is stored on your device and how it can be used to improve the performance of your website. The best thing about using these tools is that they are free, so there's no need to worry about spending money on them. Capacitor library provides a set of custom components to make your web application more secure, fast and easy to develop. It also helps in building a native look & feel for your application. CodenameOne library has multiple features like data binding, offline support, authentication etc. which makes it easier to develop responsive web apps with no coding involved. Android SmartWebView is an open source project created by Google that allows developers to utilize their own custom UI components in their mobile apps without having them be compiled into a binary format or making them available as part of the APK file itself. This Open Source project was renamed as Android-SmartWebView in 2019 for better clarity. Android-PWA-Wrapper is another library that helps to create your PWA in a very easy way. It comes with a simple to use builder that allows you to integrate the app with any third party app.
Trending Discussions on Progressive Web Application
django pwa error = cannot import name 'url' from 'django.conf.urls
Minimum Chrome version for TWA - options?
Blazor WASM 6.0.0-preview.7.21378.6, Visual Studio 2022 preview 3.1
Dotnet React Template - is it possible to use /index.html
Blazor WASM Project Referencing Error (BLAZORSDK1001)
Unable to hit breakpoints in Blazor WASM
Does a service worker need to cache manifest icons that are not used by the core of the PWA?
How do I change the "Authorising..." message that appears when a Blazor PWA application is being refreshed?
Migrating Chrome USB App API to Web USB API
No Manifest Detected on a PHP Progressive Web Application
QUESTION
django pwa error = cannot import name 'url' from 'django.conf.urls
Asked 2022-Apr-02 at 01:49Hello I am using Django 4.0.3
and I try to use django-pwa
in my project but when i runserver i get the below error.
I followed this tutorial geeksforgeeks:make-pwa-of-a-django-project for including progressive web application feature in my project.
I think url
from django.conf.urls
is deprecated.
I am sure that must exist some solutions...
Help me please.
Error
1File "C:\Users\Republic Of Computer\Desktop\Master cours et TD\python\tberra3lipy\venv\lib\site-packages\pwa\urls.py", line 1, in <module>
2 from django.conf.urls import url
3ImportError: cannot import name 'url' from 'django.conf.urls' (C:\Users\Republic Of Computer\Desktop\Master cours et TD\python\tberra3lipy\venv\lib\site-packages\django\conf\urls\__init__.py)
4
urls.py
1File "C:\Users\Republic Of Computer\Desktop\Master cours et TD\python\tberra3lipy\venv\lib\site-packages\pwa\urls.py", line 1, in <module>
2 from django.conf.urls import url
3ImportError: cannot import name 'url' from 'django.conf.urls' (C:\Users\Republic Of Computer\Desktop\Master cours et TD\python\tberra3lipy\venv\lib\site-packages\django\conf\urls\__init__.py)
4from django.contrib import admin
5from django.conf.urls.static import static
6from django.urls import path,include
7from django.conf import settings
8
9urlpatterns = [
10 path('admin/', admin.site.urls),
11 path('donation/',include('donation.urls',namespace='donation')),
12 path('',include('pwa.urls')),
13]+static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
14
settings.py
1File "C:\Users\Republic Of Computer\Desktop\Master cours et TD\python\tberra3lipy\venv\lib\site-packages\pwa\urls.py", line 1, in <module>
2 from django.conf.urls import url
3ImportError: cannot import name 'url' from 'django.conf.urls' (C:\Users\Republic Of Computer\Desktop\Master cours et TD\python\tberra3lipy\venv\lib\site-packages\django\conf\urls\__init__.py)
4from django.contrib import admin
5from django.conf.urls.static import static
6from django.urls import path,include
7from django.conf import settings
8
9urlpatterns = [
10 path('admin/', admin.site.urls),
11 path('donation/',include('donation.urls',namespace='donation')),
12 path('',include('pwa.urls')),
13]+static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
14from pathlib import Path
15import os
16
17INSTALLED_APPS = [
18 'django.contrib.admin',
19 'django.contrib.auth',
20 'django.contrib.contenttypes',
21 'django.contrib.sessions',
22 'django.contrib.messages',
23 'django.contrib.staticfiles',
24 'pwa',
25 'accounts',
26 'donation',
27
28]
29
30ROOT_URLCONF = 'src.urls'
31# Static files (CSS, JavaScript, Images)
32# https://docs.djangoproject.com/en/3.2/howto/static-files/
33
34STATIC_URL = '/static/'
35#pwa
36PWA_SERVICE_WORKER_PATH = os.path.join(BASE_DIR, 'static/js', 'serviceworker.js')
37PWA_APP_NAME = 'tberra3li'
38PWA_APP_DESCRIPTION = "app for blood donors"
39PWA_APP_THEME_COLOR = '#000000'
40PWA_APP_BACKGROUND_COLOR = '#ffffff'
41PWA_APP_DISPLAY = 'standalone'
42PWA_APP_SCOPE = '/'
43PWA_APP_ORIENTATION = 'any'
44PWA_APP_START_URL = '/'
45PWA_APP_STATUS_BAR_COLOR = 'default'
46PWA_APP_ICONS = [
47 {
48 'src': 'static/assets/img/icon-160x160.png',
49 'sizes': '160x160'
50 }
51]
52PWA_APP_ICONS_APPLE = [
53 {
54 'src': 'static/assets/img/icon-160x160.png',
55 'sizes': '160x160'
56 }
57]
58PWA_APP_SPLASH_SCREEN = [
59 {
60 'src': 'static/assets/img/icon.png',
61 'media': '(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2)'
62 }
63]
64PWA_APP_DIR = 'ltr'
65PWA_APP_LANG = 'en-US'
66
ANSWER
Answered 2022-Apr-02 at 01:45django.conf.urls
is deprecated in Django 4
, so you cannot use django-pwa
with your version of Django, you need to use Django 3
. Otherwise you could fork/edit django-pwa
to replace django.conf.urls.url
(that is used in this file) with django.urls.path
, see this pull request.
QUESTION
Minimum Chrome version for TWA - options?
Asked 2021-Oct-21 at 08:44I have a Trusted Web Activity app that is displaying a Progressive Web Application by using the Android Browser Helper. The documentation and code indicates that the mobile app only runs properly when the Chrome Browser is 72 or above. The address bar is visible when the Chrome Browser is outdated. I believe I have the option of a Webview-fallback but I prefer not to use Webview as some of the app's functionality is incompatible with Webview.
While testing, when the Chrome Browser is updated on the same device, the trusted web activity runs without any issues.
What options do I have where the address bar isn't visible?
Is the min SDK the only way to set the minimum browser requirements or can I explicitly set a min Chrome Browser version in the Play Console for the app before the user downloads it? (which prompts the user to update the browser before installation)
Thanks in advance!
ANSWER
Answered 2021-Oct-21 at 08:44It's not possible to set a browser version requirement on the Play Console.
Besides falling back to a WebView, or showing the application with the URL bar, the other solution would to block the application from loading and ask the user to update / install a browser that supports Trusted Web Activity.
QUESTION
Blazor WASM 6.0.0-preview.7.21378.6, Visual Studio 2022 preview 3.1
Asked 2021-Aug-29 at 11:24I created a standard Blazor WASM project from the template with individual user accounts, ASP.NET Hosted, and Configured for Https, Progressive Web Application checked.
Running the project, I get this in the Dev Tools:
`crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: Could not load settings from '_configuration/Wtf.Client' createUserManager@https://localhost:44344/_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js:2:288346
Microsoft.JSInterop.JSException: Could not load settings from '_configuration/Wtf.Client' createUserManager@https://localhost:44344/_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js:2:288346
at Microsoft.JSInterop.JSRuntime.d__161[[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext() in Microsoft.JSInterop.dll:token 0x60000b3+0x156 at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args) in Microsoft.JSInterop.dll:token 0x6000049+0x84 at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService
3.d__27[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationState, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteUserAccount, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.ApiAuthorizationProviderOptions, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext() in Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll:token 0x6000122+0x95
at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService3.<GetAuthenticatedUser>d__26[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationState, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteUserAccount, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.ApiAuthorizationProviderOptions, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext() in Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll:token 0x6000120+0x7d at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService
3.d__25[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationState, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteUserAccount, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.ApiAuthorizationProviderOptions, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext() in Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll:token 0x600011e+0xa7
at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService`3.d__17[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationState, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteUserAccount, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.ApiAuthorizationProviderOptions, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext() in Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll:token 0x6000110+0x63
at Microsoft.AspNetCore.Components.Authorization.AuthorizeViewCore.OnParametersSetAsync() in Microsoft.AspNetCore.Components.Authorization.dll:token 0x6000043+0xfd
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) in Microsoft.AspNetCore.Components.dll:token 0x60000a5+0x7e
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() in Microsoft.AspNetCore.Components.dll:token 0x60000a3+0x113
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) in Microsoft.AspNetCore.Components.dll:token 0x6000285+0x65 blazor.webassembly.js:1:30848
Cookie “PHPSESSID” will be soon treated as cross-site cookie against “https://localhost:44344/css/open-iconic/font/fonts/open-iconic.woff” because the scheme does not match. open-iconic.woff
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Could not load settings from '_configuration/Wtf.Client'
createUserManager@https://localhost:44344/_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js:2:288346
Microsoft.JSInterop.JSException: Could not load settings from '_configuration/Wtf.Client' createUserManager@https://localhost:44344/_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js:2:288346
at Microsoft.JSInterop.JSRuntime.d__161[[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext() in Microsoft.JSInterop.dll:token 0x60000b3+0x156 at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args) in Microsoft.JSInterop.dll:token 0x6000049+0x84 at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService
3.d__27[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationState, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteUserAccount, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.ApiAuthorizationProviderOptions, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext() in Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll:token 0x6000122+0x95
at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService3.<GetAuthenticatedUser>d__26[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationState, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteUserAccount, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.ApiAuthorizationProviderOptions, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext() in Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll:token 0x6000120+0x7d at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService
3.d__25[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationState, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteUserAccount, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.ApiAuthorizationProviderOptions, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext() in Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll:token 0x600011e+0xa7
at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService`3.d__17[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationState, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteUserAccount, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.ApiAuthorizationProviderOptions, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext() in Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll:token 0x6000110+0x63
at Microsoft.AspNetCore.Components.Authorization.AuthorizeViewCore.OnParametersSetAsync() in Microsoft.AspNetCore.Components.Authorization.dll:token 0x6000043+0xfd
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) in Microsoft.AspNetCore.Components.dll:token 0x60000a5+0x7e
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) in Microsoft.AspNetCore.Components.dll:token 0x6000285+0x65 blazor.webassembly.js:1:30848
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Could not load settings from '_configuration/Wtf.Client'
createUserManager@https://localhost:44344/_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js:2:288346
Microsoft.JSInterop.JSException: Could not load settings from '_configuration/Wtf.Client' createUserManager@https://localhost:44344/_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js:2:288346
at Microsoft.JSInterop.JSRuntime.d__161[[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext() in Microsoft.JSInterop.dll:token 0x60000b3+0x156 at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args) in Microsoft.JSInterop.dll:token 0x6000049+0x84 at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService
3.d__27[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationState, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteUserAccount, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.ApiAuthorizationProviderOptions, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext() in Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll:token 0x6000122+0x95
at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService3.<GetAuthenticatedUser>d__26[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationState, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteUserAccount, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.ApiAuthorizationProviderOptions, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext() in Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll:token 0x6000120+0x7d at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService
3.d__25[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationState, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteUserAccount, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.ApiAuthorizationProviderOptions, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext() in Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll:token 0x600011e+0xa7
at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService3.<GetAuthenticationStateAsync>d__17[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationState, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteUserAccount, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.ApiAuthorizationProviderOptions, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext() in Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll:token 0x6000110+0x63 at Microsoft.AspNetCore.Components.Authorization.AuthorizeViewCore.OnParametersSetAsync() in Microsoft.AspNetCore.Components.Authorization.dll:token 0x6000043+0xfd at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) in Microsoft.AspNetCore.Components.dll:token 0x60000a5+0x7e at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() in Microsoft.AspNetCore.Components.dll:token 0x60000a3+0x113 at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) in Microsoft.AspNetCore.Components.dll:token 0x6000285+0x65
Anyone know what's happening here? I did install "The Essentials" extension by Mads Kristensen, if that matters.
ANSWER
Answered 2021-Aug-29 at 11:24When you create a Hosted Wasm project in VS2020 preview the default start project is set to the Client. That kind-of works for a simple app (no Auth) but it probably is a litle bug.
The simple fix is to right-click on the Server project and select "Set as Startup Project".
QUESTION
Dotnet React Template - is it possible to use /index.html
Asked 2021-Jul-18 at 01:44If I use pure Create React Application
(without dotnet), then I can open the react application in two ways (after yarn start
):
- https://localhost:3000/
- https://localhost:3000/index.html
But if I use Dotnet React Template
, then there is only one way I can open the application (when I add index.html, I only see the dotnet part of the app, but not react) after dotnet run
:
- https://localhost:5001/
- https://localhost:5001/index.html
I would like to find a way to use index.html here as well.
Why am I asking. I recently tried adding my site as a Bookmark to iPhone's Home Screen.
It turned out that this doesn't just work as a link, but iOS now interprets those sites as Progressive Web Application. That is, additional requirements are imposed on the site. And one of them is having a working index.html
.
This is why I would like my Dotnet React application to work properly with /index.html
ANSWER
Answered 2021-Jul-17 at 19:32Go get ClientApp/src/App.js and change the first route to below.
1<Route exact path={['/', '/index.html']} component={Home} />
2
QUESTION
Blazor WASM Project Referencing Error (BLAZORSDK1001)
Asked 2021-May-25 at 04:53I have one Server project and now trying to convert it into Progressive Web Application. When I reference the API, Model, and UI projects to it then the following error comes out:
1<Target Name="_FailIfReferencingAspNetCoreApp" BeforeTargets="ResolveRuntimePackAssets">
2 <Error
3 Code="BLAZORSDK1001"
4 Text="The project references the ASP.NET Core shared framework, which is not supported by Blazor WebAssembly apps. Remove the framework reference if directly referenced, or the package reference that adds the framework reference."
5 Condition="'@(FrameworkReference->WithMetadataValue('Identity', 'Microsoft.AspNetCore.App')->Count())' != '0'" />
6</Target>
7
The following code is the .csproj of the project, is there something I'm missing?
1<Target Name="_FailIfReferencingAspNetCoreApp" BeforeTargets="ResolveRuntimePackAssets">
2 <Error
3 Code="BLAZORSDK1001"
4 Text="The project references the ASP.NET Core shared framework, which is not supported by Blazor WebAssembly apps. Remove the framework reference if directly referenced, or the package reference that adds the framework reference."
5 Condition="'@(FrameworkReference->WithMetadataValue('Identity', 'Microsoft.AspNetCore.App')->Count())' != '0'" />
6</Target>
7<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
8
9 <PropertyGroup>
10 <TargetFramework>net5.0</TargetFramework>
11 <ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
12 </PropertyGroup>
13
14 <ItemGroup>
15 <Content Remove="wwwroot\service-worker.js" />
16 </ItemGroup>
17
18 <ItemGroup>
19 <PackageReference Include="Blazored.Toast" Version="3.1.2" />
20 <PackageReference Include="BlazorInputFile" Version="0.2.0" />
21 <PackageReference Include="DevExpress.Blazor" Version="20.1.7" />
22 <PackageReference Include="Hangfire.AspNetCore" Version="1.7.11" />
23 <PackageReference Include="Hangfire.Core" Version="1.7.11" />
24 <PackageReference Include="Hangfire.SqlServer" Version="1.7.11" />
25 <PackageReference Include="LiquidTechnologies.Blazor.ModalDialog" Version="0.9.7" />
26 <PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.2.0-preview3.20168.3" />
27 <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.4" />
28 <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.4" PrivateAssets="all" />
29 <PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
30 <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="3.1.3" />
31 <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.3" />
32 <PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="3.1.3" />
33 <PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="5.0.5" />
34 <PackageReference Include="Microsoft.AspNetCore.SignalR.Client.Core" Version="5.0.5" />
35 <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.3" />
36 <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.3">
37 <PrivateAssets>all</PrivateAssets>
38 <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
39 </PackageReference>
40 <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" />
41 <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
42 <PackageReference Include="QRCoder" Version="1.4.1" />
43 <PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
44 <PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
45 <PackageReference Include="Serilog.Sinks.Elasticsearch" Version="8.0.1" />
46 <PackageReference Include="Serilog.Sinks.MSSqlServer" Version="5.3.0" />
47 <PackageReference Include="Tewr.Blazor.FileReader" Version="2.0.0.20200" />
48 </ItemGroup>
49
50 <ItemGroup>
51 <ProjectReference Include="..\DataAccess\DataAccess.csproj" />
52 <ProjectReference Include="..\UI\UI.csproj" />
53 <ProjectReference Include="..\API\API.csproj" />
54 <ProjectReference Include="..\Model\Model.csproj" />
55 </ItemGroup>
56</Project>
57
Are there any suggestions on solving this issue?
ANSWER
Answered 2021-May-25 at 04:53"I have one Server project" is a little unclear since we can only see <Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
. I assume you want ot convert form a Blazor Server App to a WebAssembly app?
The project type is now WebAssembly but you are including, amongst others, <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.3" />
You can't access a database from a browser app directly. It's not supported and it wouldn't be safe (all clients would have access to the connection string).
This project needs to be split into a Client and a Server (API) part.
Your best course is to create a project (in a temp folder) from the full Blazor Wasm + Asp.Net Hosted + Individual Accounts template. It'll give you a complete reference for what goes where.
QUESTION
Unable to hit breakpoints in Blazor WASM
Asked 2021-Apr-23 at 11:43I am trying to debug a Blazor WebAssembly app but get the following message when trying to set breakpoints:
If I do the action that would hit the breakpoint, visual studio instead opens a new tab that says Unable to retrieve source content (Unable to retrieve source content)
. I have the same issue in a separate blazor server app, as well as the sample template that is provided when first creating a blazor project (counter.razor and fetchdata.razor).
Here is the info on the app: Target Framework: .NET 5.0 (Current) Authentication Type: None Configure for HTTPS: True ASP.NET Core hosted: False Progressive Web Application: True
I am using Visual Studio 2019 version 16.9.4.
My .csproj file is:
1<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
2
3 <PropertyGroup>
4 <TargetFramework>net5.0</TargetFramework>
5 <ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
6 </PropertyGroup>
7
8 <ItemGroup>
9 <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.5" />
10 <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.5" PrivateAssets="all" />
11 <PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
12 </ItemGroup>
13
14 <ItemGroup>
15 <ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />
16 </ItemGroup>
17
18</Project>
19
My launchSettings.json file is:
1<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
2
3 <PropertyGroup>
4 <TargetFramework>net5.0</TargetFramework>
5 <ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
6 </PropertyGroup>
7
8 <ItemGroup>
9 <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.5" />
10 <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.5" PrivateAssets="all" />
11 <PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
12 </ItemGroup>
13
14 <ItemGroup>
15 <ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />
16 </ItemGroup>
17
18</Project>
19{
20 "iisSettings": {
21 "windowsAuthentication": false,
22 "anonymousAuthentication": true,
23 "iisExpress": {
24 "applicationUrl": "http://localhost:59417",
25 "sslPort": 44389
26 }
27 },
28 "profiles": {
29 "IIS Express": {
30 "commandName": "IISExpress",
31 "launchBrowser": true,
32 "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
33 "environmentVariables": {
34 "ASPNETCORE_ENVIRONMENT": "Development"
35 }
36 },
37 "Test": {
38 "commandName": "Project",
39 "dotnetRunMessages": "true",
40 "launchBrowser": true,
41 "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
42 "applicationUrl": "https://localhost:5001;http://localhost:5000",
43 "environmentVariables": {
44 "ASPNETCORE_ENVIRONMENT": "Development"
45 }
46 }
47 }
48}
49
I have tried the solutions given here and here. I also checked https://devblogs.microsoft.com/aspnet/blazor-webassembly-3-2-0-preview-3-release-now-available/, even though it is a year old. I restarted Visual studio multiple times, deleted the .vs file, restarted my comp, but the same issue.
ANSWER
Answered 2021-Apr-23 at 11:43The reason for the error was that my solution path had a "#' in a folder name. This error was discussed https://github.com/dotnet/aspnetcore/issues/22036 which apparently was never resolved if you follow the thread.
QUESTION
Does a service worker need to cache manifest icons that are not used by the core of the PWA?
Asked 2021-Apr-13 at 09:42This question may seem quite essential. However, I could not find an answer in any of the official Progressive Web Application (PWA) documentation.
The manifest.json
of my PWA contains quite a bit of icons and even a fairly large screenshot.png
that are not essential to the core of the PWA.
1 {
2 "src": "./assets/static/images/android-chrome-512x512.png",
3 "sizes": "512x512",
4 "type": "image/png"
5 },
6 {
7 "src": "./assets/static/images/android-chrome-192x192.png",
8 "sizes": "192x192",
9 "type": "image/png"
10 },
11 {
12 "src": "./assets/static/images/android-chrome-512x512.maskable.png",
13 "sizes": "512x512",
14 "type": "image/png",
15 "purpose": "maskable"
16 },
17 {
18 "src": "./assets/static/images/android-chrome-192x192.maskable.png",
19 "sizes": "192x192",
20 "type": "image/png",
21 "purpose": "maskable"
22 },
23 {
24 "src": "./assets/static/images/apple-touch-icon.png",
25 "sizes": "180x180",
26 "type": "image/png",
27 "purpose": "maskable"
28 }
29 ],
30 "screenshots": [
31 {
32 "src": "./assets/static/images/screenshot.png",
33 "sizes": "1080x2220",
34 "type": "image/png"
35 }
36 ]
37
Only one of the above icons is referred by the index.html
of my single page PWA:
1 {
2 "src": "./assets/static/images/android-chrome-512x512.png",
3 "sizes": "512x512",
4 "type": "image/png"
5 },
6 {
7 "src": "./assets/static/images/android-chrome-192x192.png",
8 "sizes": "192x192",
9 "type": "image/png"
10 },
11 {
12 "src": "./assets/static/images/android-chrome-512x512.maskable.png",
13 "sizes": "512x512",
14 "type": "image/png",
15 "purpose": "maskable"
16 },
17 {
18 "src": "./assets/static/images/android-chrome-192x192.maskable.png",
19 "sizes": "192x192",
20 "type": "image/png",
21 "purpose": "maskable"
22 },
23 {
24 "src": "./assets/static/images/apple-touch-icon.png",
25 "sizes": "180x180",
26 "type": "image/png",
27 "purpose": "maskable"
28 }
29 ],
30 "screenshots": [
31 {
32 "src": "./assets/static/images/screenshot.png",
33 "sizes": "1080x2220",
34 "type": "image/png"
35 }
36 ]
37 <link rel="apple-touch-icon" sizes="180x180" href="./assets/static/images/apple-touch-icon.png"/>
38
But there are even a whole lot more icons mainly for Microsoft Windows and the Apple Safari browser that are even not referred by the manifest.json
. The Microsoft Windows icons are listed only in the browserconfig.xml
file:
1 {
2 "src": "./assets/static/images/android-chrome-512x512.png",
3 "sizes": "512x512",
4 "type": "image/png"
5 },
6 {
7 "src": "./assets/static/images/android-chrome-192x192.png",
8 "sizes": "192x192",
9 "type": "image/png"
10 },
11 {
12 "src": "./assets/static/images/android-chrome-512x512.maskable.png",
13 "sizes": "512x512",
14 "type": "image/png",
15 "purpose": "maskable"
16 },
17 {
18 "src": "./assets/static/images/android-chrome-192x192.maskable.png",
19 "sizes": "192x192",
20 "type": "image/png",
21 "purpose": "maskable"
22 },
23 {
24 "src": "./assets/static/images/apple-touch-icon.png",
25 "sizes": "180x180",
26 "type": "image/png",
27 "purpose": "maskable"
28 }
29 ],
30 "screenshots": [
31 {
32 "src": "./assets/static/images/screenshot.png",
33 "sizes": "1080x2220",
34 "type": "image/png"
35 }
36 ]
37 <link rel="apple-touch-icon" sizes="180x180" href="./assets/static/images/apple-touch-icon.png"/>
38 <link rel="shortcut icon" href="./assets/static/images/favicon.ico"/>
39 <link rel="icon" type="image/png" sizes="32x32" href="./assets/static/images/favicon-32x32.png"/>
40 <link rel="icon" type="image/png" sizes="16x16" href="./assets/static/images/favicon-16x16.png"/>
41 <link rel="mask-icon" href="./assets/static/images/safari-pinned-tab.svg" color="#379"/>
42 <meta name="msapplication-config" content="./assets/static/images/browserconfig.xml"/>
43
On the other hand, my PWA has its own set of application icons that are not listed in the manifest.json
but of course are cached by the service-worker.js
; no problem there.
The targets of my PWA are mobile Android & iOS, with occasionally some Internet-connected desktop computers.
My question refers mainly to the first-mentioned set of icons: Do these Android and iOS icons and the screenshot need to be cached by the service-worker.js
even if the core of the PWA does not require these to function well?
Which would be equivalent to asking: Do the respective operating systems save the installation icons even when these are not cached by the service-worker.js
?
ANSWER
Answered 2021-Apr-13 at 09:42The brief answer is "no," none of the (fav)icons or screenshots should be cached by the service-worker.js
if the PWA will not use these.
Moreover, manifest.json
should only refer to icons targeting the Android and/or Chrome browser. Hence, apple-touch-icon.png
should not be mentioned in the manifest.json
.
For iOS, it suffices to place the apple-touch-icon.png
in the root folder of the scope
of your application. The same holds true for favicon.ico
.
There are some more rules for Windows and Mac OS X user agents. These can easily be checked by following the guidelines of this favicon generator or by proving your PWA URL to its favicon checker.
For example, it told me that the following line is best best kept out of index.html
:
1 {
2 "src": "./assets/static/images/android-chrome-512x512.png",
3 "sizes": "512x512",
4 "type": "image/png"
5 },
6 {
7 "src": "./assets/static/images/android-chrome-192x192.png",
8 "sizes": "192x192",
9 "type": "image/png"
10 },
11 {
12 "src": "./assets/static/images/android-chrome-512x512.maskable.png",
13 "sizes": "512x512",
14 "type": "image/png",
15 "purpose": "maskable"
16 },
17 {
18 "src": "./assets/static/images/android-chrome-192x192.maskable.png",
19 "sizes": "192x192",
20 "type": "image/png",
21 "purpose": "maskable"
22 },
23 {
24 "src": "./assets/static/images/apple-touch-icon.png",
25 "sizes": "180x180",
26 "type": "image/png",
27 "purpose": "maskable"
28 }
29 ],
30 "screenshots": [
31 {
32 "src": "./assets/static/images/screenshot.png",
33 "sizes": "1080x2220",
34 "type": "image/png"
35 }
36 ]
37 <link rel="apple-touch-icon" sizes="180x180" href="./assets/static/images/apple-touch-icon.png"/>
38 <link rel="shortcut icon" href="./assets/static/images/favicon.ico"/>
39 <link rel="icon" type="image/png" sizes="32x32" href="./assets/static/images/favicon-32x32.png"/>
40 <link rel="icon" type="image/png" sizes="16x16" href="./assets/static/images/favicon-16x16.png"/>
41 <link rel="mask-icon" href="./assets/static/images/safari-pinned-tab.svg" color="#379"/>
42 <meta name="msapplication-config" content="./assets/static/images/browserconfig.xml"/>
43<link rel="shortcut icon" href="./favicon.ico"/>
44
The only exception to this are the favicon-32x32.png
and favicon-16x16.png
icons that are referred to in index.html
. These two icons should be cached, as desktop browser will fetch these as tab icons.
Furthermore, the service-worker.js
should also not cache itself.
Finally, significant icon size reductions can be achieved by converting the images from RGB colour space to an indexed colour palette of for example 24 colours. This can be done using the free image editor GIMP. When exporting the images with GIMP, deselect metadata and thumbnail generation.
QUESTION
How do I change the "Authorising..." message that appears when a Blazor PWA application is being refreshed?
Asked 2021-Feb-22 at 06:46When an asp net hosted BLAZOR Progressive Web Application is refreshed using browser refresh, PWA application performs an authentication roundtrip. During this time span, main content div displays the text: "Authorising...". Where does this message originate from? My objective is to display a spinner-border along with this message so that the user experience an animation. Here is what I know:
- Initial "Loading..." message appears from the index page in wwwroot.
- For every AutherizeView, Authorizing section can be used to show custom message.
But I'm unable to locate the source of default "Authorising..." message.
ANSWER
Answered 2021-Feb-22 at 06:46There are two places that need your intention.
First is in your App.razor
. The AuthorizeRouteView
has a property called Authorizing
, where you can add any RenderFragement
you want to display during authorizing. Here is the line where the Authorizing...
is set.
1<CascadingAuthenticationState>
2 <Router AppAssembly="@typeof(Program).Assembly" PreferExactMatches="@true">
3 <Found Context="routeData">
4 <AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)">
5 <Authorizing>
6 <span>Your spinner goes here</span>
7 </Authorizing>
8 <NotAuthorized>
9 @if (!context.User.Identity.IsAuthenticated)
10 {
11 <RedirectToLogin />
12 }
13 else
14 {
15 <p>You are not authorized to access this resource.</p>
16 }
17 </NotAuthorized>
18 </AuthorizeRouteView>
19 </Found>
20 <NotFound>
21 <LayoutView Layout="@typeof(MainLayout)">
22 <p>Sorry, there's nothing at this address.</p>
23 </LayoutView>
24 </NotFound>
25 </Router>
26</CascadingAuthenticationState>
27
28
If you have created the app using the default template, you should see an AuthenticationPage
. This page has the route @page "/authentication/{action}"
.
This page content looks like
1<CascadingAuthenticationState>
2 <Router AppAssembly="@typeof(Program).Assembly" PreferExactMatches="@true">
3 <Found Context="routeData">
4 <AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)">
5 <Authorizing>
6 <span>Your spinner goes here</span>
7 </Authorizing>
8 <NotAuthorized>
9 @if (!context.User.Identity.IsAuthenticated)
10 {
11 <RedirectToLogin />
12 }
13 else
14 {
15 <p>You are not authorized to access this resource.</p>
16 }
17 </NotAuthorized>
18 </AuthorizeRouteView>
19 </Found>
20 <NotFound>
21 <LayoutView Layout="@typeof(MainLayout)">
22 <p>Sorry, there's nothing at this address.</p>
23 </LayoutView>
24 </NotFound>
25 </Router>
26</CascadingAuthenticationState>
27
28@page "/authentication/{action}"
29@using Microsoft.AspNetCore.Components.WebAssembly.Authentication
30<RemoteAuthenticatorView Action="@Action" />
31
32@code{
33 [Parameter] public string Action { get; set; }
34}
35
You can change the entire template by adding the corresponding RenderFragments
which can be found here
Here is an example where every fragment has a non-default value
1<CascadingAuthenticationState>
2 <Router AppAssembly="@typeof(Program).Assembly" PreferExactMatches="@true">
3 <Found Context="routeData">
4 <AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)">
5 <Authorizing>
6 <span>Your spinner goes here</span>
7 </Authorizing>
8 <NotAuthorized>
9 @if (!context.User.Identity.IsAuthenticated)
10 {
11 <RedirectToLogin />
12 }
13 else
14 {
15 <p>You are not authorized to access this resource.</p>
16 }
17 </NotAuthorized>
18 </AuthorizeRouteView>
19 </Found>
20 <NotFound>
21 <LayoutView Layout="@typeof(MainLayout)">
22 <p>Sorry, there's nothing at this address.</p>
23 </LayoutView>
24 </NotFound>
25 </Router>
26</CascadingAuthenticationState>
27
28@page "/authentication/{action}"
29@using Microsoft.AspNetCore.Components.WebAssembly.Authentication
30<RemoteAuthenticatorView Action="@Action" />
31
32@code{
33 [Parameter] public string Action { get; set; }
34}
35@page "/authentication/{action}"
36@using Microsoft.AspNetCore.Components.WebAssembly.Authentication
37<RemoteAuthenticatorView Action="@Action">
38 <LoggingIn>
39 <span>LoggingIn</span>
40 </LoggingIn>
41 <Registering>
42 <span>Registering</span>
43 </Registering>
44 <Registering>
45 <span>LoggingIn</span>
46 </Registering>
47 <UserProfile>
48 <span>UserProfile is loaded....</span>
49 </UserProfile>
50 <CompletingLoggingIn>
51 <span>CompletingLoggingIn</span>
52 </CompletingLoggingIn>
53 <LogInFailed>
54 <span>Login failed. Reason: @context</span>
55 </LogInFailed>
56 <LogOut>
57 <span>Logout from the application</span>
58 </LogOut>
59 <LogOut>
60 <span>CompletingLogOut</span>
61 </LogOut>
62 <LogOutFailed>
63 <span>Logout failed. Reason: @context</span>
64 </LogOutFailed>
65 <LogOut>
66 <span>LogOutSucceeded</span>
67 </LogOut>
68</RemoteAuthenticatorView>
69
70@code{
71 [Parameter] public string Action { get; set; }
72}
73
QUESTION
Migrating Chrome USB App API to Web USB API
Asked 2021-Feb-09 at 01:10I currently have source code for a Chrome App, but as the platform is being deprecated I need to migrate my API to a Progressive Web Application.
As I still want support for USB in my web platform application, it was suggested that I use the Web USB API to retain functionality, but I can't seem to figure out the equivalent's for the following and how to implement them:
1chrome.usb.releaseInterface()
2chrome.usb.closeDevice()
3chrome.usb.claimInterface()
4chrome.usb.findDevices()
5chrome.usb.bulkTransfer()
6
(Also, I also found there is a USB Library for Node.JS that works similarly also; is this a good alternative too?)
ANSWER
Answered 2021-Feb-09 at 01:10The WebUSB API provides a USBDevice
interface which is returned by navigator.usb.getDevices()
and navigator.usb.requestDevice()
. This interface has methods equivalent to all but one of those listed above:
1chrome.usb.releaseInterface()
2chrome.usb.closeDevice()
3chrome.usb.claimInterface()
4chrome.usb.findDevices()
5chrome.usb.bulkTransfer()
6chrome.usb.releaseInterface() -> releaseInterface()
7chrome.usb.closeDevice() -> close()
8chrome.usb.claimInterface() -> claimInterface()
9chrome.usb.bulkTransfer() -> transferIn() or transferOut().
10
chrome.usb.findDevices()
is more complex to replace and first requires explaining the differences between the permission model for the WebUSB API and the chrome.usb API. The WebUSB API does not provide an install-time permission to access USB devices. A site must call navigator.usb.requestDevice()
to ask the user for permission to access new USB devices. For devices with serial numbers permissions are remembered and so you can call navigator.usb.getDevices()
to get a list of currently connected devices a site previously got permission to access. This is the same model as the chrome.usb.getUserSelectedDevices()
function. The chrome.usb.findDevices()
function also implicitly opened the devices in the process of returning them to the application. There is no equivalent to this behavior. The site must explicitly call open()
on the USBDevice
interfaces returned by these methods.
Note, that if this application is being deployed into a managed environment the WebUsbAllowDevicesForUrls policy can be used to mimic the Chrome Apps permission model. Devices allowed by policy will be returned by navigator.usb.getDevices()
without the need to call navigator.usb.requestDevice()
and prompt the user first.
QUESTION
No Manifest Detected on a PHP Progressive Web Application
Asked 2021-Feb-06 at 21:24I'm trying to make my PHP web application into a Progressive Web Application, but when I open Chrome DevTools into the application tab, it tells me there is 'No Manifest Detected' when I have put the manifest.json at the root but my ServiceWorker.js is successfully running.
1<!DOCTYPE html>
2<html lang="en">
3
4<?php
5//php code
6?>
7
8<head>
9 <title>php</title>
10 <meta charset="UTF-8">
11 <meta name="viewport" content="width=device-width, initial-scale=1">
12 <link rel="manifest" href="/manifest.json">
13 <link rel="stylesheet" type="text/css" href="css/util.css">
14 <link rel="stylesheet" type="text/css" href="css/main.css">
15
16</head>
17
18<body>
19//body code
20</body>
21
22</html>
1<!DOCTYPE html>
2<html lang="en">
3
4<?php
5//php code
6?>
7
8<head>
9 <title>php</title>
10 <meta charset="UTF-8">
11 <meta name="viewport" content="width=device-width, initial-scale=1">
12 <link rel="manifest" href="/manifest.json">
13 <link rel="stylesheet" type="text/css" href="css/util.css">
14 <link rel="stylesheet" type="text/css" href="css/main.css">
15
16</head>
17
18<body>
19//body code
20</body>
21
22</html>{
23"name": "php",
24"version": "1.0",
25"short_name": "php",
26"start_url": "./index.php",
27"background_color": "#000000",
28"display": "standalone",
29"orientation": "any",
30
31"default_locale": "en",
32"description": "example",
33"icons": [
34
35 {
36 "src": "512x512.png",
37 "sizes": "512x512",
38 "type": "image/png"
39 },
40
41 {
42 "src": "192x192.png",
43 "sizes": "192x192",
44 "type": "image/png"
45 }
46
47]}
48
I have validated the manifest.json file here and it works in a test HTML file; it's just trying to put it into a PHP file is where I don't see anything happening.
ANSWER
Answered 2021-Feb-06 at 21:24Move your <head></head>
block directly below the opening <html>
tag, so that your <?php //php code ?>
is below it. The manifest won't be detected, if there is any output before the document head.
1<!DOCTYPE html>
2<html lang="en">
3
4<?php
5//php code
6?>
7
8<head>
9 <title>php</title>
10 <meta charset="UTF-8">
11 <meta name="viewport" content="width=device-width, initial-scale=1">
12 <link rel="manifest" href="/manifest.json">
13 <link rel="stylesheet" type="text/css" href="css/util.css">
14 <link rel="stylesheet" type="text/css" href="css/main.css">
15
16</head>
17
18<body>
19//body code
20</body>
21
22</html>{
23"name": "php",
24"version": "1.0",
25"short_name": "php",
26"start_url": "./index.php",
27"background_color": "#000000",
28"display": "standalone",
29"orientation": "any",
30
31"default_locale": "en",
32"description": "example",
33"icons": [
34
35 {
36 "src": "512x512.png",
37 "sizes": "512x512",
38 "type": "image/png"
39 },
40
41 {
42 "src": "192x192.png",
43 "sizes": "192x192",
44 "type": "image/png"
45 }
46
47]}
48<!DOCTYPE html>
49<html lang="en">
50
51<head>
52 <title>php</title>
53 <meta charset="UTF-8">
54 <meta name="viewport" content="width=device-width, initial-scale=1">
55 <link rel="manifest" href="/manifest.json">
56 <link rel="stylesheet" type="text/css" href="css/util.css">
57 <link rel="stylesheet" type="text/css" href="css/main.css">
58</head>
59
60<?php
61 //php code
62?>
63
64<body>
65 //body code
66</body>
67
68</html>
Community Discussions contain sources that include Stack Exchange Network
Tutorials and Learning Resources in Progressive Web Application
Tutorials and Learning Resources are not available at this moment for Progressive Web Application