在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:mozilla/sign-addon开源软件地址:https://github.com/mozilla/sign-addon开源编程语言:JavaScript 100.0%开源软件介绍:Sign Add-onSign a Firefox add-on with Mozilla's web service. Installation
Getting startedTo sign add-ons, you first need to generate API credentials, a JWT issuer and secret, from the AMO Developer Hub. Currently, this is intended for use in NodeJS only and should work in version 10 or higher. Programmatic useHere is how to retrieve a signed version of an XPI file: var { signAddon } = require('sign-addon');
signAddon({
// Required arguments:
xpiPath: '/path/to/your/addon.xpi',
version: '0.0.1',
apiKey: 'Your JWT issuer',
apiSecret: 'Your JWT secret',
// Optional arguments:
// The explicit extension ID.
// WebExtensions do not require an ID.
// See the notes below about dealing with IDs.
id: 'your-addon-id@somewhere',
// The release channel (listed or unlisted).
// Ignored for new add-ons, which are always unlisted.
// Default: most recently used channel.
channel: undefined,
// Save downloaded files to this directory.
// Default: current working directory.
downloadDir: undefined,
// Number of milliseconds to wait before aborting the request.
// Default: 15 minutes.
timeout: undefined,
// Optional proxy to use for all API requests,
// such as "http://yourproxy:6000"
// Read this for details on how proxy requests work:
// https://github.com/request/request#proxies
apiProxy: undefined,
// Optional object to pass to request() for additional configuration.
// Some properties such as 'url' cannot be defined here.
// Available options:
// https://github.com/request/request#requestoptions-callback
apiRequestConfig: undefined,
// Optional override to the number of seconds until the JWT token for
// the API request expires. This must match the expiration time that
// the API server accepts.
apiJwtExpiresIn: undefined,
// Optional override to the URL prefix of the signing API.
// The production instance of the API will be used by default.
apiUrlPrefix: 'https://addons.mozilla.org/api/v4',
})
.then(function (result) {
if (result.success) {
console.log('The following signed files were downloaded:');
console.log(result.downloadedFiles);
console.log('Your extension ID is:');
console.log(result.id);
} else {
console.error('Your add-on could not be signed!');
console.error('Error code: ' + result.errorCode);
console.error('Details: ' + result.errorDetails);
}
console.log(result.success ? 'SUCCESS' : 'FAIL');
})
.catch(function (error) {
console.error('Signing error:', error);
}); In ES6 code, you can import it more concisely: import { signAddon } from 'sign-addon'; Dealing With Extension IDsHere are some notes about dealing with IDs when using
DevelopmentHere's how to set up a development environment for the
PrettierWe use Prettier to automatically format our JavaScript code and stop all the on-going debates over styles. As a developer, you have to run it (with Useful commandsIn the project directory, you can run the following commands. There are a few commands not mentioned here (see
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论