How to add new API Give web_page to the Chromium project? - chromium

I want to add an api similar to chrome.app in chromium
I want this API can be used on all pages
I tried to use this solution to add an 'api', but it can only be used in plug-ins.
How to add new API extension to the Chromium project?
chrome/common/extensions/api/_api_features.json
"testApi":{
"channel": "stable",
"contexts": ["web_page"],
"matches": [
"<all_urls>"
]
}
This api is available on the chrome://setting and webstore pages but not on other pages.
How can I make it work on all pages?

Related

Add custom non-cms page to spartacus

There is a requirement to add a custom page without CMS Integration. So, far it is configured like described below.
RouterModule.forChild([{
path: 'test/bla',
component: TransactionListPageComponent,
canActivate: [AuthGuard]
}]),
The page is rendered without issues. Still there are calls against OCC CMS REST API which return 404. Can we avoid those calls?

How to get content page from third party cms instead of SAP commerce cloud in spartcus?

Instead of getting content pages from sap commerce CMS need to fetch it from other 3rd party CMS. Is it possible some how in spartcus
If you want to use a different backend throughout the project, you can set your own occBaseUrl as environment variable. If only a CMS page provider is the target, you can provide your own version of OccCmsPageAdapter which uses a different URL.
{
provide: CmsPageAdapter,
useClass: YourOccCmsPageAdapter,
},
See more in docs: https://sap.github.io/spartacus-docs/connecting-to-other-systems/

Symfony 4.2 and Nelmio Api Doc Bundle - Several documentation with multiple Controllers

I'm using Symfony 4 and Nelmio Api Doc Bundle to create a service that will be only accessible trough APIs (both public frontend and private back office will be created using a JS framework)
I need 2 documentations (maybe more later) :
/api/doc
/admin/doc
Right now I have some Controllers in src/Controllers/Admin and src/Controller/API since they are really different.
I don't understand how to use Nelmio Api Doc Bundle to handle the 2 documentations in 2 differents urls. I know there are areas but I just don't get how to deal with them...
Can someone help me by providing a simple example ?
Thanks
As you mention you need to configure the areas section of the nelmio_api_doc.yaml file as listed here https://symfony.com/doc/current/bundles/NelmioApiDocBundle/areas.html
In your case you would have the package nelmio_api_doc.yaml file as something like:
nelmio_api_doc:
areas:
default:
path_patterns: [ ^/api ]
admin:
path_patterns: [ ^/admin ]
Or whatever the patterns in your routes are to these so it knows which controller function(s) to check for the swagger annotations.
And in your routing config nelmio_api_doc.yaml:
app.swagger_ui:
path: /doc/{area}
methods: GET
defaults: { _controller: nelmio_api_doc.controller.swagger_ui, area: api }
So the api documentation will be accessible via /doc or /doc/api, any other areas can be accessed by adding appending the area name for example /doc/admin etc.
Note that I have set the route as /doc/ to prevent a conflict with the firewall pattern set for ^/api picking it up first as it may conflict, you could add an extra firewall rule to catch it first, I decided to just change the route for this.
If you went with the swagger ui route as /api/doc you would need to change the default area path patterns to:
path_patterns: [ ^/api(?!/doc$) ]
As show in the symfony docs.

Get embed URL through onedrive API

Is there a way to get the embed URL through onedrive's API.
An embed URL is a publicly accessible URL that does not require a login since it contains an authkey.
I did manage to get the cid and resid, however, I can't figure out how to get authkey. Is there any way to get it?
I'm currently on onedrive's python SDK.
You should be able to use the createLink API to request an embed link.
POST /me/drive/items/{item-id}/createLink
Content-Type: application/json
{
"type": "embed"
}
See this documentation for full details.
The SDK should also have createLink exposed so the above should map relatively easily into your use-case.

can content script run on https page chrome extensions development

i am developing a chrome extension, when i run content script on http page, it is ok. But i am confuse why it can't do on https page. Can content script run on https page. And my permissions id like that.
"permissions": [
"http://*/*",
"https://*/*",
"tabs"
],
In addition to including https in the permissions section of your manifest, you also need to include it in the matches section of the content_scripts section:
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"js": ["script.js"]
}
]
Content scripts work on https pages. There is probably some other issue.