Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pinata pro #865

Merged
merged 3 commits into from
May 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/preview-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
branches:
- master
- develop
- v1.1-beta
pull_request:
types: [opened, synchronize, reopened]

Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/preview-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ jobs:
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
if: steps.source-run-info.outputs.sourceHeadRepo == 'DXgovernance/dxvote' && steps.source-run-info.outputs.sourceHeadBranch == 'develop'

- name: Update DNS record for 1.1 beta branch
run: npx dnslink-cloudflare --domain dxvote.dev --record _dnslink.beta --link /ipfs/${{ steps.web3.outputs.cid }}
env:
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
if: steps.source-run-info.outputs.sourceHeadRepo == 'DXgovernance/dxvote' && steps.source-run-info.outputs.sourceHeadBranch == 'v1.1-beta'

- name: Update DNS record for Master branch
run: npx dnslink-cloudflare --domain dxvote.dev --record _dnslink --link /ipfs/${{ steps.web3.outputs.cid }}
env:
Expand Down
10 changes: 8 additions & 2 deletions src/services/IPFSService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ export default class IPFSService {

async getContentFromIPFS(hash: string) {
const response = await Promise.any([
axios.request({
url: 'https://dxgov.mypinata.cloud/' + hash,
method: 'GET',
}),
axios.request({
url: 'https://ipfs.io/ipfs/' + hash,
method: 'GET',
Expand Down Expand Up @@ -95,8 +99,10 @@ export default class IPFSService {
localStorage.setItem('dxvote-newProposal-hash', hash);

if (pinataService.auth) {
const pinataPin = await this.pin(hash);
const pinataPin = await pinataService.pin(hash);
console.debug('[PINATA PIN]', pinataPin.toString());
} else {
console.debug('[PINATA PIN] NOT AUTHENTICATED');
}
const ipfsPin = await this.pin(hash);
console.debug('[IPFS PIN]', ipfsPin);
Expand All @@ -115,7 +121,7 @@ export default class IPFSService {
const hash = await this.add(content);

if (this.context.pinataService.auth) {
const pinataPin = await this.pin(hash);
const pinataPin = await this.context.pinataService.pin(hash);
console.debug('[PINATA PIN]', pinataPin.toString());
}
const ipfsPin = await this.pin(hash);
Expand Down
2 changes: 1 addition & 1 deletion src/services/PinataService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class PinataService {
this.context = context;
}
defaultApiKey =
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySW5mb3JtYXRpb24iOnsiaWQiOiI4ZTNlZjUzNi0wZWQ5LTQ4YzAtOTFlYS1kNzUwYjk0Nzk4ZDMiLCJlbWFpbCI6Im1lQHJvc3NuZWlsc29uLmRldiIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJwaW5fcG9saWN5Ijp7InJlZ2lvbnMiOlt7ImlkIjoiRlJBMSIsImRlc2lyZWRSZXBsaWNhdGlvbkNvdW50IjoxfV0sInZlcnNpb24iOjF9LCJtZmFfZW5hYmxlZCI6ZmFsc2V9LCJhdXRoZW50aWNhdGlvblR5cGUiOiJzY29wZWRLZXkiLCJzY29wZWRLZXlLZXkiOiJlNmM5ZDA4ZGY3ODY0YWRhZWIyMyIsInNjb3BlZEtleVNlY3JldCI6ImRmYmY4ZmNiNGQ0YjQxNWViODgyZDM1YjgyMDFlMDVjNjk1MjBkZDllOTg2MzgxZTY3YTI1YTk2N2YyOWQxOGQiLCJpYXQiOjE2Mzk1OTg2MTl9.tkenai9BlBubfnPJmIXz9DkjJg12aCyk3BAtAc-TU1A';
'eyJhbG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