Skip to content

Commit

Permalink
only show the download prompt if currentVersion is not a dev version
Browse files Browse the repository at this point in the history
'v0.7.5-56-g8f683ae' !== 'v0.7.5', so the webconfig would present the
Get Latest Version button. this change suppresses that, under the
opinion that if you're running anything but a tag, you probably don't
need the download prompt at all. note however that this change also
suppresses the download prompt if you're on v0.7.4-300-gSHA
  • Loading branch information
bsstephan committed Dec 15, 2023
1 parent 271f0f1 commit 9809c81
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
1 change: 0 additions & 1 deletion www/.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
VITE_CURRENT_VERSION=v0.7.5
VITE_GP2040_BOARD=pico
VITE_GP2040_CONTROLLER=pico
VITE_DEV_BASE_URL=http://localhost:8080
1 change: 0 additions & 1 deletion www/env.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/// <reference types="vite/client" />

interface ImportMetaEnv {
readonly VITE_CURRENT_VERSION: string;
readonly VITE_GP2040_BOARD: string;
readonly VITE_GP2040_CONTROLLER: string;
readonly VITE_DEV_BASE_URL: string;
Expand Down
4 changes: 2 additions & 2 deletions www/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,9 @@ app.get('/api/getMacroAddonOptions', (req, res) => {
app.get('/api/getFirmwareVersion', (req, res) => {
return res.send({
boardConfigLabel: 'Pico',
boardConfigFileName: `GP2040_${process.env.VITE_CURRENT_VERSION}_Pico`,
boardConfigFileName: `GP2040_local-dev-server_Pico`,
boardConfig: 'Pico',
version: process.env.VITE_CURRENT_VERSION,
version: 'local-dev-server',
});
});

Expand Down
6 changes: 2 additions & 4 deletions www/src/Pages/HomePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ const toKB = (x) => parseFloat((x / 1024).toFixed(2));
export default function HomePage() {
const [latestVersion, setLatestVersion] = useState('');
const [latestDownloadUrl, setLatestDownloadUrl] = useState('');
const [currentVersion, setCurrentVersion] = useState(
import.meta.env.VITE_CURRENT_VERSION,
);
const [currentVersion, setCurrentVersion] = useState('');
const [boardConfigProperties, setBoardConfigProperties] = useState({});
const [memoryReport, setMemoryReport] = useState(null);

Expand Down Expand Up @@ -85,7 +83,7 @@ export default function HomePage() {
<div>{`${boardConfigProperties.label} (${boardConfigProperties.fileName}.uf2)`}</div>
<div>{t('HomePage:current-text', { version: currentVersion })}</div>
<div>{t('HomePage:latest-text', { version: latestVersion })}</div>
{latestVersion && currentVersion !== latestVersion && (
{latestVersion && currentVersion?.split("-").length == 1 && currentVersion !== latestVersion && (
<div className="mt-3 mb-3">
<a
target="_blank"
Expand Down

0 comments on commit 9809c81

Please sign in to comment.