WICG / manifest-incubations

Before install prompt API for installing web applications
https://wicg.github.io/manifest-incubations/
Other
98 stars 31 forks source link

Scope Extensions: Allow for path exclusions #105

Open jacobamills opened 1 month ago

jacobamills commented 1 month ago

In scope_extensions-explainer.md#future-extensions the following is mentioned as a possibility:

  • More specific scoping e.g. scope suffix or include/exclude lists or URL patterns.
    • To be able to apply these more specific scoping rules to the primary scope (including exclusion). One possible approach is to have the primary origin specified in the scope_extensions list and have it override the behaviour of scope.

For Google Meet, this is a blocker for us to be able to enable link capturing, as there are specific paths within our application that we do not want our PWA to handle.

Because our meeting codes are defined on the root path (e.g. meet.google.com/aaa-bbbb-ccc), we would specifically need path exclusion, rather than just inclusion. For example, we would want to be able to:

jacobamills commented 1 month ago

@dmurph Thank you for reaching out to me about this proposal

@LuHuangMSFT FYI

dmurph commented 1 month ago

Amazing, thank you for this use-case! This is incredibly valuable.

@LuHuangMSFT I think this matches with our previous convo. Notes are here

General conclusion currently:

Something kinda like this is the conclusion:

"scope": "https://www.example.com/app/",
"scope_extensions": [
       { "type": "origin", "value": "https://helpcenter.example-help-center.com" }
]
"scope_exclusions": [
  // This apples to all origins, so this removes any url with the prefixes:
  // https://www.example.com/app/scope/
  // https://helpcenter.example-help-center.com/app/scope/
  "/app/about/",

  // These only apply to the specific origins
  "https://helpcenter.example-help-center.com/abcd/"
  "https://www.example.com/app/phone-numbers",
]

Spec psuedo:

When evaluating if a url is controlled by the app (in scope of the app), the url must be within the manifest scope or the extended scope, but cannot be within scope exlusions.

possible psuedo algorithm:

To evaluate if a url is within scope of an app:
- set is_in_scope to false
- If the url is within the manifest.scope, set is_in_scope to true
- Else if the url is within the manifest.scope_extensions, set is_in_scope to true
- for each manifest.scope_exclusion |exclusion|
  - If url.path()  starts with exclusion, set is_in_scope to false
  - If url starts with exclusion, set is_in_scope to false.
- return is_in_scope
HowardWolosky commented 1 month ago

@dmurph - Is there a reason why scope_exclusions wouldn't follow the same format as scope_extensions?

dmurph commented 1 month ago

@HowardWolosky said:

@dmurph - Is there a reason why scope_exclusions wouldn't follow the same format as scope_extensions?

It can - if we want to make it extensible with the "type" and "value" fields, that can totally work. "type" maybe is "path_prefix" and "url_prefix"? That might make more sense for devs. We can totally iterate on design there.

I think the main "pro" of having this be separate from scope_extensions is that it seemed less confusing to:

But - if everyone else things we should just put this in the scope_extensions with types like "excludePathPrefix" and "excludeUrlPrefix", then I'm OK with that too.