Why are Deeplinks from browser not working? - ionic4

I've implemented deeplinking in my ionic 4 app and everything works fine with:
URL Scheme links from the browser, e.g. "myapp://home"
Universal links when called using ADB command, e.g. adb shell am start -a android.intent.action.VIEW -d "https://mywesbite.com/home" com.mybundleid.com
However, it does NOT work when clicking a Universal link from the browser directly, e.g. "https://mywesbite.com/home"
I have my assetlinks.json and apple-app-association files set up and on the domain.
What am I missing?
Please help!

Related

Sidebar is not visible in storybook server

I am creating a React Native mobile app with storybook.js. But when I run the command yarn run storybook, the storybook server starts running on the port: 7007
Preview and components in the sidebar are not visible
but it does not show the components. But it does show the preview in android emulator.
components are visible in sidebar and visible in preview
I need to see the preview on browser, but it does not at lease show the components at least.
Can somebody please help me to solve the problem?
I had this same issue and solved it by making sure storybook and the emulator were running on the same port.
I set the port/host when configuring StorybookUIRoot then added the host to storybook command in the package.json "storybook": "start-storybook -p 7007 -h 192.168.1.8"
Restart storybook and the mobile app, you should be good to go
looks like your are experiencing a common issue. See this pinned issue from the repo.
Also to be clear the server and this web ui is not required to use react native storybook and you can use it entirely from the ondeviceUI.
There are a few things you need to do to make sure that the stories load on the server.
First you should make sure the ondevice storybook is running before you start the server.
If you are still having issues you can manually specify the port and ip address
First set the ip and port on the getStorybookUI call.
const StorybookUIRoot = getStorybookUI({
host: "192.111.1.11", // replace this ip address with your local ip address
port: "7007"
});
Then adjust the script used to launch the server to have the port and ip option. Make sure that you use exactly the same port and host that you used in the previous step otherwise it won't work.
It should look something like this but with your own IP address instead.
"storybook": "start-storybook -p 7007 -h 192.111.1.11"
If none of this helps feel free to ask questions on the storybook discord in the react-native channel and I'll be there to help you.
If you are following the storybook tutorial, try removing your yarn.lock, yarn again, and then follow Danny's answer.

How do you sign to Docker for Windows so you can build images external images?

I am having great trouble attempting to build a docker image based on the mhart/alpine-node:6.10.3 image. It requires that I go out to docker hub to get it, which requires that I login in. But I cannot. I have a docker ID. I can login to the hub.docker.com and cloud.docker.com via a browser. However I cannot login either via the docker cli or via the systray for Docker for Windows. What is the trick here? cli says sonnection refused and Docker for Windows login dialog just does nothing and both the boxes are outlined in red.
I've spent hours on this....grrrr...
Thanks!

Web app not responding on localhost:5000 when run standalone

I have simple DotNet Core app that runs fine with dotnet run but when I do dotnet publish and then dotnet HelloWorld.dll (in the bin/Debug/netcoreapp1.1 directory; same with bin/Rebug/netcoreapp1.1), on my local machine, the command prompt says "Now listening on: http://localhost:5000" but the service is not responding when I navigate to that address with my browser. Are there any kind of logs to review?
I reproduce the same in Windows 10 and OSX 10.11, both with clean dotnet new -t web projects, without any modifications.
In Windows I ran netstat -noa | find "LISTENING" and can see port 5000 at the bottom of the list. But still no connection when I try.
Ideas?
The browser output is:
The localhost page isn’t working
localhost is currently unable to handle this request.
HTTP ERROR 500"
I run .Net Core 1.1.0 - SDK 1.0.0 Preview 2.1-003177 on both the Windows and Mac machine.
Click on the ^ icon of your toolbar to see hidden icons. If IIS is running, you will be able to see each instance and the port that the instance is listening on
I got the same error. To diagnose the error, I started up the app not in IIS Express but in what I think is a self-hosted option that opens in a console window.
If you look through the log in the console window, you might see an error in that log.
Also, I've noticed that sometimes the browser window pops up and navigates to the URL before the host environment is ready to handle the request. All you have to do when you get this error is wait a second and refresh the page, and the host environment will be ready and the page will load.

WebRTC - Browser doesn't ask for mic access permission for local html file

