Commit 9b5a8910 authored by Jefferson Sofarelli's avatar Jefferson Sofarelli
Browse files

Some fixes and updates

parent f796fe10
......@@ -8,9 +8,25 @@
module.exports = {
async fetch(ctx) {
const { eth_profile_addr } = ctx.request.query;
console.log('eth_profile_addr', eth_profile_addr)
const user = await strapi.query('user', 'users-permissions').findOne({ eth_profile_addr });
const { eth_profile_addr, username } = ctx.request.query;
console.log('eth_profile_addr', eth_profile_addr);
console.log('username', username);
const query = {};
if (eth_profile_addr) {
query.eth_profile_addr = eth_profile_addr;
}
if (username) {
query.username = username;
}
const user = await strapi.query('user', 'users-permissions').findOne(query);
// Handle user not found!
if (!user) {
return ctx.send({
error: 'User not found!'
}, 404);
}
const data = {
profileAddr: user.eth_profile_addr,
......
......@@ -150,17 +150,19 @@ module.exports = {
const helveticaFont = await pdfDoc.embedFont(StandardFonts.Helvetica);
// Draw a string of text toward the top of the page
const fontSize = 12;
const fontSize = 12;
newPage.drawText( // TODO update this text
`This eBook was published using the SourceCheck.org HonorBox Platform, which\n` +
`cryptographically verifies publisher profile.\n` +
`cryptographically verifies publisher profiles.\n` +
`If you enjoyed it, the publisher has requested a suggested donation equivalent to\n` +
`10 $USD to be distributed between the contributors.\n` +
`SourceCheck receives 2% of the donated valued to support the development of HonorBox\n` +
`Platform. Check out the verified profile at:\n\n` +
`10 $USD be distributed between the contributors.\n` +
`SourceCheck Co-operative charges a 2% transaction fee of the donated valued to support\n` +
`the development of HonorBox Platform, taken before distributing the donation.\n` +
`You can confirm the identity of the recipients of your donation by SourceCheck-ing\n`+
`their profile at:\n\n` +
`${getProfileUrl(publication.owner)}\n\n` +
`To make a donation, send MATIC or any ERC-20 token to the following address (VALID \n` +
`ONLY ON POLYGON MAINNET): \n\n` +
`To make a donation, you can send MATIC or any ERC-20 token to the following address\n` +
`(ONLY VALID ON THE POLYGON MAINNET):\n\n` +
`${publication.owner.eth_profile_addr}\n\n` +
`Or use the QR code bellow:`,
{
......
......@@ -254,14 +254,17 @@ module.exports = {
updateUser: async (ctx) => {
// Check if data was sent to update
const { ethAddr, ethProfileAddr } = ctx.request.body;
if (!ethAddr && !ethProfileAddr) {
const { displayName, ethAddr, ethProfileAddr } = ctx.request.body;
if (!displayName && !ethAddr && !ethProfileAddr) {
return ctx.badRequest('No data sent to update!');
}
// Update user
const id = ctx.state.user.id;
const data = {}
if (displayName) {
data.displayName = displayName;
}
if (ethAddr) {
data.eth_addr = ethAddr;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment