From bb572accc0ac4988c2135e2bb1b73ac3858678ad Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Thu, 30 Nov 2023 14:18:07 +0100 Subject: [PATCH 1/4] Load compiler license for circom --- .../src/app/components/container.tsx | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/apps/circuit-compiler/src/app/components/container.tsx b/apps/circuit-compiler/src/app/components/container.tsx index 63215775ed9..54357e37646 100644 --- a/apps/circuit-compiler/src/app/components/container.tsx +++ b/apps/circuit-compiler/src/app/components/container.tsx @@ -11,13 +11,25 @@ import { WitnessToggler } from './witnessToggler' import { WitnessSection } from './witness' import { CompilerFeedback } from './feedback' import { PrimeValue } from '../types' +import { CompilerLicense } from '../constants/license' export function Container () { const circuitApp = useContext(CircuitAppContext) - const showCompilerLicense = (message = 'License not available') => { - // @ts-ignore - circuitApp.plugin.call('notification', 'modal', { id: 'modal_circuit_compiler_license', title: 'Compiler License', message }) + const showCompilerLicense = async (message = 'License not available') => { + try { + const response = await fetch('https://raw.githubusercontent.com/iden3/circom/master/COPYING') + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`) + } + const content = await response.text() + // @ts-ignore + circuitApp.plugin.call('notification', 'modal', { id: 'modal_circuit_compiler_license', title: 'Compiler License', message: content }) + } catch (e) { + console.log('error: ', e) + // @ts-ignore + circuitApp.plugin.call('notification', 'modal', { id: 'modal_circuit_compiler_license', title: 'Compiler License', message }) + } } const handleVersionSelect = (version: string) => { @@ -62,7 +74,7 @@ export function Container () { tooltipClasses="text-nowrap" tooltipText='See compiler license' > - showCompilerLicense()}> + showCompilerLicense(CompilerLicense)}> From ac8f6e7d1283e8a0b2a4ae1e293a970c861e3395 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Thu, 30 Nov 2023 14:19:43 +0100 Subject: [PATCH 2/4] Remove unused imports --- apps/circuit-compiler/src/app/components/container.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/circuit-compiler/src/app/components/container.tsx b/apps/circuit-compiler/src/app/components/container.tsx index 54357e37646..21739d268e3 100644 --- a/apps/circuit-compiler/src/app/components/container.tsx +++ b/apps/circuit-compiler/src/app/components/container.tsx @@ -11,7 +11,6 @@ import { WitnessToggler } from './witnessToggler' import { WitnessSection } from './witness' import { CompilerFeedback } from './feedback' import { PrimeValue } from '../types' -import { CompilerLicense } from '../constants/license' export function Container () { const circuitApp = useContext(CircuitAppContext) From b6b6042a9b95e046bb8c11c78b45bd2baf7afb08 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Thu, 30 Nov 2023 14:23:04 +0100 Subject: [PATCH 3/4] Remove unused imports --- apps/circuit-compiler/src/app/components/container.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/circuit-compiler/src/app/components/container.tsx b/apps/circuit-compiler/src/app/components/container.tsx index 21739d268e3..9990e44a8c5 100644 --- a/apps/circuit-compiler/src/app/components/container.tsx +++ b/apps/circuit-compiler/src/app/components/container.tsx @@ -73,7 +73,7 @@ export function Container () { tooltipClasses="text-nowrap" tooltipText='See compiler license' > - showCompilerLicense(CompilerLicense)}> + showCompilerLicense()}> From 2e06f74f7e757d75cd4e05adbb2f760c7f8bad13 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Thu, 30 Nov 2023 14:24:59 +0100 Subject: [PATCH 4/4] Remove unused logs --- apps/circuit-compiler/src/app/components/container.tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/apps/circuit-compiler/src/app/components/container.tsx b/apps/circuit-compiler/src/app/components/container.tsx index 9990e44a8c5..d56036e44db 100644 --- a/apps/circuit-compiler/src/app/components/container.tsx +++ b/apps/circuit-compiler/src/app/components/container.tsx @@ -18,14 +18,11 @@ export function Container () { const showCompilerLicense = async (message = 'License not available') => { try { const response = await fetch('https://raw.githubusercontent.com/iden3/circom/master/COPYING') - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`) - } + if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`) const content = await response.text() // @ts-ignore circuitApp.plugin.call('notification', 'modal', { id: 'modal_circuit_compiler_license', title: 'Compiler License', message: content }) } catch (e) { - console.log('error: ', e) // @ts-ignore circuitApp.plugin.call('notification', 'modal', { id: 'modal_circuit_compiler_license', title: 'Compiler License', message }) }