Edit/Add /.well-known/assetlinks.json file to glitch project

Hello! I am trying to edit the assetlinks.json file that seems to have come pre configured when I remixed the google passkeys codelab. I tried to access it through the terminal, and it informed me the file did not exist but when I accessed it directly through the link, it showed me a json.

I followed this post (How to enable directories starting with "."? - #3 by Johnicholas) to enable the .well-known directory but I still was not able to enter the folder through the terminal. I then added the file through the file editor, but any changed I did were not reflected through the link shown above. Please help!

Code change in package.json

"scripts": {
    "build": "webpack",
    "start": "node server.mjs'"
  },

to

"scripts": {
    "build": "webpack",
    "start": "node server.mjs && ws --port 3000 --log.format combined --directory . --blacklist '/.env' '/.data' '/.data/(.*)' '/.git' '/.git/(.*)'"
  },

When i cat /.well-known/assetlinks.json in the terminal:

app@pleasant-plum-lettuce:~/.well-known 02:54 
$ cat assetlinks.json
[{"relation":["delegate_permission/common.handle_all_urls","delegate_permission/common.get_login_creds"],"target":{"namespaaaaace":"web","site":"https://pleasant-plum-lettuce.glitch.me"}}]

When I access link: https://pleasant-plum-lettuce.glitch.me/.well-known/assetlinks.json

[{"relation":["delegate_permission/common.handle_all_urls","delegate_permission/common.get_login_creds"],"target":{"namespace":"web","site":"https://pleasant-plum-lettuce.glitch.me"}}]

Google passkeys codelab link https://passkeys-codelab.glitch.me/

Hey @Jonathan, welcome to the Glitch forum!

In this project, the content at ~/.well-known/assetslinks.json is being generated by your server.mjs file. If you take a look at these lines you can see the code that automatically generates the assetlinks.

Also relevant is this line, which tells your project to use the contents of the public directory as static files.

If you want to work directly with the assetlinks.json content without having your project generate it dynamically, you should be able to move your assetlinks.json file to public/.well-known/assetlinks.json and your project will pick it up and serve instead of the generated-by-code content.

Hope this helps!
cori

Hi @cori , thank you for the response! It seemed to work, as when I accessed https://pleasant-plum-lettuce.glitch.me/.well-known/assetlinks.json, it shows the updated link after moving it to public/.well-known/assetlinks.json. However, the file disappeared from the file explorer on the left of the screen and I cannot seem to cd into the .well-known directory in public. Any ideas to fix this?

Edit: typing cd public/.well-known seems to work, can I put it in the file explorer on the left at least?

That’s correct, Jonathan, this is a feature of the Glitch Editor that’s not explained clearly in the post you linked to.

In part because folks use hidden directories and files to store possibly-private information, by convention the Editor hides those files and directories from the graphical directory listing (with the exception of the .env file’s specific Editor pane). You’ll need to use the terminal to manage those files as you have discovered.

Hope this helps!
cori

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.