@@ -11,13 +11,25 @@ import { WitnessToggler } from './witnessToggler'
1111import { WitnessSection } from './witness'
1212import { CompilerFeedback } from './feedback'
1313import { PrimeValue } from '../types'
14+ import { CompilerLicense } from '../constants/license'
1415
1516export function Container ( ) {
1617 const circuitApp = useContext ( CircuitAppContext )
1718
18- const showCompilerLicense = ( message = 'License not available' ) => {
19- // @ts -ignore
20- circuitApp . plugin . call ( 'notification' , 'modal' , { id : 'modal_circuit_compiler_license' , title : 'Compiler License' , message } )
19+ const showCompilerLicense = async ( message = 'License not available' ) => {
20+ try {
21+ const response = await fetch ( 'https://raw.githubusercontent.com/iden3/circom/master/COPYING' )
22+ if ( ! response . ok ) {
23+ throw new Error ( `HTTP error! status: ${ response . status } ` )
24+ }
25+ const content = await response . text ( )
26+ // @ts -ignore
27+ circuitApp . plugin . call ( 'notification' , 'modal' , { id : 'modal_circuit_compiler_license' , title : 'Compiler License' , message : content } )
28+ } catch ( e ) {
29+ console . log ( 'error: ' , e )
30+ // @ts -ignore
31+ circuitApp . plugin . call ( 'notification' , 'modal' , { id : 'modal_circuit_compiler_license' , title : 'Compiler License' , message } )
32+ }
2133 }
2234
2335 const handleVersionSelect = ( version : string ) => {
@@ -62,7 +74,7 @@ export function Container () {
6274 tooltipClasses = "text-nowrap"
6375 tooltipText = 'See compiler license'
6476 >
65- < span className = "far fa-file-certificate border-0 p-0 ml-2" onClick = { ( ) => showCompilerLicense ( ) } > </ span >
77+ < span className = "far fa-file-certificate border-0 p-0 ml-2" onClick = { ( ) => showCompilerLicense ( CompilerLicense ) } > </ span >
6678 </ CustomTooltip >
6779 < VersionList setVersion = { handleVersionSelect } versionList = { circuitApp . appState . versionList } currentVersion = { circuitApp . appState . version } />
6880 < CompileOptions setCircuitAutoCompile = { handleCircuitAutoCompile } setCircuitHideWarnings = { handleCircuitHideWarnings } autoCompile = { circuitApp . appState . autoCompile } hideWarnings = { circuitApp . appState . hideWarnings } />
0 commit comments