I have some simple webRTC code which uses getUserMedia to gain access to user's mic. Now when I load that html file (saved at my localhost) in my browser, the browser doesn't ask for mic access permission and thus get failed to get access.
But when I run the same html inside the w3schools.com editor, it asks for mic access permission and upon allowing it to access my mic, it works fine...
Why is this strange behaviour?
When you open an html file right off the filesystem (file:// prefix), Chrome will auto-block getUserMedia permissions. You have to run a server locally.
I started up a sinatra server like this:
# server.rb
require 'sinatra'
get '/' do
File.read('index.html')
end
Then give it ago.
$ gem install sinatra
$ ruby server.rb
http://localhost:4567
Because of security Chrome won't open user media, e.g. WebCam when executing a file:/* document.
You could override however the security policy by starting chrome with the --disable-web-security command line option.
For testing check also the --use-fake-device-for-media-stream option.
N.B. When specifying command line options make sure there is no chrome/chromium process running.
P.S Give it a try by creating a file test.html containing
<!DOCTYPE HTML>
<video autoplay/>
<script>
navigator.webkitGetUserMedia({audio:true,video:true},
function(stream){
document.querySelector('video').src =
URL.createObjectURL(stream);
});
</script>
and than kill all chrome instances and start chrome like this:
chrome.exe --use-fake-device-for-media-stream --disable-web-security test.html
This behavior is caused by Chrome security settings.
If you have PHP installed and you don't wanna setup Apache or other more advanced web server, probably the easiest way would be to run internal PHP web server this way (assuming you have your web files in /home/user/web/):
php -S 127.0.0.1:3000 -t /home/user/web/
Here is a description of the parameters:
-S <addr>:<port> Run with built-in web server.
-t <docroot> Specify document root <docroot> for built-in web server.
After you run the server start your browser and open this URL (assuming your test file is called webrtc.html):
http://127.0.0.1:3000/webrtc.html
Just some troubleshooting suggestions:
Check chrome://settings/content (scroll down to "Media"), to see if you've accidentally selected that site to always allow or always deny. (I'm on Chrome 26[dev]; this may be located somewhere else on Chrome 24.)
Also try restarting your browser - this bit of Chrome is still pretty buggy in my experience, and sometimes a restart fixes it.
And make sure you've got an error handler in your getUserMedia() call - there may be some additional info there.
Are you loading the file via something like file://? It seems chromium does not give access to those files at all and completely ignores the request. Just tried myself and after uploading the file to a dev server it worked fine.
Even setting it to allow always it still does not work with file://.
You can't run HTML5 that uses getUsermedia API locally without using a local server. Use WampServer and place your HTML5 file inside the www folder.
This answer is for chrome
In Chrome you can use the --allow-file-access-from-files flag to allow webcam access from a local file.
Mac
On a mac you can open the terminal and type:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --allow-file-access-from-files /path/to/file.html
change /path/to/file.html with your path
Windows
In Windows you can create a shortcut. Right click Google Chrome And in the menu select: Copy To -> Desktop (shortcut), then right click the shortcut and click properties add the flag:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --allow-file-access-from-files C:\path\to\file.html
Hope this answer helps!

how to test open graph on localhost

I've done a lot of research and haven't found a definitive answer to this. Is there anyway to test the open graph on localhost? I don't haven any issues using the graph api on locahost.
I've changed my website url in the app settings and have even tried setting up a domain in my hosts file but the debugger linter for open graph tries to use the actual domain instead of my localhost and when using locahost directly the linter completely fails connecting.
Does anybody have any workarounds for this?
Using a local proxy is the right solution. ngrok didn't work for me neither.
A similar tool that did work with facebook debugger is localtunnel ✅
npm install -g localtunnel
lt --port 8000
# or using npx without installing localtunnel
npx lt --port 8000
Generates a url that looks something like https://<random_hash>.localtunnel.me/. Using this url in facebook open graph debugger worked for me as of October 18th 2017. I only had to hit Fetch new scrape information button. 🍻
Cool thing about localtunnel is that you can easily host your own localtunnel server with github.com/localtunnel/server so if it ever stops working with localtunnel.me, you can run your own somewhere in the cloud ⛅
You can use ngrok to create a random public subdomain that routes to your local webserver very easily, even through NAT or firewalls.
Just download ngrok and run ./ngrok http 8080 (assuming 8080 is your local webserver http port).
This will create a random subdomain like http://38a84a97.ngrok.io/ that routes to your local webserver and that you can use with Facebook to test your open graph tags.
Its very simple to test Open Graph in any local environment using Chrome or Firefox using plugins. I have used one to quickly show in chrome how the Open Graph looks to the viewer to test results. Here is a quote of what it does.
This extension shows how people will see your site in the most popular
social networks This extension is for professionals who creates a
media content.
To check meta-information of your site or article just open it in a
Chrome and click extension's icon. Also you could add an URL manually.
Here is a direct link to the plugin (Chrome)
Firefox add-on
As a bit simpler approach you can use a browser extension like https://socialsharepreview.com/browser-extensions - which will show your Social Cards directly in the Browser (which of course might fail, if you wrongly didn't set them serverside :))
To test open graph (and Twitter cards) I also had to expose localhost (Docker) to Facebook and Twitter. I used Serveo
It works very well for this, no need to install anything as it works with ssh port forwarding.
$ ssh -R 80:localhost:3000 serveo.net
Then navigate to the url given, and there you go.
You have to setup a public domain which points to your public ip address.
Use dynes.org or a similar service and setup your router to forward your port 80.
There are several tools you can use for serving something up over your localhost, each with varying degrees of functionality.
I prefer (obviously) http://forwardhq.com
Other great options here: http://devblog.avdi.org/2012/04/27/http-forwarding-services-for-local-facebook-development/
If anyone is looking to preview the :og tags on while developing on subdomains (using lvh.me) in localhost. You can use https://serveo.net.
Simply use following command to forward your local server requests. No installation required.
ssh -R yoursubdomain.serveo.net:80:yoursubdomain.lvh.me:3000 serveo.net
you can put your desired port in place of 3000.
Reference: https://blog.aarvy.me/2019/09/20/expose-local-apps-having-subdomains-to-web/