Skip to content

Commit

Permalink
fix(suite): use markdown componnt in Available dialog for Suite Upgra…
Browse files Browse the repository at this point in the history
…de as well, remove no longer used 'notes' field for releases
  • Loading branch information
peter-sanderson committed Jul 18, 2024
1 parent b6b297e commit e240c63
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 130 deletions.
63 changes: 16 additions & 47 deletions packages/connect-common/files/firmware/t1b1/releases.json

Large diffs are not rendered by default.

16 changes: 0 additions & 16 deletions packages/connect-common/files/firmware/t2t1/releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"url_bitcoinonly": "firmware/t2t1/trezor-t2t1-2.6.0-bitcoinonly.bin",
"fingerprint": "050526db604b9acceef2a5a8561bc99ecbe337909283ebb927b556d8e9b13872",
"fingerprint_bitcoinonly": "54f084dab4be1e64dc2cb970a6de87969407e4d6c48d79acdcf5d374ec0f29d6",
"notes": "https://trezor.io/learn/a/trezor-device-firmware-update-april-2023",
"changelog": "* Show source account path in BTC signing. \n* Address confirmation screen added to EIP712 signing flow. \n* Ability to reboot the device into bootloader mode directly, without needing to unplug the device. \n* Support for Ledger Live legacy derivation path \"m/44'/coin_type'/0'/account\". \n* Redesigned UI. \n* Homescreen now supports full-screen images. \n* Force basic attestation in FIDO2 for google.com."
},
{
Expand All @@ -71,7 +70,6 @@
"url_bitcoinonly": "firmware/t2t1/trezor-t2t1-2.5.3-bitcoinonly.bin",
"fingerprint": "4f57dca1abc1a60d82c4fef7c96e86d784fc7a1e5e3da724dd2ae4d14c6350bf",
"fingerprint_bitcoinonly": "c094c84ba958129885fa725ee6ddb781b580fd2c7851e83aef9054ba4a10526c",
"notes": "https://blog.trezor.io/trezor-suite-and-trezor-model-t-firmware-update-november-2022-a0b30bb0abf5",
"changelog": "* Add SLIP-0025 coinjoin accounts. \n* Show red error header when Trezor doesn't see USB data connection. \n* Add support for Zcash unified addresses. \n* Show fee rate when replacing transaction. \n* Optimize the signing of BTC transactions. \n* Support for Cardano CIP-36 governance registration format. \n* Extend decimals of fee rate to 2 digits. \n* Display only “sat” instead of “sat BTC”. \n* Fix sending XMR transaction to an integrated address. \n* Fix XMR primary address display."
},
{
Expand All @@ -83,7 +81,6 @@
"url_bitcoinonly": "firmware/t2t1/trezor-t2t1-2.5.2-bitcoinonly.bin",
"fingerprint": "659b1b698546fa63f24200e148b6f9a7044df31d11a0a5ec7c044f2dd83f4a27",
"fingerprint_bitcoinonly": "76aa25f9602cfb03cd3e07a82ac09226344eb355355aec216295e43b675eedf7",
"notes": "https://blog.trezor.io/trezor-suite-and-firmware-updates-august-2022-a4e3d76214c1",
"changelog": "* Add support for Monero HF15 features. \n* Show the fee rate on the signing confirmation screen. \n* Support for Cardano Babbage era transaction items \n* Add \"Show All\"/\"Show Simple\" choice to Cardano transaction signing \n* Show thousands separator when displaying large amounts. \n* Fix Decred transaction weight calculation."
},
{
Expand All @@ -95,7 +92,6 @@
"url_bitcoinonly": "firmware/t2t1/trezor-t2t1-2.5.1-bitcoinonly.bin",
"fingerprint": "782d4934897018cac779eebb0d7c66e21da7789b9cd35e1f99f097bdfd9b7d33",
"fingerprint_bitcoinonly": "db5d7b211532f717a32fe0b1bd3e3df6ad5464079a896a7f7492ab6e9e030bb5",
"notes": "https://blog.trezor.io/trezor-suite-and-firmware-updates-may-2022-b1af60742291",
"changelog": "* Support Electrum signatures in VerifyMessage.\n* Support Cardano Alonzo-era transactions (Plutus).\n* Bitcoin bech32 addresses QR codes have bigger pixels which are easier to scan.\n* EIP-1559 transaction correctly show final Hold to Confirm screen.\n* Trezor will refuse to sign UTXOs that do not match the provided derivation path (e.g., transactions belonging to a different wallet, or synthetic transaction inputs).\n* Zcash v5 transaction format."
},
{
Expand All @@ -107,7 +103,6 @@
"url_bitcoinonly": "firmware/t2t1/trezor-t2t1-2.4.3-bitcoinonly.bin",
"fingerprint": "a07f69d8d2065006a79c6b5636bd046496dbcb3820b41f1d604d8a4605ca4056",
"fingerprint_bitcoinonly": "1744efccabd479526392b281b7e0fc7aa2b4ecb454007dff7ca8c1f8171fad90",
"notes": "https://blog.trezor.io/trezor-suite-and-firmware-updates-december-2021-d1e74c3ea283",
"changelog": "* Support Taproot.\n* Show address confirmation in SignMessage.\n* Support for advanced Cardano transactions and different derivations for compatibility.\n* Ethereum support for EIP712 (signing typed data)."
},
{
Expand All @@ -119,7 +114,6 @@
"url_bitcoinonly": "firmware/t2t1/trezor-t2t1-2.4.2-bitcoinonly.bin",
"fingerprint": "54ccf155510b5292bd17ed748409d0d135112e24e62eb74184639460beecb213",
"fingerprint_bitcoinonly": "60fee3c9775d8ccf71099f6f7d277463efd128414cfb9be45656b1a26eeb7301",
"notes": "https://blog.trezor.io/trezor-suite-and-firmware-updates-september-2021-a490f2ea16c1",
"changelog": "* Support for Ethereum EIP1559 transactions.\n* Re-enabled Firo support.\n* Memory optimization of BTC signing and CBOR decoding.\n* Support for large Cardano transactions.\n* Remove Lisk."
},
{
Expand All @@ -131,7 +125,6 @@
"url_bitcoinonly": "firmware/t2t1/trezor-t2t1-2.4.1-bitcoinonly.bin",
"fingerprint": "84bc47bb197b3ae7bfb096f03d4a528ccf6c9ef4dfee0aac4022971e4ec91d68",
"fingerprint_bitcoinonly": "fce4503fcadb68dc72144a562ec0a59e7c8d083e403e01bfc4c584161d79f596",
"notes": "https://blog.trezor.io/trezor-suite-launches-8958c1d37d33",
"changelog": "* Security and major perfomance improvements.\n* Cardano fixes.\n* Fix red screen on shutdown."
},
{
Expand All @@ -143,7 +136,6 @@
"url_bitcoinonly": "firmware/t2t1/trezor-t2t1-2.4.0-bitcoinonly.bin",
"fingerprint": "d90265ee6d7d499c7d938b5322f71f27042da8a6fdaed54c224d31b65e868def",
"fingerprint_bitcoinonly": "89c91287ab7a9cd3ec246b6822a0d04b7d40401abef706cccafbb7b98bd6a3d7",
"notes": "https://blog.trezor.io/trezor-suite-and-firmware-updates-june-2021-c70aba9f0e3f",
"changelog": "* Locking the device by holding finger on the homescreen.\n* Support PIN of unlimited length.\n* Allow decreasing the output value in RBF transactions.\n* Reduce memory fragmentation.\n* Update FIDO icons.\n* Improve wording when showing multisig XPUBs."
},
{
Expand All @@ -166,7 +158,6 @@
"url_bitcoinonly": "firmware/t2t1/trezor-t2t1-2.3.5-bitcoinonly.bin",
"fingerprint": "c0a6cacfed5c7a691314919c22307c29fbe9522071a9a28669769c014762d386",
"fingerprint_bitcoinonly": "53e7ee5bfc75cfa6412d8de5461b1ea8d9b7e10970ce7cadae9cbb1e17bbb77d",
"notes": "https://blog.trezor.io/trezor-suite-and-firmware-updates-rbf-and-spending-now-live-c2f69c42d7f7",
"changelog": "* Replacement transaction signing for replace-by-fee and PayJoin.\n* Support for Output Descriptors export.\n* Paginated display for signing/verifying long messages.\n* Show Ypub/Zpub correctly for multisig GetAddress.\n* Show amounts in mBTC, uBTC and sat denominations."
},
{
Expand All @@ -178,7 +169,6 @@
"url_bitcoinonly": "firmware/t2t1/trezor-t2t1-2.3.4-bitcoinonly.bin",
"fingerprint": "58b51a6587993965979a744f8fcd5c4761f11ce4bec6b059a5d56bd0987d6658",
"fingerprint_bitcoinonly": "085acbba98163284ef86dea637f9442b924e80fea245f5ebb60d5aab3be2b7b6",
"notes": "https://blog.trezor.io/firmware-update-for-trezor-model-t-version-2-3-4-for-monero-hard-fork-c2ff972101d3",
"changelog": "* This firmware only contains the changes needed after the latest Monero update (HF13) by introducing support for the CLSAG transactions."
},
{
Expand All @@ -190,7 +180,6 @@
"url_bitcoinonly": "firmware/t2t1/trezor-t2t1-2.3.3-bitcoinonly.bin",
"fingerprint": "46326222f8afcb82e1cd07867bc3bf8836f4e9d0f367e23b58d1e9bc32cd032e",
"fingerprint_bitcoinonly": "dda77cd7893a5f413f8fc4b2f44d1d43ed4b26e8ced5e6e578cc6b302c1a2310",
"notes": "https://blog.trezor.io/firmware-updates-for-trezor-model-t-version-2-3-3-and-trezor-model-one-version-1-9-3-c94f7a3b6fea",
"changelog": "* Advances the Passphrase feature by showing the entered passphrase on the Trezor screen before opening the wallet.\n* Adds support for Verge (XVG).\n* Drops support for Metaverse (ETP), GINcoin (GIN), Pesetacoin (PTC), and Zel (ZEL).\n* Introduces a hard limit on transaction fees to prevent accidentally paying extra hefty fees (the limit can be manually disabled).\n* Resolves the problems with generating the Crown addresses.\n* Re-enables spending altcoins from Bitcoin paths (fixing some compatibility issues with Bitcoin Cash wallets).\n* Fixes smaller issues with the user interface, customization, and more."
},
{
Expand All @@ -202,7 +191,6 @@
"url_bitcoinonly": "firmware/t2t1/trezor-t2t1-2.3.2-bitcoinonly.bin",
"fingerprint": "f5ccdca0cbe163ecb93df726da72b69abb93f70d24d295db00b3ca2738216160",
"fingerprint_bitcoinonly": "389cb54fb6fc75489b788ad669ce51f41d47a67af54b8745a0dfe48da38a777f",
"notes": "https://blog.trezor.io/firmware-updates-for-trezor-model-t-version-2-3-2-and-trezor-model-one-version-1-9-2-f4f9c0f1ed7c",
"changelog": "* Introduces 'Autolock' feature, which automatically locks the device to enforce the PIN entry after a certain period.\n* Updates the Cardano support to enable staking and other Shelley updates.\n* Reintroduces the ability to spend pre-Overwinter (2018) funds on Zcash-like coins.\n* Fixes compatibility issues with Casa and GreenAddress.\n* Adds support for multiple change outputs in outgoing transactions.\n* Improves some interface elements."
},
{
Expand All @@ -214,7 +202,6 @@
"url_bitcoinonly": "firmware/t2t1/trezor-t2t1-2.3.1-bitcoinonly.bin",
"fingerprint": "37178a5ec24e34f8a0599aebcadaf206af3ebadef2fc596665d617dd3e05a5db",
"fingerprint_bitcoinonly": "41795ec196f74c5d6acecc09047a5eacf1dfca47b0aeaa8442a69568efe20ddb",
"notes": "https://blog.trezor.io/details-of-firmware-updates-for-trezor-one-version-1-9-1-and-trezor-model-t-version-2-3-1-1eba8f60f2dd",
"changelog": "* Refactor Bitcoin signing"
},
{
Expand All @@ -226,7 +213,6 @@
"url_bitcoinonly": "firmware/t2t1/trezor-t2t1-2.3.0-bitcoinonly.bin",
"fingerprint": "212929f63fe1393e2ff57e06537a38cff281e3cfb3a4e17235079e2f08871e6c",
"fingerprint_bitcoinonly": "bddc0fd3b52fd32d94b776048f62b3d03dcb6ab90140e482a042a2863093115f",
"notes": "https://blog.trezor.io/details-of-firmware-updates-for-trezor-one-version-1-9-0-and-trezor-model-t-version-2-3-0-46deb141fc09",
"changelog": "* Introduce Wipe code\n* Introduce SD card protection\n* Introduce passphrase cache\n* U2F UX improvements\n* Security fixes"
},
{
Expand Down Expand Up @@ -299,7 +285,6 @@
"url": "firmware/t2t1/trezor-t2t1-2.1.0.bin",
"tags": ["security"],
"fingerprint": "bb5b0308807b45d41d1e2ab66a468152997ad69a01099789d8a35e464cde999f",
"notes": "https://blog.trezor.io/firmware-updates-for-trezor-one-firmware-1-8-0-and-trezor-model-t-firmware-2-1-0-b9df91e048df",
"changelog": "* Security improvements\n* Upgraded to new storage format\n* Ripple, Stellar, Cardano and NEM fixes\n* New coins: ATS, AXE, FLO, GIN, KMD, NIX,\n PIVX, REOSC, XPM, XSN, ZCL\n* New ETH tokens"
},
{
Expand Down Expand Up @@ -340,7 +325,6 @@
"url": "firmware/t2t1/trezor-t2t1-2.0.7.bin",
"fingerprint": "f3a42e640e526fba6574fafa520fc7d97ef9f557d24da24d9a2ea4176a4c4164",
"changelog": "* Bitcoin Cash cashaddr support\n* Zcash Overwinter hardfork support\n* NEM support\n* Lisk support\n* Show warning on home screen if PIN is not set\n* Support for new coins:\n - Bitcoin Private, Fujicoin, Vertcoin, Viacoin, Zcoin\n* Support for new Ethereum networks:\n - EOS Classic, Ethereum Social, Ellaism, Callisto, EtherGem, Wanchain\n* Support for 500+ new Ethereum tokens",
"notes": "https://blog.trezor.io/june-updates-trezor-devices-one-modelt-wallet-zcash-cashaddr-doge-8d98c2a73036"
},
{
"required": false,
Expand Down
3 changes: 1 addition & 2 deletions packages/connect/src/types/firmware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ export type FirmwareRelease = {
url: string;
fingerprint: string;
changelog: string | string[];
changelogBtcOnly?: string | string[]; // Added later, may not be there for older releases
changelog_bitcoinonly?: string | string[]; // Added later, may not be there for older releases
version: VersionArray;
min_firmware_version: VersionArray;
min_bootloader_version: VersionArray;
bootloader_version?: VersionArray;
url_bitcoinonly?: string;
fingerprint_bitcoinonly?: string;
notes?: string;
channel?: string;
translations?: string[];
};
Expand Down
1 change: 0 additions & 1 deletion packages/suite-desktop-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"react-helmet-async": "^2.0.4",
"react-markdown": "^9.0.1",
"react-redux": "8.0.7",
"react-router-dom": "^5.2.0",
"styled-components": "^6.1.8"
Expand Down
47 changes: 2 additions & 45 deletions packages/suite-desktop-ui/src/support/DesktopUpdater/Available.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import ReactMarkdown from 'react-markdown';

import styled from 'styled-components';

import { Button, H2, variables, Link } from '@trezor/components';
import { Button, H2, Link, Markdown } from '@trezor/components';
import { desktopApi, UpdateInfo } from '@trezor/suite-desktop-api';
import { borders } from '@trezor/theme';

Expand All @@ -23,47 +21,6 @@ const ChangelogWrapper = styled.div`
max-height: 400px;
overflow-y: auto;
padding: 16px 20px;
color: ${({ theme }) => theme.TYPE_DARK_GREY};
font-size: ${variables.FONT_SIZE.SMALL};
font-weight: ${variables.FONT_WEIGHT.MEDIUM};
text-align: left;
h3 {
margin-bottom: 4px;
font-size: ${variables.FONT_SIZE.NORMAL};
font-weight: ${variables.FONT_WEIGHT.DEMI_BOLD};
}
ul,
ol {
margin-bottom: 10px;
margin-left: 36px; /* hacky way to add enough indentation so it is rendered right of an emoji in a section heading */
}
li {
line-height: 1.57;
}
li + li {
margin-top: 4px;
}
/*
Styling similar to Link component.
It seems overriding via linkReference renderer doesn't work for some reason
*/
a {
cursor: pointer;
text-decoration: underline;
color: inherit;
&:visited,
&:active,
&:hover {
text-decoration: underline;
color: inherit;
}
}
`;

const StyledLink = styled(Link)`
Expand Down Expand Up @@ -145,7 +102,7 @@ export const Available = ({ hideWindow, isCancelable, latest }: AvailableProps)

<ChangelogWrapper>
{latest?.changelog ? (
<ReactMarkdown>{latest?.changelog}</ReactMarkdown>
<Markdown>{latest?.changelog}</Markdown>
) : (
<Translation id="TR_COULD_NOT_RETRIEVE_CHANGELOG" />
)}
Expand Down
1 change: 0 additions & 1 deletion packages/suite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@
"react-helmet-async": "^2.0.4",
"react-hook-form": "^7.50.1",
"react-intl": "^6.6.2",
"react-markdown": "^9.0.1",
"react-qr-reader": "^2.2.1",
"react-redux": "8.0.7",
"react-router-dom": "^5.2.0",
Expand Down
6 changes: 4 additions & 2 deletions packages/suite/src/components/firmware/FirmwareOffer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ export const FirmwareOffer = ({ customFirmware, targetFirmwareType }: FirmwareOf
? translationString('TR_CUSTOM_FIRMWARE_VERSION')
: getFwUpdateVersion(originalDevice);

const isBtcOnly = originalDevice.firmwareType === FirmwareType.BitcoinOnly;
const isBtcOnly =
(targetFirmwareType !== undefined ? targetFirmwareType : originalDevice.firmwareType) ===
FirmwareType.BitcoinOnly;

const parsedChangelog = customFirmware
? null
Expand Down Expand Up @@ -124,7 +126,7 @@ export const FirmwareOffer = ({ customFirmware, targetFirmwareType }: FirmwareOf
type="hint"
variant="nostyle"
icon="EXTERNAL_LINK"
href={parsedChangelog.notes || changelogUrl}
href={changelogUrl}
>
<Translation id="TR_VIEW_ALL" />
</StyledLink>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,9 @@ const releaseData: Omit<FirmwareRelease, 'changelog' | 'changelogBtcOnly'> = {
url_bitcoinonly: 'firmware/1/trezor-1.9.4-bitcoinonly.bin',
fingerprint: '867017bd784cc4e9ce6f0875c61ea86f89b19380d54045c34608b85472998000',
fingerprint_bitcoinonly: '3f73dfbcfc48f66c8814f6562524d81888230e0acd1c19b52b6e8772c6c67e7f',
notes: 'https://blog.trezor.io/trezor-suite-and-firmware-updates-rbf-and-spending-now-live-c2f69c42d7f7',
};

const resultData = {
notes: 'https://blog.trezor.io/trezor-suite-and-firmware-updates-rbf-and-spending-now-live-c2f69c42d7f7',
url: 'firmware/1/trezor-1.9.4.bin',
versionString: '1.9.4',
};

Expand Down Expand Up @@ -66,7 +63,7 @@ const parseFirmwareChangelogFixture: Array<{
{
description: 'parses BTC-only changelog from array of strings',
input: {
release: { ...releaseData, changelog: '', changelogBtcOnly: CHANGELOG_ARRAY },
release: { ...releaseData, changelog: '', changelog_bitcoinonly: CHANGELOG_ARRAY },
isBtcOnly: true,
},
result: { ...resultData, changelog: EXPECTED_STRING },
Expand All @@ -75,7 +72,11 @@ const parseFirmwareChangelogFixture: Array<{
description:
'parses universal (old) changelog for BTC when the changelogBtcOnly is missing',
input: {
release: { ...releaseData, changelog: CHANGELOG_STRING, changelogBtcOnly: undefined },
release: {
...releaseData,
changelog: CHANGELOG_STRING,
changelog_bitcoinonly: undefined,
},
isBtcOnly: true,
},
result: { ...resultData, changelog: EXPECTED_STRING },
Expand All @@ -84,7 +85,7 @@ const parseFirmwareChangelogFixture: Array<{
description:
'results to null for whole changelog data, when empty string is provided (trimmed)',
input: {
release: { ...releaseData, changelog: ' \n ', changelogBtcOnly: undefined },
release: { ...releaseData, changelog: ' \n ', changelog_bitcoinonly: undefined },
isBtcOnly: true,
},
result: null,
Expand Down
10 changes: 2 additions & 8 deletions suite-common/suite-utils/src/parseFirmwareChangelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,17 @@ export type ParseFirmwareChangelogParams = {
};

export type ParseFirmwareChangelogResult = {
url: string;
notes: string | undefined;
changelog: string;
versionString: string;
};

type ChangelogField = keyof Pick<FirmwareRelease, 'changelog' | 'changelogBtcOnly'>;
type ChangelogField = keyof Pick<FirmwareRelease, 'changelog' | 'changelog_bitcoinonly'>;

export const parseFirmwareChangelog = ({
release,
isBtcOnly,
}: ParseFirmwareChangelogParams): ParseFirmwareChangelogResult | null => {
const changeLogField: ChangelogField = isBtcOnly ? 'changelogBtcOnly' : 'changelog';
const changeLogField: ChangelogField = isBtcOnly ? 'changelog_bitcoinonly' : 'changelog';

if (
release === undefined ||
Expand All @@ -30,15 +28,11 @@ export const parseFirmwareChangelog = ({
const changelogRaw = release[changeLogField] ?? release['changelog']; // For older releases we don't have the changelog for BtcOnly firmware so we fallback to universal
const changelog = (Array.isArray(changelogRaw) ? changelogRaw.join('\n') : changelogRaw).trim();

console.log('changelogString: "' + changelog + '"');

if (changelog.length === 0) {
return null;
}

return {
url: release.url,
notes: release.notes,
changelog,
versionString: release.version.join('.'),
};
Expand Down
2 changes: 0 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11194,7 +11194,6 @@ __metadata:
react: "npm:18.2.0"
react-dom: "npm:18.2.0"
react-helmet-async: "npm:^2.0.4"
react-markdown: "npm:^9.0.1"
react-redux: "npm:8.0.7"
react-router-dom: "npm:^5.2.0"
styled-components: "npm:^6.1.8"
Expand Down Expand Up @@ -11385,7 +11384,6 @@ __metadata:
react-helmet-async: "npm:^2.0.4"
react-hook-form: "npm:^7.50.1"
react-intl: "npm:^6.6.2"
react-markdown: "npm:^9.0.1"
react-qr-reader: "npm:^2.2.1"
react-redux: "npm:8.0.7"
react-router-dom: "npm:^5.2.0"
Expand Down

0 comments on commit e240c63

Please sign in to comment.