Add software acknowledgments, link to them from About window
This commit is contained in:
parent
42db239001
commit
eba1bf3100
9 changed files with 3058 additions and 6 deletions
2910
ACKNOWLEDGMENTS.md
Normal file
2910
ACKNOWLEDGMENTS.md
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,8 @@
|
||||||
{
|
{
|
||||||
|
"softwareAcknowledgments": {
|
||||||
|
"message": "Software Acknowledgments",
|
||||||
|
"description": "Shown in the about box for the link to software acknowledgments"
|
||||||
|
},
|
||||||
"privacyPolicy": {
|
"privacyPolicy": {
|
||||||
"message": "Terms & Privacy Policy",
|
"message": "Terms & Privacy Policy",
|
||||||
"description": "Shown in the about box for the link to https://signal.org/legal"
|
"description": "Shown in the about box for the link to https://signal.org/legal"
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
<link href="stylesheets/manifest.css" rel="stylesheet" type="text/css" />
|
<link href="stylesheets/manifest.css" rel="stylesheet" type="text/css" />
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background-color: #3a76f0;
|
background-color: #3a76f0;
|
||||||
|
@ -35,7 +38,7 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class='module-splash-screen'>
|
<div class='module-splash-screen'>
|
||||||
<div class='module-splash-screen__logo module-img--200'></div>
|
<div class='module-splash-screen__logo module-img--150'></div>
|
||||||
|
|
||||||
<div class='version'></div>
|
<div class='version'></div>
|
||||||
<div class='environment'></div>
|
<div class='environment'></div>
|
||||||
|
@ -43,6 +46,9 @@
|
||||||
<a href='https://signal.org'>signal.org</a>
|
<a href='https://signal.org'>signal.org</a>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
|
<div>
|
||||||
|
<a class="acknowledgments" href="https://github.com/signalapp/Signal-Desktop/blob/development/ACKNOWLEDGMENTS.md">Software Acknowledgments</a>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<a class="privacy" href="https://signal.org/legal">Terms & Privacy Policy</a>
|
<a class="privacy" href="https://signal.org/legal">Terms & Privacy Policy</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -22,5 +22,6 @@ $(document).on('keydown', e => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Localize the privacy string
|
// Localize the acknowledgment and privacy strings
|
||||||
|
$('.acknowledgments').text(window.i18n('softwareAcknowledgments'));
|
||||||
$('.privacy').text(window.i18n('privacyPolicy'));
|
$('.privacy').text(window.i18n('privacyPolicy'));
|
||||||
|
|
2
main.js
2
main.js
|
@ -590,7 +590,7 @@ function showAbout() {
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
width: 500,
|
width: 500,
|
||||||
height: 400,
|
height: 500,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
title: locale.messages.aboutSignalDesktop.message,
|
title: locale.messages.aboutSignalDesktop.message,
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
|
|
|
@ -12,7 +12,8 @@
|
||||||
},
|
},
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postinstall": "snyk protect && patch-package && electron-builder install-app-deps && rimraf node_modules/dtrace-provider",
|
"postinstall": "yarn build:acknowledgments && snyk protect && patch-package && electron-builder install-app-deps && rimraf node_modules/dtrace-provider",
|
||||||
|
"postuninstall": "yarn build:acknowledgments",
|
||||||
"start": "electron .",
|
"start": "electron .",
|
||||||
"grunt": "grunt",
|
"grunt": "grunt",
|
||||||
"generate": "yarn grunt",
|
"generate": "yarn grunt",
|
||||||
|
@ -46,6 +47,7 @@
|
||||||
"dev:typed-scss": "yarn build:typed-scss -w",
|
"dev:typed-scss": "yarn build:typed-scss -w",
|
||||||
"dev:storybook": "cross-env SIGNAL_ENV=storybook start-storybook -p 6006 -s ./",
|
"dev:storybook": "cross-env SIGNAL_ENV=storybook start-storybook -p 6006 -s ./",
|
||||||
"build": "run-s --print-label build:grunt build:typed-scss build:webpack build:release build:zip",
|
"build": "run-s --print-label build:grunt build:typed-scss build:webpack build:release build:zip",
|
||||||
|
"build:acknowledgments": "node scripts/generate-acknowledgments.js",
|
||||||
"build:dev": "run-s --print-label build:grunt build:typed-scss build:webpack",
|
"build:dev": "run-s --print-label build:grunt build:typed-scss build:webpack",
|
||||||
"build:grunt": "yarn grunt",
|
"build:grunt": "yarn grunt",
|
||||||
"build:typed-scss": "tsm sticker-creator",
|
"build:typed-scss": "tsm sticker-creator",
|
||||||
|
|
11
scripts/.eslintrc.js
Normal file
11
scripts/.eslintrc.js
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
module.exports = {
|
||||||
|
rules: {
|
||||||
|
// We still get the value of this rule, it just allows for dev deps
|
||||||
|
'import/no-extraneous-dependencies': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
devDependencies: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
109
scripts/generate-acknowledgments.js
Normal file
109
scripts/generate-acknowledgments.js
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
/* eslint-disable no-console */
|
||||||
|
const assert = require('assert');
|
||||||
|
const fs = require('fs');
|
||||||
|
const { join } = require('path');
|
||||||
|
const pMap = require('p-map');
|
||||||
|
const prettier = require('prettier');
|
||||||
|
|
||||||
|
const {
|
||||||
|
dependencies = {},
|
||||||
|
optionalDependencies = {},
|
||||||
|
} = require('../package.json');
|
||||||
|
|
||||||
|
const SKIPPED_DEPENDENCIES = new Set(['ringrtc', 'zkgroup']);
|
||||||
|
|
||||||
|
const rootDir = join(__dirname, '..');
|
||||||
|
const nodeModulesPath = join(rootDir, 'node_modules');
|
||||||
|
const destinationPath = join(rootDir, 'ACKNOWLEDGMENTS.md');
|
||||||
|
|
||||||
|
function isLicenseFileName(fileName) {
|
||||||
|
return /^licen[s|c]e/i.test(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getMarkdownForDependency(dependencyName) {
|
||||||
|
let licenseBody;
|
||||||
|
|
||||||
|
// fs-xattr is an optional dependency that may fail to install (on Windows, most
|
||||||
|
// commonly), so we have a special case for it here. We may need to do something
|
||||||
|
// similar for new optionalDependencies in the future.
|
||||||
|
if (dependencyName === 'fs-xattr') {
|
||||||
|
licenseBody = 'License: MIT';
|
||||||
|
} else {
|
||||||
|
const dependencyRootPath = join(nodeModulesPath, dependencyName);
|
||||||
|
|
||||||
|
const licenseFileName = (
|
||||||
|
await fs.promises.readdir(dependencyRootPath)
|
||||||
|
).find(isLicenseFileName);
|
||||||
|
|
||||||
|
if (licenseFileName) {
|
||||||
|
const licenseFilePath = join(dependencyRootPath, licenseFileName);
|
||||||
|
licenseBody = (
|
||||||
|
await fs.promises.readFile(licenseFilePath, 'utf8')
|
||||||
|
).trim();
|
||||||
|
} else {
|
||||||
|
const packageJsonPath = join(dependencyRootPath, 'package.json');
|
||||||
|
const { license } = JSON.parse(
|
||||||
|
await fs.promises.readFile(packageJsonPath)
|
||||||
|
);
|
||||||
|
if (!license) {
|
||||||
|
throw new Error(`Could not find license for ${dependencyName}`);
|
||||||
|
}
|
||||||
|
licenseBody = `License: ${license}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
`## ${dependencyName}`,
|
||||||
|
'',
|
||||||
|
...licenseBody.split(/\r?\n/).map(line => {
|
||||||
|
const trimmed = line.trim();
|
||||||
|
if (trimmed) {
|
||||||
|
return ` ${trimmed}`;
|
||||||
|
}
|
||||||
|
return trimmed;
|
||||||
|
}),
|
||||||
|
].join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
assert.deepStrictEqual(
|
||||||
|
Object.keys(optionalDependencies),
|
||||||
|
['fs-xattr'],
|
||||||
|
'Unexpected optionalDependencies when generating acknowledgments file. To ensure that this file is generated deterministically, make sure to special-case it the acknowledgments generation script.'
|
||||||
|
);
|
||||||
|
|
||||||
|
const dependencyNames = [
|
||||||
|
...Object.keys(dependencies),
|
||||||
|
...Object.keys(optionalDependencies),
|
||||||
|
]
|
||||||
|
.filter(name => !SKIPPED_DEPENDENCIES.has(name))
|
||||||
|
.sort();
|
||||||
|
|
||||||
|
const markdownsForDependency = await pMap(
|
||||||
|
dependencyNames,
|
||||||
|
getMarkdownForDependency,
|
||||||
|
// Without this, we may run into "too many open files" errors.
|
||||||
|
{ concurrency: 100 }
|
||||||
|
);
|
||||||
|
|
||||||
|
const unformattedOutput = [
|
||||||
|
'# Acknowledgments',
|
||||||
|
'',
|
||||||
|
'Signal Desktop makes use of the following open source projects.',
|
||||||
|
'',
|
||||||
|
markdownsForDependency.join('\n\n'),
|
||||||
|
].join('\n');
|
||||||
|
|
||||||
|
const prettierConfig = await prettier.resolveConfig(destinationPath);
|
||||||
|
const output = prettier.format(unformattedOutput, {
|
||||||
|
...prettierConfig,
|
||||||
|
filepath: destinationPath,
|
||||||
|
});
|
||||||
|
|
||||||
|
await fs.promises.writeFile(destinationPath, output);
|
||||||
|
}
|
||||||
|
|
||||||
|
main().catch(err => {
|
||||||
|
console.error(err);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
|
@ -154,10 +154,19 @@
|
||||||
{
|
{
|
||||||
"rule": "jQuery-$(",
|
"rule": "jQuery-$(",
|
||||||
"path": "js/about_start.js",
|
"path": "js/about_start.js",
|
||||||
"line": "$('.privacy').text(window.i18n('privacyPolicy'));",
|
"line": "$('.acknowledgments').text(window.i18n('softwareAcknowledgments'));",
|
||||||
"lineNumber": 26,
|
"lineNumber": 26,
|
||||||
"reasonCategory": "usageTrusted",
|
"reasonCategory": "usageTrusted",
|
||||||
"updated": "2018-09-19T21:59:32.770Z",
|
"updated": "2020-09-16T14:49:26.520Z",
|
||||||
|
"reasonDetail": "Protected from arbitrary input"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "jQuery-$(",
|
||||||
|
"path": "js/about_start.js",
|
||||||
|
"line": "$('.privacy').text(window.i18n('privacyPolicy'));",
|
||||||
|
"lineNumber": 27,
|
||||||
|
"reasonCategory": "usageTrusted",
|
||||||
|
"updated": "2020-09-16T14:49:26.520Z",
|
||||||
"reasonDetail": "Protected from arbitrary input"
|
"reasonDetail": "Protected from arbitrary input"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue