mirror of
https://github.com/tornadocash/trusted-setup-server.git
synced 2024-11-22 01:46:52 +01:00
updates
This commit is contained in:
parent
213a7879fd
commit
f2e72ce94b
@ -99,12 +99,7 @@ module.exports = {
|
|||||||
** Axios module configuration
|
** Axios module configuration
|
||||||
** See https://axios.nuxtjs.org/options
|
** See https://axios.nuxtjs.org/options
|
||||||
*/
|
*/
|
||||||
axios: {
|
axios: {},
|
||||||
baseURL:
|
|
||||||
process.env.NODE_ENV === 'production'
|
|
||||||
? 'http://ceremony.tornado.cash/'
|
|
||||||
: `http://localhost:3000/`
|
|
||||||
},
|
|
||||||
/*
|
/*
|
||||||
** Build configuration
|
** Build configuration
|
||||||
*/
|
*/
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
<a :href="props.row.attestation" target="_blank">{{ props.row.account }}</a>
|
<a :href="props.row.attestation" target="_blank">{{ props.row.account }}</a>
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
|
|
||||||
<b-table-column>
|
<b-table-column label="Contribution">
|
||||||
<a :href="props.row.contribution" class="button is-icon">
|
<a :href="props.row.contribution" class="button is-icon">
|
||||||
<Link />
|
<Link />
|
||||||
</a>
|
</a>
|
||||||
@ -80,7 +80,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<b-dropdown-item
|
<b-dropdown-item
|
||||||
v-for="(rows, index) in [10, 15, 20, 50]"
|
v-for="(rows, index) in [3, 10, 15, 20, 50]"
|
||||||
:key="index"
|
:key="index"
|
||||||
:value="rows"
|
:value="rows"
|
||||||
aria-role="listitem"
|
aria-role="listitem"
|
||||||
|
@ -3,22 +3,23 @@
|
|||||||
<h1 class="title is-size-1 is-spaced">
|
<h1 class="title is-size-1 is-spaced">
|
||||||
Hello, <span>@{{ user.handle }}</span>
|
Hello, <span>@{{ user.handle }}</span>
|
||||||
</h1>
|
</h1>
|
||||||
<h2 class="subtitle">Lorem ipsum dolor sit amet, consectetur?</h2>
|
<h2 class="subtitle">
|
||||||
<p class="p">
|
What way do you want to contribute to the Tornado.cash Trusted Setup Ceremony?
|
||||||
If you don’t trust binaries, we encorage you to follow this <a href="">instruction</a> to
|
</h2>
|
||||||
contribute by compiling from source code. It is very easy!
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="columns is-centered">
|
<div class="columns is-centered">
|
||||||
<div class="column is-one-third">
|
<div class="column is-one-third">
|
||||||
<div class="box">
|
<div
|
||||||
<div class="title is-5">Lorem ipsum</div>
|
:class="{ 'is-hovered': contributionType === 'anonymous' }"
|
||||||
|
@click="onAnonymousHandler"
|
||||||
|
class="box"
|
||||||
|
>
|
||||||
|
<div class="title is-5">Anonymously</div>
|
||||||
<Cloak />
|
<Cloak />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="column is-one-third">
|
<div class="column is-one-third">
|
||||||
<div :class="{ 'is-hovered': isLoggedIn }" class="box">
|
<div :class="{ 'is-hovered': isLoggedIn }" class="box">
|
||||||
<div class="title is-5">Lorem ipsum</div>
|
<div class="title is-5">Using a social account</div>
|
||||||
<div v-if="isLoggedIn" class="fields">
|
<div v-if="isLoggedIn" class="fields">
|
||||||
<b-field label="Name">
|
<b-field label="Name">
|
||||||
<b-input v-model="user.name"></b-input>
|
<b-input v-model="user.name"></b-input>
|
||||||
@ -29,7 +30,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-else class="buttons">
|
<div v-else class="buttons">
|
||||||
<b-button @click="logIn" type="is-primary" outlined expanded>
|
<b-button @click="logIn" type="is-primary" outlined expanded>
|
||||||
Sign In
|
SignIn via Twitter
|
||||||
|
</b-button>
|
||||||
|
<b-button @click="logIn" :disabled="true" type="is-primary" outlined expanded>
|
||||||
|
SignIn via Github
|
||||||
</b-button>
|
</b-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -43,24 +47,29 @@
|
|||||||
|
|
||||||
<div class="buttons is-centered">
|
<div class="buttons is-centered">
|
||||||
<b-button
|
<b-button
|
||||||
v-if="!isContributeBtnDisabled"
|
v-if="!isContributeBtnSnown"
|
||||||
@click="makeContribution"
|
@click="makeContribution"
|
||||||
|
:disabled="isContributeBtnDisabled"
|
||||||
type="is-primary"
|
type="is-primary"
|
||||||
outlined
|
outlined
|
||||||
>
|
>
|
||||||
Make the contribution
|
Make the contribution
|
||||||
</b-button>
|
</b-button>
|
||||||
<b-button
|
<b-button
|
||||||
v-if="isContributeBtnDisabled && status.type === 'is-success'"
|
v-if="status.type === 'is-success'"
|
||||||
|
@click="makeTweet"
|
||||||
type="is-primary"
|
type="is-primary"
|
||||||
tag="a"
|
tag="a"
|
||||||
href="https://twitter.com/intent/tweet?text=Hello%20world"
|
|
||||||
target="_blank"
|
target="_blank"
|
||||||
outlined
|
outlined
|
||||||
>
|
>
|
||||||
Tweet about your contribution
|
Tweet about your contribution
|
||||||
</b-button>
|
</b-button>
|
||||||
</div>
|
</div>
|
||||||
|
<p class="p">
|
||||||
|
If you don’t trust binaries, we encorage you to follow this <a href="">instruction</a> to
|
||||||
|
contribute by compiling from source code. It is very easy!
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -75,7 +84,9 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isContributeBtnDisabled: false,
|
contributionType: null,
|
||||||
|
contributionIndex: null,
|
||||||
|
isContributeBtnSnown: false,
|
||||||
status: {
|
status: {
|
||||||
type: '',
|
type: '',
|
||||||
msg: ''
|
msg: ''
|
||||||
@ -86,24 +97,57 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
isLoggedIn() {
|
isLoggedIn() {
|
||||||
return !!this.user.name && this.user.name !== 'Anonymous'
|
return !!this.user.name && this.user.name !== 'Anonymous'
|
||||||
|
},
|
||||||
|
isContributeBtnDisabled() {
|
||||||
|
return !this.contributionType
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
try {
|
try {
|
||||||
const data = await this.$axios.$get('/api/user_data')
|
const response = await fetch('/api/user_data')
|
||||||
|
const data = await response.json()
|
||||||
console.log('data', data)
|
console.log('data', data)
|
||||||
if (data.name !== 'Anonymous') {
|
if (data.name !== 'Anonymous') {
|
||||||
this.user.handle = data.handle
|
this.user.handle = data.handle
|
||||||
this.user.name = data.name
|
this.user.name = data.name
|
||||||
|
// TODO check whether it's github or twitter
|
||||||
|
this.contributionType = 'twitter'
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('user_data fail', e)
|
console.error('user_data fail', e)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
makeTweet() {
|
||||||
|
const tweetText = `Just make the contribution %23${this.contributionIndex} to Tornado.cash trusted setup ceremony! 🚀`
|
||||||
|
const popUpWindowWidth = 600
|
||||||
|
const popUpWindowHeight = 250
|
||||||
|
const dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : window.screenX
|
||||||
|
const dualScreenTop = window.screenTop !== undefined ? window.screenTop : window.screenY
|
||||||
|
|
||||||
|
const width = window.innerWidth
|
||||||
|
? window.innerWidth
|
||||||
|
: document.documentElement.clientWidth
|
||||||
|
? document.documentElement.clientWidth
|
||||||
|
: screen.width
|
||||||
|
const height = window.innerHeight
|
||||||
|
? window.innerHeight
|
||||||
|
: document.documentElement.clientHeight
|
||||||
|
? document.documentElement.clientHeight
|
||||||
|
: screen.height
|
||||||
|
|
||||||
|
const systemZoom = width / window.screen.availWidth
|
||||||
|
const left = (width - popUpWindowWidth) / 2 / systemZoom + dualScreenLeft
|
||||||
|
const top = (height - popUpWindowHeight) / 2 / systemZoom + dualScreenTop
|
||||||
|
window.open(
|
||||||
|
`https://twitter.com/intent/tweet?text=${tweetText}`,
|
||||||
|
'',
|
||||||
|
`menubar=no,toolbar=no,resizable=yes,scrollbars=no,height=${popUpWindowHeight},width=${popUpWindowWidth},top=${top},left=${left}`
|
||||||
|
)
|
||||||
|
},
|
||||||
async makeContribution({ retry = 0 } = {}) {
|
async makeContribution({ retry = 0 } = {}) {
|
||||||
try {
|
try {
|
||||||
this.isContributeBtnDisabled = true
|
this.isContributeBtnSnown = true
|
||||||
|
|
||||||
this.status.msg = 'Downloading last contribution'
|
this.status.msg = 'Downloading last contribution'
|
||||||
this.status.type = ''
|
this.status.type = ''
|
||||||
@ -121,16 +165,19 @@ export default {
|
|||||||
console.log('this.user.name', this.user)
|
console.log('this.user.name', this.user)
|
||||||
const formData = new FormData()
|
const formData = new FormData()
|
||||||
formData.append('response', new Blob([result], { type: 'application/octet-stream' }))
|
formData.append('response', new Blob([result], { type: 'application/octet-stream' }))
|
||||||
formData.append('name', this.user.name)
|
if (this.contributionType !== 'anonymous') {
|
||||||
formData.append('company', this.user.company)
|
formData.append('name', this.user.name)
|
||||||
|
formData.append('company', this.user.company)
|
||||||
|
}
|
||||||
const resp = await fetch('api/response', {
|
const resp = await fetch('api/response', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData
|
body: formData
|
||||||
})
|
})
|
||||||
|
const responseData = await resp.json()
|
||||||
if (resp.ok) {
|
if (resp.ok) {
|
||||||
this.status.msg = 'Your contribution is verified and recorded. THX BYE.'
|
this.status.msg = 'Your contribution is verified and recorded. THX BYE.'
|
||||||
this.status.type = 'is-success'
|
this.status.type = 'is-success'
|
||||||
|
this.contributionIndex = responseData.contributionIndex
|
||||||
} else if (resp.status === 422) {
|
} else if (resp.status === 422) {
|
||||||
if (retry < 3) {
|
if (retry < 3) {
|
||||||
console.log(`Looks like someone else uploaded contribution ahead of us, retrying`)
|
console.log(`Looks like someone else uploaded contribution ahead of us, retrying`)
|
||||||
@ -138,22 +185,27 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.status.msg = `Failed to upload your contribution after ${retry} attempts`
|
this.status.msg = `Failed to upload your contribution after ${retry} attempts`
|
||||||
this.status.type = 'is-danger'
|
this.status.type = 'is-danger'
|
||||||
this.isContributeBtnDisabled = false
|
this.isContributeBtnSnown = false
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.status.msg = 'Error uploading your contribution'
|
this.status.msg = 'Error uploading your contribution'
|
||||||
this.status.type = 'is-danger'
|
this.status.type = 'is-danger'
|
||||||
this.isContributeBtnDisabled = false
|
this.isContributeBtnSnown = false
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e.message)
|
console.error(e.message)
|
||||||
this.status.msg = e.message
|
this.status.msg = e.message
|
||||||
this.status.type = 'is-danger'
|
this.status.type = 'is-danger'
|
||||||
this.isContributeBtnDisabled = false
|
this.isContributeBtnSnown = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
logIn() {
|
logIn() {
|
||||||
|
this.contributionType = 'twitter'
|
||||||
window.location.replace('/api/connect')
|
window.location.replace('/api/connect')
|
||||||
|
},
|
||||||
|
onAnonymousHandler() {
|
||||||
|
this.contributionType = 'anonymous'
|
||||||
|
this.user = { name: '', handle: 'Anonymous', company: '' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ router.post('/response', upload.single('response'), async (req, res) => {
|
|||||||
req.body ? req.body.company || null : null
|
req.body ? req.body.company || null : null
|
||||||
)
|
)
|
||||||
console.log('Finished')
|
console.log('Finished')
|
||||||
res.send()
|
res.json({ contributionIndex: currentContributionIndex })
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Error', e)
|
console.error('Error', e)
|
||||||
res.status(503).send(e.toString())
|
res.status(503).send(e.toString())
|
||||||
|
@ -58,7 +58,7 @@ router.get('/twitter_callback', (req, res) => {
|
|||||||
} else {
|
} else {
|
||||||
req.session.oauthAccessToken = oauthAccessToken
|
req.session.oauthAccessToken = oauthAccessToken
|
||||||
req.session.oauthAccessTokenSecret = oauthAccessTokenSecret
|
req.session.oauthAccessTokenSecret = oauthAccessTokenSecret
|
||||||
res.redirect('/')
|
res.redirect('/make-contribution')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user