windows 使用 Chromium Portable 时 Google API 密钥丢失警告消息
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21276763/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Google API Keys Missing Warning Message when using Chromium Portable
提问by Hyperion
When i use the new Chromium Portablebrowser it always shows "Google API keys are missing.Some functionality of Chromium Portable will be disabled"after starting up.
当我使用新的Chromium Portable浏览器时,它总是在启动后显示“Google API 密钥丢失。Chromium Portable 的某些功能将被禁用”。
How do i get rid of this warning message and what does it mean?.
我如何摆脱这个警告信息,它是什么意思?。
回答by mormegil
To get rid of the message...
为了摆脱消息...
...on Windows, you can use the command prompt to set the following environment variables to "no":
...在 Windows 上,您可以使用命令提示符将以下环境变量设置为“no”:
setx GOOGLE_API_KEY "no"
setx GOOGLE_DEFAULT_CLIENT_ID "no"
setx GOOGLE_DEFAULT_CLIENT_SECRET "no"
Windows' environment variables can also be setfrom the "Advanced System Settings" tab of the "System" control panel. After setx ...
relaunching the browser should no longer have the message. Setting the variables through the "Advanced System Settings" tab may require a log-out before it takes effect.
Windows 的环境变量也可以从“系统”控制面板的“高级系统设置”选项卡中设置。后setx ...
重新推出的浏览器应该不再有消息。通过“高级系统设置”选项卡设置变量可能需要注销才能生效。
... on Linux you can use the terminal to set the environment variables to "no" in the bash shell:
...在 Linux 上,您可以使用终端在 bash shell 中将环境变量设置为“no”:
export GOOGLE_API_KEY="no"
export GOOGLE_DEFAULT_CLIENT_ID="no"
export GOOGLE_DEFAULT_CLIENT_SECRET="no"
A subsequent launch of the browser from the terminal will not show the missing API key message. To make this setting permanent and to cover invocations from clicking on an icon, follow the directions here for setting environment variables that affect terminal as well as graphical logins.
随后从终端启动浏览器将不会显示丢失的 API 密钥消息。要使此设置永久化并涵盖通过单击图标进行的调用,请按照此处的说明设置影响终端和图形登录的环境变量。
...on macOS, you can add the following key-value pairs to the LSEnvironmentdictionary in Chromium.app > Contents > Info.plist:
...在 macOS 上,您可以将以下键值对添加到Chromium.app > Contents > Info.plist 中的LSEnvironment字典:
<key>LSEnvironment</key>
<dict>
<key>GOOGLE_API_KEY</key>
<string>no</string>
<key>GOOGLE_DEFAULT_CLIENT_ID</key>
<string>no</string>
<key>GOOGLE_DEFAULT_CLIENT_SECRET</key>
<string>no</string>
</dict>
(Note that macOS may have cached the existing Info.plist file, so changes may not take effect immediately. See this answerfor some ways around that.)
(请注意,macOS 可能已经缓存了现有的 Info.plist 文件,因此更改可能不会立即生效。有关解决此问题的一些方法,请参阅此答案。)
As for the meaning, I think Dragomir Goranov's answer gives sufficient information.
至于含义,我认为德拉戈米尔戈拉诺夫的回答提供了足够的信息。
回答by MattWeiler
I needed to get rid of this message too, so I just took what mormegilsuggested but applied it to a batch script that launches Chromium.
我也需要摆脱这条消息,所以我只是采用了mormegil 的建议,但将其应用于启动 Chromium 的批处理脚本。
My below sample batch file will launch Chromium into KIOSKmode but you can just remove the --kioskif you don't need that.
我下面的示例批处理文件会将 Chromium 启动到KIOSK模式,但如果不需要,您可以删除--kiosk。
set GOOGLE_API_KEY="no"
set GOOGLE_DEFAULT_CLIENT_ID="no"
set GOOGLE_DEFAULT_CLIENT_SECRET="no"
"C:\chromium\ChromiumPortable_49.0.2593.0.paf\App\Chromium\chrome.exe" --kiosk
I did it this way since I don't want to set those environment variables to affect other instances of Chromium but rather just the one that I'm launching with my batch script.
我这样做是因为我不想设置这些环境变量来影响 Chromium 的其他实例,而只想设置我使用批处理脚本启动的那个实例。
回答by Dragomir Goranov
It means that some functionality will not work. For example "Chrome Sync API" requires API keys. For more information you can check this URL: http://www.chromium.org/developers/how-tos/api-keys
这意味着某些功能将不起作用。例如,“Chrome Sync API”需要 API 密钥。有关更多信息,您可以查看此 URL:http: //www.chromium.org/developers/how-tos/api-keys
If something is not clear to you after you read the provided information, please specify exactly what.
如果您在阅读所提供的信息后有不清楚的地方,请具体说明是什么。
回答by Tormen
On macOS another (simpler) solution is:
在 macOS 上,另一个(更简单的)解决方案是:
/usr/bin/env GOOGLE_API_KEY="no" GOOGLE_DEFAULT_CLIENT_ID="no" GOOGLE_DEFAULT_CLIENT_SECRET="no" /usr/bin/open -a chromium
/usr/bin/env GOOGLE_API_KEY="no" GOOGLE_DEFAULT_CLIENT_ID="no" GOOGLE_DEFAULT_CLIENT_SECRET="no" /usr/bin/open -a chromium
as open passed existing environment variable to the launched application (see man open
).
作为 open 将现有环境变量传递给启动的应用程序(请参阅man open
)。
PS: I would have preferred to add that as a comment... but I can't as stackoverflow told me that I don't have enough reputation.
PS:我更愿意将其添加为评论......但我不能因为stackoverflow告诉我我没有足够的声誉。