Skip to content

Commit

Permalink
[Substrate Files] New files module (polkadot-js#6106)
Browse files Browse the repository at this point in the history
* Upgrade crust-pin to Crust Mainnet

* Update yarn lock

* Files Module (#6)

* Describe file's README

* Change Endpoint name and location

* Update file's README

* Add locales for files

* Files Module (#6)

* Describe file's README

* Change Endpoint name and location

* Update file's README

* Add locales for files

* Update yarn locks file

* Update Crust Pinner to bearer authorization (#7)

* Fix yarn lock

* Add folder support (#8)

* Add folder support

* Fix

* Fix files download

* Fix translation

* Upgrade react component

* Fix ipfs gateway (#9)

* Fix yarnlock

* Upgrade metadata

* Resolve polkadot-js version

* Change copyright

* Fix lint(copyright)

Co-authored-by: Eericxu <[email protected]>
Co-authored-by: Gavin Fu <[email protected]>
Co-authored-by: Yashiro <[email protected]>
  • Loading branch information
4 people authored Feb 17, 2022
1 parent 7be8f22 commit 0d0bb48
Show file tree
Hide file tree
Showing 27 changed files with 1,326 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/apps-config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ export * from './extensions';
export * from './links';
export * from './settings';
export * from './ui';
export * from './ipfs-gateway-endpoints';
32 changes: 32 additions & 0 deletions packages/apps-config/src/ipfs-gateway-endpoints/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2017-2022 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0

import type { TFunction } from 'i18next';
import type { AuthIpfsEndpoint } from './types';

// Definitions here are with the following values -
// info: the name of a logo as defined in ../ui/logos, specifically in namedLogos
// text: the IPFS endpoint name
// value: the IPFS endpoint domain
// location: IPFS gateway location
export function createAuthIpfsEndpoints (t: TFunction): AuthIpfsEndpoint[] {
return [
{
location: t('Singapore'),
text: t('DCF'),
value: 'https://crustipfs.xyz'
},
{
location: t('Seattle'),
text: t('Crust Network'),
value: 'https://crustwebsites.net'
},
{
location: t('Berlin'),
text: t('⚡️ Thunder Gateway'),
value: 'https://gw.crustapps.net'
}
];
}

export type { AuthIpfsEndpoint };
8 changes: 8 additions & 0 deletions packages/apps-config/src/ipfs-gateway-endpoints/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright 2017-2022 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0

export interface AuthIpfsEndpoint {
text?: string;
value: string;
location?: string;
}
20 changes: 20 additions & 0 deletions packages/apps-routing/src/files.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2017-2022 @polkadot/apps-routing authors & contributors
// SPDX-License-Identifier: Apache-2.0

import type { TFunction } from 'i18next';
import type { Route } from './types';

import Component from '@polkadot/app-files';

export default function create (t: TFunction): Route {
return {
Component,
display: {
needsApi: []
},
group: 'files',
icon: 'file',
name: 'files',
text: t('nav.files', 'Files', { ns: 'apps-routing' })
};
}
2 changes: 2 additions & 0 deletions packages/apps-routing/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import council from './council';
import democracy from './democracy';
import explorer from './explorer';
import extrinsics from './extrinsics';
import files from './files';
import gilt from './gilt';
import js from './js';
import membership from './membership';
Expand Down Expand Up @@ -60,6 +61,7 @@ export default function create (t: TFunction): Routes {
signing(t),
sudo(t),
js(t),
files(t),
settings(t)
];
}
2 changes: 1 addition & 1 deletion packages/apps-routing/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import type { IconName } from '@fortawesome/fontawesome-svg-core';
import type { AppProps, BareProps } from '@polkadot/react-components/types';

export type RouteGroup = 'accounts' | 'developer' | 'governance' | 'network' | 'settings';
export type RouteGroup = 'accounts' | 'developer' | 'governance' | 'network' | 'files' | 'settings';

export interface RouteProps extends AppProps, BareProps {
location: any;
Expand Down
40 changes: 40 additions & 0 deletions packages/apps/public/locales/en/app-files.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"Copy file cid": "Copy file cid",
"Copy link": "Copy link",
"Crust Pinner": "Crust Pinner",
"Do not upload files larger than 100MB!": "Do not upload files larger than 100MB!",
"Download": "Download",
"Export": "Export",
"File": "File",
"File streaming and wallet authentication will be processed by the chosen gateway.": "File streaming and wallet authentication will be processed by the chosen gateway.",
"Folder": "Folder",
"Import": "Import",
"Import Success": "Import Success",
"Import files": "Import files",
"Importing": "Importing",
"Loading": "Loading",
"Need to connect a plug-in wallet or import an account first": "Need to connect a plug-in wallet or import an account first",
"No files": "No files",
"Note: The file list is cached locally, switching browsers or devices will not keep displaying the original browser information.": "Note: The file list is cached locally, switching browsers or devices will not keep displaying the original browser information.",
"Please choose account": "Please choose account",
"Please do not upload more than 2000 files": "Please do not upload more than 2000 files",
"Please select non-empty folder": "Please select non-empty folder",
"Select a Web3 IPFS Gateway": "Select a Web3 IPFS Gateway",
"Select a Web3 IPFS Pinner": "Select a Web3 IPFS Pinner",
"Sign and Upload": "Sign and Upload",
"The account's password specified at the creation of this account.": "The account's password specified at the creation of this account.",
"Upload": "Upload",
"Upload File": "Upload File",
"View status in Crust": "View status in Crust",
"Your Files": "Your Files",
"Your file will be pinned to IPFS for long-term storage.": "Your file will be pinned to IPFS for long-term storage.",
"action": "action",
"file cid": "file cid",
"file content error": "file content error",
"file error": "file error",
"file size": "file size",
"files": "files",
"password": "password",
"status": "status",
"transferrable": "transferrable"
}
1 change: 1 addition & 0 deletions packages/apps/public/locales/en/apps-routing.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"nav.democracy": "Democracy",
"nav.explorer": "Explorer",
"nav.extrinsics": "Extrinsics",
"nav.files": "Files",
"nav.gilt": "Gilt",
"nav.js": "JavaScript",
"nav.membership": "Membership",
Expand Down
1 change: 1 addition & 0 deletions packages/apps/public/locales/en/apps.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"Accounts": "Accounts",
"Developer": "Developer",
"Files": "Files",
"Governance": "Governance",
"Initializing connection": "Initializing connection",
"Network": "Network",
Expand Down
1 change: 1 addition & 0 deletions packages/apps/public/locales/en/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"app-democracy.json",
"app-explorer.json",
"app-extrinsics.json",
"app-files.json",
"app-gilt.json",
"app-js.json",
"app-parachains.json",
Expand Down
29 changes: 28 additions & 1 deletion packages/apps/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"Aye": "",
"Aye: {{count}}": "",
"Backup": "",
"Berlin": "",
"Blocks nominations": "",
"Bond": "",
"Bounty approval under voting": "",
Expand All @@ -35,12 +36,14 @@
"Contracts": "",
"Controller account": "",
"Create a backup file for this account": "",
"Crust Network": "",
"Curator has been proposed by council. The bounty is waiting for curator to accept the role.": "",
"Curator proposal under voting": "",
"Curator slash under voting": "",
"Curator's deposit": "",
"Curator's deposit will be slashed and curator will be unassigned. Bounty will return to the Funded state.": "",
"Curator's fee": "",
"DCF": "",
"Dark theme (experimental, work-in-progress)": "",
"Defender": "",
"Delegate": "",
Expand All @@ -53,7 +56,11 @@
"Distinct stash and controller accounts are recommended to ensure fund security. You will be allowed to make the transaction, but take care to not tie up all funds, only use a portion of the available funds during this period.": "",
"Evaluated {{count}} keys in {{elapsed}}s ({{avg}} keys/s)": "",
"Execute": "",
"Export": "",
"Extensions": "",
"File": "",
"Files": "",
"Folder": "",
"For approvals outstanding approvers will be shown, for hashes that should be cancelled the first approver is required.": "",
"For final approvals, the actual full call data is required to execute the transaction": "",
"Forget this account": "",
Expand All @@ -63,6 +70,10 @@
"If the motion is approved, Curator's deposit will be slashed and Curator will be unassigned. Bounty will return to the Funded state.": "",
"If the motion is approved, the current Curator will be unassigned and the Bounty will return to the Funded state.": "",
"If you have not claimed rewards straight after the end of the era, the validator is in the active set and you are seeing no rewards, this would mean that the reward payout transaction was made by another account on your behalf. Always check your favorite explorer to see any historic payouts made to your accounts.": "",
"Import": "",
"Import Success": "",
"Import files": "",
"Importing": "",
"Inactive": "",
"Initiate recovery for another": "",
"Ledger app type (originated from)": "",
Expand All @@ -86,14 +97,17 @@
"Nominating": "",
"Nominators": "",
"None": "",
"Note: The file list is cached locally, switching browsers or devices will not keep displaying the original browser information.": "",
"Online message": "",
"Override any applicable values for the specific signed output. These will be used to construct and display the signed transaction.": "",
"Oversubscribed": "",
"Own stashes": "",
"Own validators": "",
"Para validator": "",
"Payouts of rewards for a validator can be initiated by any account. This means that as soon as a validator or nominator requests a payout for an era, all the nominators for that validator will be rewarded. Each user does not need to claim individually and the suggestion is that validators should claim rewards for everybody as soon as an era ends.": "",
"Please do not upload more than 2000 files": "",
"Please read these terms and conditions carefully. By submitting this statement, you are deemed to have accepted these Terms and Conditions. If you do not agree to these terms, please refrain from accessing or proceeding. You can also find them at:": "",
"Please select non-empty folder": "",
"Prior locked voting": "",
"Produced blocks": "",
"Proposer": "",
Expand All @@ -102,10 +116,12 @@
"Retrieving nominators": "",
"Retrieving validators": "",
"Save": "",
"Seattle": "",
"Set on-chain identity": "",
"Set on-chain sub-identities": "",
"Settings": "",
"Show address on hardware device": "",
"Singapore": "",
"Slash curator": "",
"Slash curator (Council)": "",
"Slashed": "",
Expand Down Expand Up @@ -169,13 +185,17 @@
"Unassign curator": "",
"Unassign curator under voting": "",
"Undelegate": "",
"United States": "",
"Unknown": "",
"Unless you are a developer with insight into what the specific script does to your environment (based on reading the code being executed) generally the advice would be to not use this environment.": "",
"Unlock the sending account to allow signing of this transaction.": "",
"Unlock vested amount": "",
"Upload": "",
"Upload & deploy code": "",
"Upload & deploy code {{info}}": "",
"Upload File": "",
"Validators": "",
"View status in Crust": "",
"Vote": "",
"Voting": "",
"Voting costs nothing other than the transaction fee and can be done from all accounts with a non-zero spendable balance.": "",
Expand All @@ -187,6 +207,7 @@
"You need to sign an attestation for the following accounts:": "",
"account type": "",
"accounts": "",
"action": "",
"activate": "",
"address copied": "",
"address index": "",
Expand Down Expand Up @@ -239,6 +260,11 @@
"events": "",
"external": "",
"extrinsics": "",
"file cid": "",
"file content error": "",
"file error": "",
"file size": "",
"files": "",
"finder": "",
"freezer": "",
"frozen": "",
Expand Down Expand Up @@ -334,5 +360,6 @@
"{{balance}} voted": "",
"{{count}} key/value pairs encoded for submission": "",
"{{days}} days": "",
"{{percentage}}% turnout": ""
"{{percentage}}% turnout": "",
"⚡️ Thunder Gateway": ""
}
1 change: 1 addition & 0 deletions packages/apps/public/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@
"Show address on hardware device": "在硬件设备上显示地址",
"Sign (no submission)": "签名(不提交)",
"Sign and Submit": "签名并提交",
"Sign and Upload": "签名并上传",
"Sign for multisig": "多重签名",
"Sign message": "签名消息",
"Sign via Qr": "通过 Qr 签名",
Expand Down
1 change: 1 addition & 0 deletions packages/apps/src/Menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ function Menu ({ className = '' }: Props): React.ReactElement<Props> {
const groupRef = useRef({
accounts: t('Accounts'),
developer: t('Developer'),
files: t('Files'),
governance: t('Governance'),
network: t('Network'),
settings: t('Settings')
Expand Down
Empty file added packages/page-files/.skip-build
Empty file.
Empty file added packages/page-files/.skip-npm
Empty file.
Loading

0 comments on commit 0d0bb48

Please sign in to comment.