Skip to content

Commit

Permalink
fix: remove Fiddle download links hack (#469)
Browse files Browse the repository at this point in the history
* fix: remove Fiddle download links hack

* fix: whoops
  • Loading branch information
dsanders11 authored Nov 10, 2023
1 parent b81ff4a commit c41589b
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions src/pages/fiddle/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,22 @@ import { SemVer } from 'semver';

export default function FiddlePage() {
const [OS, setOS] = useState('win32');
let { version } = usePluginData('fiddle-versions-plugin') as SemVer;
const { version } = usePluginData('fiddle-versions-plugin') as SemVer;
useEffect(() => {
if (navigator.userAgent.indexOf('Windows') != -1) return setOS('win32');
if (navigator.userAgent.indexOf('Mac') != -1) return setOS('darwin');
if (navigator.userAgent.indexOf('Linux') != -1) return setOS('linux');
}, []);

const downloadLinks = {
win32: {
ia32: `https://github.com/electron/fiddle/releases/download/${version}/electron-fiddle-${version}-win32-ia32-setup.exe`,
x64: `https://github.com/electron/fiddle/releases/download/${version}/electron-fiddle-${version}-win32-x64-setup.exe`,
},
darwin: {
x64: `https://github.com/electron/fiddle/releases/download/${version}/Electron.Fiddle-darwin-x64-${version}.zip`,
arm64: `https://github.com/electron/fiddle/releases/download/${version}/Electron.Fiddle-darwin-arm64-${version}.zip`,
},
linux: {
deb: {
x64: `https://github.com/electron/fiddle/releases/download/v${version}/electron-fiddle_${version}_amd64.deb`,
Expand All @@ -40,21 +48,6 @@ export default function FiddlePage() {
},
};

// TODO(dsanders11): Remove this ugly hack once this is resolved
// v0.34.3 is a Linux-only release, so for other platforms fall back to v0.34.2
if (version === '0.34.3') {
version = '0.34.2';
}

downloadLinks.win32 = {
ia32: `https://github.com/electron/fiddle/releases/download/v${version}/electron-fiddle-${version}-win32-ia32-setup.exe`,
x64: `https://github.com/electron/fiddle/releases/download/v${version}/electron-fiddle-${version}-win32-x64-setup.exe`,
};
downloadLinks.darwin = {
x64: `https://github.com/electron/fiddle/releases/download/v${version}/Electron.Fiddle-darwin-x64-${version}.zip`,
arm64: `https://github.com/electron/fiddle/releases/download/v${version}/Electron.Fiddle-darwin-arm64-${version}.zip`,
};

const renderDownloadButtons = () => {
switch (OS) {
case 'win32':
Expand Down

0 comments on commit c41589b

Please sign in to comment.