How can I include TTS in a Chrome App? - google-chrome

I'm trying to use text-to-speech in a Chrome app, but I'm getting an error when trying to load the app.
My manifest.json looks like this:
{
"name": "APPNAME",
"description": "DESCRIPTION",
"version": "3",
"app": {
"urls": ["APPURL"],
"launch": {"web_url": "APPURL"}
},
"icons": {"24": "icon24.png", "128": "icon128.png"},
"permissions": ["tts"]
}
The error I'm getting reads "Could not load extension from <PATH>. Access to permission 'tts' denied."
Removing the "app" part of the manifest seems to allow it to load without problems. That would make me think that TTS is limited to Chrome extensions, but the docs suggest otherwise. Changing the "tts" permission to the "cookies" permission results in the same error, but changing it to "clipboardRead" does not.
I'm attempting to load the app via: Tools > Extensions > Load unpacked extension, and I'm using Chrome 16 on Ubuntu 11.10.
Can anyone tell me what I'm doing wrong?

It turned out that some permissions are only available for extensions and packaged apps. I was trying to use tts with a webapp, which is unfortunately not available.
That said, the Web Speech API is now available, along with Speech Synthesis.

Related

Unable to publish the chrome extension to public

I am trying to publish an chrome extension with following manifest file.
Every time I publish my app it is getting rejected.
Updated
{
"manifest_version": 2,
"name": "Aiwozo",
"description": "AI Work Zone Web Automation Extension is an component developed for browser interaction to implement automation on web applications.",
"version": "1.1",
"icons": {
"16":"static/activate_icons/Aiwozo16.png",
"32":"static/activate_icons/Aiwozo32.png",
"64": "static/activate_icons/Aiwozo64.png",
"128":"static/activate_icons/Aiwozo128.png"
},
"background":{
"scripts":["background.js"]
},
"browser_action": {
"default_icon": {
"16":"static/activate_icons/Aiwozo16.png",
"32":"static/activate_icons/Aiwozo32.png",
"64": "static/activate_icons/Aiwozo64.png",
"128":"static/activate_icons/Aiwozo128.png"
},
"default_title": "Artificial Intelligence Work Zone"
},
"permissions": ["nativeMessaging", "<all_urls>"],
"web_accessible_resources": [ "css/general.css", "static/activate_icons/AIwozo16.png", "static/activate_icons/AIwozo32.png", "static/activate_icons/AIwozo64.png", "static/activate_icons/AIwozo128.png", "static/deactivate_icons/AIwozo16.png", "static/deactivate_icons/AIwozo32.png", "static/deactivate_icons/AIwozo64.png", "static/deactivate_icons/AIwozo128.png"]
}
It seems that Google now requires you, the developer, to provide an explanation of what your extension does (according to Single Purpose Policy) and an explanation of why specific permissions are needed.
This is on the Privacy tab of the "new" Developer Dashboard's listing:
Until those fields are filled out, Web Store blocks publishing of new extensions and updated versions of existing extensions.
On the plus side: it doesn't mean you have failed a review yet. So with good explanations you may be able to get this published. In your particualr case though, those are broad permissions + arbitrary code execution. It will be tough.
Try with
"version": "1.0",
Instead of
"version": "0.01",

How does chrome.browserAction work?

Im trying to develop my first chrome extension and am running into an issue. Firstly I am using the following boilerplate as a page action:
http://extensionizr.com/!#{"modules":["browser-mode","with-persistent-bg","no-bg","with-custom-options","no-override","inject-css","inject-js","jquerymin"],"boolean_perms":["contentSettings","cookies","notifications"],"match_ptrns":[]}
In the inject.js, it downloads a list of urls from a remote server, checks the current url and if it matches it should do something. I was going to use a notification but I guess the notification comes from the current page and not the extension. So if you start the notification it will say "Do you want to enable notifications for amazon". Then I moved on to changing the icon. I would prefer doing both eventually. However, when I try and set text with the following:
chrome.browserAction.setIcon({path: 'icons/icon128-x.png'});
However, this is what I get in the console.
Uncaught TypeError: Cannot read property 'setIcon' of undefined
Any ideas?
you can't access chrome.browserAction in content.js, according to chrome extension document Content Scripts
Additionally, content script can access the following chrome APIs directly:
i18n
storage
runtime:
connect
getManifest
getURL
id
onConnect
onMessage
sendMessage
Content scripts are unable to access other APIs directly.
The extension manifest needs a "browser_action" section before the chrome.browserAction API is available to it:
Register your browser action in the extension manifest like this:
{
"name": "My extension",
...
"browser_action": {
"default_icon": { // optional
"19": "images/icon19.png", // optional
"38": "images/icon38.png" // optional
},
"default_title": "Google Mail", // optional; shown in tooltip
"default_popup": "popup.html" // optional
},
...
}
(From https://developer.chrome.com/extensions/browserAction#manifest.)

Is it possible to create multiple Chrome Hosted Apps for the same domain?

Our product has both a free component, and a full featured, subscription based web application. I've created a Chrome Hosted App - essentially an installable bookmark - for each both of those parts of our product.
The interesting parts of the app manifests are as follow:
"manifest_version": 2,
"app": {
"launch": {
"container": "tab",
"web_url": "https://paydirtapp.com/dashboard"
}
}
"manifest_version": 2,
"app": {
"launch": {
"container": "tab",
"web_url": "https://paydirtapp.com/free_invoice_creator"
}
}
I can install the free invoice creator app, and the full featured app, but not both at the same time.
Attempting to do so (in Chrome 26.0.1410.10 (Official Build 183151) dev) causes the following error message:
"An error has occurred. Could not add the application because it conflicts with "Free Invoice Maker".
The only reference I can find to this issue is in https://developers.google.com/chrome/apps/docs/developers_guide#manifest, where they state the following:
Important: If you provide multiple apps, avoid overlapping URLs. If a user tries to install an app whose "web_url" or "urls" values overlap with those of an already installed app, the second installation will fail due to URL conflict errors. For example, an app that specifies a "urls" value of "http://mail.example.com/" would conflict with an app that specifies "http://mail.example.com/mail/".
Previously, my web_url value was just set to https://paydirtapp.com/, which caused the same error. I expected that updating it so that it wasn't a substring of the other app would solve the problem, but it hasn't.
Does anyone know if it's possible to have multiple Chrome Hosted Apps where the web_url is for the same domain?
Answer from Moshe Matz (copy from comment):
Using separate subdomains for each app should work.
For example, use https://dashboard.paydirtapp.com and https://free_invoice_creator.paydirtapp.com. You will likely need a new SSL certificate that contains both of those names.
Separate subdomains should work. We don't currently have a solution for the same domain case.

Google Drive SDK - DrEdit Python - Web Store Manifest

I've been trying to work through the DrEdit python example for the Google Drive SDK. When I get to step 4, create a web store listing, I'm encountering a problem. I modified the manifest.json file as described. However, after I create the manifest.zip file, I am unable to upload the manifest archive from the web store developer dashboard. I receive the following error message:
"An error occurred: Invalid manifest. If your manifest includes comments, please remove them as our gallery does not support them yet."
Now, if I remove the 'container' and 'api_console_project_id' entries from the manifest, it uploads fine. However, without these entries, the DrEdit application will not be "integrated into Google Drive", correct?
I also tried to install the manifest in Google Chrome directly (developer mode). In this case, I get warnings about the two entries in question (not recognized).
How do I resolve this issue? Is it possible that the "Setting up the sample application" documentation is out of date?
(edit)
Manifest File:
{
"name" : "DrEdit",
"version" : "1.0.0.0",
"manifest_version": 2,
"description" : "Test Google Drive application",
"container" : "GOOGLE_DRIVE",
"api_console_project_id" : "dpederson-gae-dredit-api",
"icons": {
"128": "icon-128.png"
},
"app" : {
"launch" : {
"web_url" : "https://dpederson-gae-dredit.appspot.com"
}
}
}
The api_console_project_id field is invalid. It should match the App ID value from the Drive SDK tab of the APIs Console, the one you got when registering the app as explained at https://developers.google.com/drive/register
It should match the CLIENT_ID. More exactly the xxxxxxxx part from the xxxxxxxxx.apps.googleusercontent.com

Start an external application from a Google Chrome Extension?

How to start an external application from a Google Chrome Extension?
So basically I have an executable file which does the job when you launch it. I need to be able to start it without a window (it is a console application) and pass the current URL to it in an argument,
Previously, you would do this through NPAPI plugins.
However, Google is now phasing out NPAPI for Chrome, so the preferred way to do this is using the native messaging API. The external application would have to register a native messaging host in order to exchange messages with your application.
You can't launch arbitrary commands, but if your users are willing to go through some extra setup, you can use custom protocols.
E.g. you have the users set things up so that some-app:// links start "SomeApp", and then in my-awesome-extension you open a tab pointing to some-app://some-data-the-app-wants, and you're good to go!
Native messaging host
Chrome-extensions
{
"name": "AppName",
"description": "",
"version": "1.0",
"manifest_version": 3,
"permissions": [
"nativeMessaging" // 👈 https://developer.chrome.com/docs/extensions/mv3/declare_permissions/
]
// ...
}
Host
Add schema
#echo off
:: If you add "/f" then you can force write.
REG ADD "HKCU\Software\Google\Chrome\NativeMessagingHosts\com.my_company.my_application" ^
/ve /t REG_SZ ^
/d "%~dp0Mymanifest.json"
// Mymanifest.json
{
"name": "com.my_company.my_application",
"description": "My Application",
"path": "relative_dir/my.exe",
"type": "stdio",
"allowed_origins": [
"chrome-extension://nbjjflbnekmabedahdolabcpahfjojjb/"
]
}
chrome.runtime.sendNativeMessage
example:
// your.js
chrome.runtime.sendNativeMessage("com.my_company.my_application",
{key1: "value1", key2: "value2"}, // 👈 Send those parameters to your program.
(response) => {
console.log(response)
}
)
Example repository
I have created a project thunder/e11fde9 whose ultimate goal is to be able to use a browser as input and then open a specified file locally (without a mouse, if possible)
It is still in development, but I think the early code is enough. The link is below.
chrome-ext A test Chrome extension.
go I built an EXE with Golang and put it on the host/bin to simulate the local program.
host Install the schema and specify the program. (see manifest.json)
Which already has a log that records the results of the browser's transmission, while the browser can also get the program's return value.
Reference
GoogleChrome/chrome-extensions-samples
It's useful, and it provides a way to use python to communicate.
jfarleyx/chrome-native-messaging-golang
use golang to communicate.
I go for hypothesys since I can't verify now.
With Apache, if you make a php script on your local machine calling your executable, and then call this script via POST or GET via html/javascript?
would it function?
let me know.