8000 feat: introduce donation links in update flow by giacomocusinato · Pull Request #2581 · arduino/arduino-ide · GitHub
[go: up one dir, main page]

Skip to content

feat: introduce donation links in update flow #2581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
feat: use dompurify to sanitize translations
Pin same version of `dompurify` used in Theia
  • Loading branch information
giacomocusinato committed Dec 2, 2024
commit 08d83dc112c18ea16ff1424774dc050a8f8bb403
1 change: 1 addition & 0 deletions arduino-ide-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"cross-fetch": "^3.1.5",
"dateformat": "^3.0.3",
"deepmerge": "^4.2.2",
"dompurify": "^2.4.7",
"drivelist": "^9.2.4",
"electron-updater": "^4.6.5",
"fast-deep-equal": "^3.1.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
} from '../../../common/protocol/ide-updater';
import { LocalStorageService } from '@theia/core/lib/browser';
import { WindowService } from '@theia/core/lib/browser/window/window-service';
import { sanitize } from 'dompurify';

@injectable()
export class IDEUpdaterDialogProps extends DialogProps {}
Expand Down Expand Up @@ -173,9 +174,8 @@ export class IDEUpdaterDialog extends ReactDialog<UpdateInfo | undefined> {
footer.appendChild(footerContent);

const footerLink = document.createElement('a');
footerLink.innerText = nls.localize(
'arduino/ide-updater/donateLinkText',
'donate to support us'
footerLink.innerText = sanitize(
nls.localize('arduino/ide-updater/donateLinkText', 'donate to support us')
);
footerLink.classList.add('ide-updater-dialog--footer-link');
footerLink.onclick = () =>
Expand All @@ -190,10 +190,12 @@ export class IDEUpdaterDialog extends ReactDialog<UpdateInfo | undefined> {
footerLink.appendChild(footerLinkIcon);

const placeholderKey = '%%link%%';
const footerText = nls.localize(
'arduino/ide-updater/donateText',
'Open source is love, {0}',
placeholderKey
const footerText = sanitize(
nls.localize(
'arduino/ide-updater/donateText',
'Open source is love, {0}',
placeholderKey
)
);
const placeholder = footerText.indexOf(placeholderKey);
if (placeholder !== -1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { nls } from '@theia/core';
import { DialogProps } from '@theia/core/lib/browser';
import { WindowService } from '@theia/core/lib/browser/window/window-service';
import { AppService } from '../app-service';
import { sanitize } from 'dompurify';

@injectable()
export class VersionWelcomeDialogProps extends DialogProps {}
Expand Down Expand Up @@ -87,10 +88,12 @@ export class VersionWelcomeDialog extends ReactDialog<void> {
const { appVersion } = appInfo;

if (appVersion) {
this.titleNode.innerHTML = nls.localize(
'arduino/versionWelcome/titleWithVersion',
'Welcome to the new Arduino IDE {0}!',
appVersion
this.titleNode.innerText = sanitize(
nls.localize(
'arduino/versionWelcome/titleWithVersion',
'Welcome to the new Arduino IDE {0}!',
appVersion
)
);
}
}
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5937,6 +5937,11 @@ dompurify@^2.2.9:
resolved "https://registry.yarnpkg.com 6567 /dompurify/-/dompurify-2.4.7.tgz#277adeb40a2c84be2d42a8bcd45f582bfa4d0cfc"
integrity sha512-kxxKlPEDa6Nc5WJi+qRgPbOAbgTpSULL+vI3NUXsZMlkJxTqYI9wg5ZTay2sFrdZRWHPWNi+EdAhcJf81WtoMQ==

dompurify@^2.4.7:
version "2.5.7"
resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-2.5.7.tgz#6e0d36b9177db5a99f18ade1f28579db5ab839d7"
integrity sha512-2q4bEI+coQM8f5ez7kt2xclg1XsecaV9ASJk/54vwlfRRNQfDqJz2pzQ8t0Ix/ToBpXlVjrRIx7pFC/o8itG2Q==

dot-case@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/dot-case/-/dot-case-3.0.4.tgz#9b2b670d00a431667a8a75ba29cd1b98809ce751"
Expand Down
Loading
0