diff --git a/components/account/grants.js b/components/account/grants.js
deleted file mode 100644
index 62fdfd73..00000000
--- a/components/account/grants.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import ToggleStorageBridgeAuthorization from "../repository/toggleStorageBridgeAuthorization";
-import ToggleGitServerAuthorization from "../repository/toggleGitServerAuthorization";
-
-function AccountGrants({ address, ...props }) {
- return (
-
- );
-}
-
-export default AccountGrants;
diff --git a/components/dashboard/dao.js b/components/dashboard/dao.js
index 00f0fd79..26ad2783 100644
--- a/components/dashboard/dao.js
+++ b/components/dashboard/dao.js
@@ -3,7 +3,6 @@ import Link from "next/link";
import { connect, useDispatch } from "react-redux";
import DAOMembersList from "./DAOMembersList";
import { createGroupProposal } from "../../store/actions/dao";
-import AccountGrants from "../account/grants";
import GreetDao from "../greetDao";
import { useApiClient } from "../../context/ApiClientContext";
import getGroupInfo from "../../helpers/getGroupInfo";
@@ -373,13 +372,6 @@ function DaoDashboard({ dao = {}, advanceUser, ...props }) {
onRefreshProposals={fetchProposals}
/>
);
- case "authorizations":
- return (
-
- );
default:
return null;
}
diff --git a/components/repository/cloneRepoInfo.js b/components/repository/cloneRepoInfo.js
index 1664a469..9431ff55 100644
--- a/components/repository/cloneRepoInfo.js
+++ b/components/repository/cloneRepoInfo.js
@@ -1,40 +1,51 @@
import { useEffect, useState } from "react";
import { connect } from "react-redux";
import { notify } from "reapop";
+import { useApiClient } from "../../context/ApiClientContext";
-function CloneRepoInfo({ remoteUrl, backups, ...props }) {
+function CloneRepoInfo({ remoteUrl, repositoryId, ...props }) {
const [tab, setTab] = useState("gitopia");
const [cloneCmd, setCloneCmd] = useState("git clone " + remoteUrl);
- const [isIpfsEnabled, setIsIpfsEnabled] = useState(false);
- const [ipfsLatestCid, setIpfsLatestCid] = useState("");
- const [isArweaveEnabled, setIsArweaveEnabled] = useState(false);
- const [arweaveLatestCid, setArweaveLatestCid] = useState("");
+ const [storageInfo, setStorageInfo] = useState(null);
+ const { storageApiClient } = useApiClient();
useEffect(() => {
if (tab === "gitopia") {
setCloneCmd("git clone " + remoteUrl);
- } else if (tab === "ipfs") {
- setCloneCmd("ipfs_clone " + remoteUrl);
- } else if (tab === "arweave") {
- setCloneCmd("arweave_clone " + remoteUrl);
}
}, [tab, remoteUrl]);
useEffect(() => {
- setIsIpfsEnabled(false);
- setIsArweaveEnabled(false);
- if (backups) {
- backups.map((b) => {
- if (b.store === "IPFS" && b.refs?.length) {
- setIsIpfsEnabled(true);
- setIpfsLatestCid(b.refs[b.refs.length - 1]);
- } else if (b.store === "ARWEAVE" && b.refs?.length) {
- setIsArweaveEnabled(true);
- setArweaveLatestCid(b.refs[b.refs.length - 1]);
+ const fetchStorageInfo = async () => {
+ if (repositoryId && storageApiClient) {
+ try {
+ const response = await storageApiClient.queryRepositoryPackfile(repositoryId);
+ // log response
+ console.log(response);
+ setStorageInfo(response.data.packfile);
+ } catch (error) {
+ console.error("Error fetching storage info:", error);
}
- });
+ }
+ };
+
+ if (tab === "storage") {
+ fetchStorageInfo();
+ }
+ }, [tab, repositoryId, storageApiClient]);
+
+ const formatSize = (bytes) => {
+ const units = ['B', 'KB', 'MB', 'GB'];
+ let size = bytes;
+ let unitIndex = 0;
+
+ while (size >= 1024 && unitIndex < units.length - 1) {
+ size /= 1024;
+ unitIndex++;
}
- }, [backups]);
+
+ return `${size.toFixed(2)} ${units[unitIndex]}`;
+ };
return (
@@ -66,36 +77,17 @@ function CloneRepoInfo({ remoteUrl, backups, ...props }) {
>
Gitopia Server
- {isIpfsEnabled ? (
-
- ) : (
- ""
- )}
- {isArweaveEnabled ? (
-
- ) : (
- ""
- )}
+
{tab === "gitopia" ? (
<>
@@ -130,95 +122,80 @@ function CloneRepoInfo({ remoteUrl, backups, ...props }) {
Learn more
- >
- ) : (
- ""
- )}
-
- {tab === "ipfs" || tab === "arweave" ? (
-
-
- {tab === "ipfs" ? (
-

- ) : (
-

- )}
-
-
-
-
- ) : (
- ""
- )}
- {tab === "gitopia" ? (
-
-
-
- ) : (
- ""
- )}
-
+ >
+ ) : tab === "storage" ? (
+
+ {storageInfo ? (
+
+
+

+
Storage Information
+
+
+
+ Provider:
+
+ {storageInfo.creator}
+
+
+
+ Size:
+ {formatSize(parseInt(storageInfo.size))}
+
+
+ IPFS CID:
+
+ {storageInfo.cid}
+
+
+
+ Root Hash:
+
+ {storageInfo.root_hash}
+
+
+
+
+ ) : (
+
Loading storage information...
+ )}
+
+ ) : null}
);
diff --git a/components/repository/mergePullRequestView.js b/components/repository/mergePullRequestView.js
index 9a90bf5f..6207f034 100644
--- a/components/repository/mergePullRequestView.js
+++ b/components/repository/mergePullRequestView.js
@@ -3,14 +3,12 @@ import { useEffect, useState } from "react";
import { notify } from "reapop";
import {
updatePullRequestState,
- authorizeGitServer,
mergePullRequest,
mergePullRequestForDao,
} from "../../store/actions/repository";
import pullRequestStateClass from "../../helpers/pullRequestStateClass";
import mergePullRequestCheck from "../../helpers/mergePullRequestCheck";
import getPullRequestMergePermission from "../../helpers/getPullRequestMergePermission";
-import getGitServerAuthorization from "../../helpers/getGitServerAuthStatus";
import getDao from "../../helpers/getDao";
import { useApiClient } from "../../context/ApiClientContext";
import { useRouter } from "next/router";
@@ -25,10 +23,6 @@ function MergePullRequestView({
const [stateClass, setStateClass] = useState("");
const [iconType, setIconType] = useState("check");
const [message, setMessage] = useState("");
- const [pullMergeAccess, setPullMergeAccess] = useState(false);
- const [pullMergeAccessDialogShown, setPullMergeAccessDialogShown] =
- useState(false);
- const [isGrantingAccess, setIsGrantingAccess] = useState(false);
const [requiresProposal, setRequiresProposal] = useState(false);
const [isCreatingProposal, setIsCreatingProposal] = useState(false);
const {
@@ -135,16 +129,6 @@ function MergePullRequestView({
);
if (user && user.havePermission) {
- let access = await getGitServerAuthorization(
- apiClient,
- props.selectedAddress
- );
- if (!access) {
- setPullMergeAccessDialogShown(true);
- setIsMerging(false);
- return;
- }
-
const res = await props.mergePullRequest(
apiClient,
cosmosBankApiClient,
@@ -183,17 +167,6 @@ function MergePullRequestView({
}
}, [pullRequest, props.selectedAddress, requiresProposal]);
- const refreshPullMergeAccess = async (mergeAfter = false) => {
- setPullMergeAccess(
- await getGitServerAuthorization(apiClient, props.selectedAddress)
- );
- if (mergeAfter) setTimeout(mergePull, 0);
- };
-
- useEffect(() => {
- refreshPullMergeAccess();
- }, [props.selectedAddress]);
-
const getMergeButtonText = () => {
if (isCreatingProposal) return "Creating Proposal...";
if (isMerging) return "Merging...";
@@ -284,56 +257,6 @@ function MergePullRequestView({
)}
-
-
-
-
-
- Gitopia data server does not have repository merge access on behalf
- of your account.
-
-
Server Address:
-
- {process.env.NEXT_PUBLIC_GIT_SERVER_WALLET_ADDRESS}
-
-
-
-
-
-
-
);
}
@@ -347,7 +270,6 @@ const mapStateToProps = (state) => {
export default connect(mapStateToProps, {
notify,
updatePullRequestState,
- authorizeGitServer,
mergePullRequest,
mergePullRequestForDao,
})(MergePullRequestView);
diff --git a/components/repository/toggleGitServerAuthorization.js b/components/repository/toggleGitServerAuthorization.js
deleted file mode 100644
index 3bda903a..00000000
--- a/components/repository/toggleGitServerAuthorization.js
+++ /dev/null
@@ -1,76 +0,0 @@
-import { useEffect, useState } from "react";
-import { connect } from "react-redux";
-import { updateAddressGrant } from "../../store/actions/user";
-import getGitServerAuthStatus from "../../helpers/getGitServerAuthStatus";
-import { useApiClient } from "../../context/ApiClientContext";
-
-function ToggleGitServerAuthorization({ address, onSuccess, ...props }) {
- const [currentState, setCurrentState] = useState(false);
- const [isToggling, setIsToggling] = useState(true);
- const { apiClient, cosmosBankApiClient, cosmosFeeegrantApiClient } =
- useApiClient();
-
- const toggleGrant = async () => {
- setIsToggling(true);
- const res = await props.updateAddressGrant(
- apiClient,
- cosmosBankApiClient,
- cosmosFeeegrantApiClient,
- address,
- 0,
- !currentState
- );
- if (res && res.code === 0) {
- if (onSuccess) await onSuccess(!currentState);
- setCurrentState(!currentState);
- }
- setIsToggling(false);
- };
-
- useEffect(() => {
- async function initAddress() {
- setIsToggling(true);
- setCurrentState(await getGitServerAuthStatus(apiClient, address));
- setIsToggling(false);
- }
- initAddress();
- }, [address]);
-
- return (
-
- );
-}
-
-const mapStateToProps = (state) => {
- return {
- selectedAddress: state.wallet.selectedAddress,
- };
-};
-
-export default connect(mapStateToProps, { updateAddressGrant })(
- ToggleGitServerAuthorization
-);
diff --git a/components/repository/toggleStorageBridgeAuthorization.js b/components/repository/toggleStorageBridgeAuthorization.js
deleted file mode 100644
index d87f1102..00000000
--- a/components/repository/toggleStorageBridgeAuthorization.js
+++ /dev/null
@@ -1,76 +0,0 @@
-import { useEffect, useState } from "react";
-import { connect } from "react-redux";
-import { updateAddressGrant } from "../../store/actions/user";
-import getStorageBridgeAuthStatus from "../../helpers/getStorageBridgeAuthStatus";
-import { useApiClient } from "../../context/ApiClientContext";
-
-function ToggleStorageBridgeAuthorization({ address, onSuccess, ...props }) {
- const [currentState, setCurrentState] = useState(false);
- const [isToggling, setIsToggling] = useState(true);
- const { apiClient, cosmosBankApiClient, cosmosFeegrantApiClient } =
- useApiClient();
-
- const toggleGrant = async () => {
- setIsToggling(true);
- const res = await props.updateAddressGrant(
- apiClient,
- cosmosBankApiClient,
- cosmosFeegrantApiClient,
- address,
- 1,
- !currentState
- );
- if (res && res.code === 0) {
- if (onSuccess) await onSuccess(!currentState);
- setCurrentState(!currentState);
- }
- setIsToggling(false);
- };
-
- useEffect(() => {
- async function initAddress() {
- setIsToggling(true);
- setCurrentState(await getStorageBridgeAuthStatus(apiClient, address));
- setIsToggling(false);
- }
- initAddress();
- }, [address]);
-
- return (
-
- );
-}
-
-const mapStateToProps = (state) => {
- return {
- selectedAddress: state.wallet.selectedAddress,
- };
-};
-
-export default connect(mapStateToProps, { updateAddressGrant })(
- ToggleStorageBridgeAuthorization
-);
diff --git a/context/ApiClientContext.js b/context/ApiClientContext.js
index 46b899c8..ae864587 100644
--- a/context/ApiClientContext.js
+++ b/context/ApiClientContext.js
@@ -6,6 +6,7 @@ import { Api as CosmosFeegrantApi } from "../store/cosmos.feegrant.v1beta1/rest"
import { Api as CosmosGovApi } from "../store/cosmos.gov.v1beta1/module/rest";
import { Api as IbcAppTransferApi } from "../store/ibc.applications.transfer.v1/module/rest";
import { Api as CosmosGroupApi } from "../store/cosmos.group.v1/rest";
+import { Api as StorageApi } from "../store/gitopia.gitopia.storage/rest";
import selectProvider from "../helpers/providerSelector";
import { setConfig } from "../store/actions/env";
@@ -22,6 +23,7 @@ export const ApiClientProvider = ({ children }) => {
const [cosmosGovApiClient, setCosmosGovApiClient] = useState(null);
const [ibcAppTransferApiClient, setIbcAppTransferApiClient] = useState(null);
const [cosmosGroupApiClient, setCosmosGroupApiClient] = useState(null);
+ const [storageApiClient, setStorageApiClient] = useState(null);
const [providerName, setProviderName] = useState(null);
const [apiUrl, setApiUrl] = useState(null);
const [rpcUrl, setRpcUrl] = useState(null);
@@ -53,6 +55,11 @@ export const ApiClientProvider = ({ children }) => {
});
setCosmosGroupApiClient(newCosmosGroupApiClient);
+ const newStorageApiClient = new StorageApi({
+ baseURL: apiNode,
+ });
+ setStorageApiClient(newStorageApiClient);
+
setProviderName(name);
setApiUrl(apiNode);
setRpcUrl(rpcNode);
@@ -107,6 +114,7 @@ export const ApiClientProvider = ({ children }) => {
cosmosGovApiClient,
ibcAppTransferApiClient,
cosmosGroupApiClient,
+ storageApiClient,
updateApiClient,
}}
>
diff --git a/helpers/getGitServerAuthStatus.js b/helpers/getGitServerAuthStatus.js
deleted file mode 100644
index a01edb57..00000000
--- a/helpers/getGitServerAuthStatus.js
+++ /dev/null
@@ -1,17 +0,0 @@
-export default async function getGitServerAuthStatus(apiClient, userAddress) {
- if (!userAddress) return null;
- try {
- const res = await apiClient.queryCheckGitServerAuthorization(
- userAddress,
- process.env.NEXT_PUBLIC_GIT_SERVER_WALLET_ADDRESS
- );
- if (res.status === 200 && res.data.haveAuthorization) {
- return true;
- } else {
- return false;
- }
- } catch (e) {
- console.error(e);
- return null;
- }
-}
diff --git a/helpers/getStorageBridgeAuthStatus.js b/helpers/getStorageBridgeAuthStatus.js
deleted file mode 100644
index 9dfecd77..00000000
--- a/helpers/getStorageBridgeAuthStatus.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import { useApiClient } from "../context/ApiClientContext";
-
-export default async function getStorageBridgeAuthStatus(
- apiClient,
- userAddress
-) {
- if (!userAddress) return null;
- try {
- const res = await apiClient.queryCheckStorageProviderAuthorization(
- userAddress,
- process.env.NEXT_PUBLIC_STORAGE_BRIDGE_WALLET_ADDRESS
- );
- if (res.status === 200 && res.data.haveAuthorization) {
- return true;
- } else {
- return false;
- }
- } catch (e) {
- console.error(e);
- return null;
- }
-}
diff --git a/helpers/gitopiaLive.js b/helpers/gitopiaLive.js
index 6308392d..a1dbcd06 100644
--- a/helpers/gitopiaLive.js
+++ b/helpers/gitopiaLive.js
@@ -289,6 +289,7 @@ function GitopiaLive(props) {
"/" +
props.repository.name
}
+ repositoryId={props.repository.id}
/>
) : (
diff --git a/pages/[userId]/[repositoryId]/fork.js b/pages/[userId]/[repositoryId]/fork.js
index ad212e2d..fcf6b03c 100644
--- a/pages/[userId]/[repositoryId]/fork.js
+++ b/pages/[userId]/[repositoryId]/fork.js
@@ -12,10 +12,8 @@ import useRepository from "../../../hooks/useRepository";
import TextInput from "../../../components/textInput";
import {
forkRepository,
- authorizeGitServer,
} from "../../../store/actions/repository";
import { useRouter } from "next/router";
-import getGitServerAuthorization from "../../../helpers/getGitServerAuthStatus";
import { useApiClient } from "../../../context/ApiClientContext";
export async function getStaticProps() {
@@ -63,9 +61,6 @@ function RepositoryInvokeForkView(props) {
);
const [isForking, setIsForking] = useState(false);
const [forkingSuccess, setForkingSuccess] = useState(false);
- const [forkingAccess, setForkingAccess] = useState(false);
- const [grantAccessDialogShown, setGrantAccessDialogShown] = useState(false);
- const [isGrantingAccess, setIsGrantingAccess] = useState(false);
const sanitizedNameTest = new RegExp(/[^\w.-]/g);
const router = useRouter();
@@ -125,14 +120,6 @@ function RepositoryInvokeForkView(props) {
};
const invokeForkRepository = async () => {
- let forkingAccess = await getGitServerAuthorization(
- apiClient,
- props.selectedAddress
- );
- if (!forkingAccess) {
- setGrantAccessDialogShown(true);
- return;
- }
setIsForking(true);
let validate = await validateRepository();
console.log(validate);
@@ -163,11 +150,7 @@ function RepositoryInvokeForkView(props) {
useEffect(() => {
setForkRepositoryName(repository?.name || "");
setForkRepositoryDescription(repository?.description || "");
- if (repository?.owner?.address === props.currentDashboard) {
- setOwnerId("");
- } else {
- setOwnerId(props.currentDashboard);
- }
+ setOwnerId(props.currentDashboard);
setForkOnlyOneBranchName(repository?.defaultBranch);
}, [repository, props.currentDashboard]);
@@ -358,68 +341,6 @@ function RepositoryInvokeForkView(props) {
-
-
-
-
- Gitopia data server does not have repository forking access on
- behalf of your account.
-
-
Server Address:
-
- {process.env.NEXT_PUBLIC_GIT_SERVER_WALLET_ADDRESS}
-
-
-
-
-
-
-
@@ -435,6 +356,6 @@ const mapStateToProps = (state) => {
};
};
-export default connect(mapStateToProps, { forkRepository, authorizeGitServer })(
+export default connect(mapStateToProps, { forkRepository })(
RepositoryInvokeForkView
);
diff --git a/pages/[userId]/[repositoryId]/index.js b/pages/[userId]/[repositoryId]/index.js
index 92fbb0b3..f104a964 100644
--- a/pages/[userId]/[repositoryId]/index.js
+++ b/pages/[userId]/[repositoryId]/index.js
@@ -422,7 +422,11 @@ function RepositoryView(props) {
-
+
) : (
diff --git a/pages/[userId]/[repositoryId]/releases/edit/[tagName].js b/pages/[userId]/[repositoryId]/releases/edit/[tagName].js
index 35f59126..7579926a 100644
--- a/pages/[userId]/[repositoryId]/releases/edit/[tagName].js
+++ b/pages/[userId]/[repositoryId]/releases/edit/[tagName].js
@@ -22,6 +22,7 @@ import Uploady, {
useItemProgressListener,
useItemStartListener,
useItemFinishListener,
+ useRequestPreSend,
} from "@rpldy/uploady";
import UploadButton from "@rpldy/upload-button";
import UploadDropZone from "@rpldy/upload-drop-zone";
@@ -29,6 +30,7 @@ import getBranchSha from "../../../../../helpers/getBranchSha";
import getRepositoryRelease from "../../../../../helpers/getRepositoryRelease";
import useRepository from "../../../../../hooks/useRepository";
import { useApiClient } from "../../../../../context/ApiClientContext";
+import { signUploadFileMessage } from "../../../../../store/actions/user";
export async function getStaticProps() {
return { props: {} };
@@ -100,11 +102,11 @@ function RepositoryReleaseEditView(props) {
if (res && res.code === 0) {
router.push(
"/" +
- repository.owner.id +
- "/" +
- repository.name +
- "/releases/tag/" +
- tagName
+ repository.owner.id +
+ "/" +
+ repository.name +
+ "/releases/tag/" +
+ tagName
);
}
}
@@ -144,6 +146,48 @@ function RepositoryReleaseEditView(props) {
}, [repository]);
const LogProgress = () => {
+ useRequestPreSend(async ({ items, options }) => {
+ try {
+ // Read file as ArrayBuffer using modern async/await approach
+ const arrayBuffer = await items[0].file.arrayBuffer();
+
+ // Calculate SHA256 using native Web Crypto API
+ const hashBuffer = await crypto.subtle.digest('SHA-256', arrayBuffer);
+
+ // Convert hash to hex string
+ const hashArray = Array.from(new Uint8Array(hashBuffer));
+ const sha256 = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
+
+ const data = {
+ action: "edit-release",
+ repositoryId: repository.id,
+ tagName,
+ name: items[0].file.name,
+ size: items[0].file.size,
+ sha256,
+ };
+
+ // Generate signature
+ const signature = await props.signUploadFileMessage(
+ apiClient,
+ cosmosBankApiClient,
+ cosmosFeegrantApiClient,
+ data
+ );
+
+ return {
+ options: {
+ params: {
+ signature: signature,
+ },
+ }
+ };
+ } catch (error) {
+ console.error('Error processing file:', error);
+ throw error;
+ }
+ });
+
useItemStartListener((item) => {
console.log("started", item);
setUploadingAttachment(item);
@@ -458,6 +502,6 @@ const mapStateToProps = (state) => {
};
};
-export default connect(mapStateToProps, { createRelease, createTag })(
+export default connect(mapStateToProps, { createRelease, createTag, signUploadFileMessage })(
RepositoryReleaseEditView
);
diff --git a/pages/[userId]/[repositoryId]/releases/new.js b/pages/[userId]/[repositoryId]/releases/new.js
index 85209353..d285f4b3 100644
--- a/pages/[userId]/[repositoryId]/releases/new.js
+++ b/pages/[userId]/[repositoryId]/releases/new.js
@@ -25,12 +25,14 @@ import Uploady, {
useItemProgressListener,
useItemStartListener,
useItemFinishListener,
+ useRequestPreSend,
} from "@rpldy/uploady";
import UploadButton from "@rpldy/upload-button";
import UploadDropZone from "@rpldy/upload-drop-zone";
import getBranchSha from "../../../../helpers/getBranchSha";
import useRepository from "../../../../hooks/useRepository";
import { useApiClient } from "../../../../context/ApiClientContext";
+import { signUploadFileMessage } from "../../../../store/actions/user";
export async function getStaticProps() {
return { props: {} };
@@ -48,6 +50,7 @@ const RepositoryReleaseView = ({
createRelease,
createReleaseForDao,
createTag,
+ signUploadFileMessage,
}) => {
const router = useRouter();
const { repository, refreshRepository } = useRepository();
@@ -175,7 +178,49 @@ const RepositoryReleaseView = ({
useEffect(updateTags, [repository]);
const LogProgress = () => {
- useItemStartListener((item) => {
+ useRequestPreSend(async ({items, options}) => {
+ try {
+ // Read file as ArrayBuffer using modern async/await approach
+ const arrayBuffer = await items[0].file.arrayBuffer();
+
+ // Calculate SHA256 using native Web Crypto API
+ const hashBuffer = await crypto.subtle.digest('SHA-256', arrayBuffer);
+
+ // Convert hash to hex string
+ const hashArray = Array.from(new Uint8Array(hashBuffer));
+ const sha256 = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
+
+ const data = {
+ action: "new-release",
+ repositoryId: repository.id,
+ tagName,
+ name: items[0].file.name,
+ size: items[0].file.size,
+ sha256,
+ };
+
+ // Generate signature
+ const signature = await signUploadFileMessage(
+ apiClient,
+ cosmosBankApiClient,
+ cosmosFeegrantApiClient,
+ data
+ );
+
+ return {
+ options: {
+ params: {
+ signature: signature,
+ },
+ }
+ };
+ } catch (error) {
+ console.error('Error processing file:', error);
+ throw error;
+ }
+ });
+
+ useItemStartListener(async (item) => {
console.log("started", item);
setUploadingAttachment(item);
});
@@ -441,8 +486,12 @@ const RepositoryReleaseView = ({
url: process.env.NEXT_PUBLIC_OBJECTS_URL + "/upload",
}}
>
-
-
+
+
Choose files or drag & drop here
@@ -508,5 +557,5 @@ export default connect(
(state) => ({
selectedAddress: state.wallet.selectedAddress,
}),
- { createRelease, createReleaseForDao, createTag }
+ { createRelease, createReleaseForDao, createTag, signUploadFileMessage }
)(RepositoryReleaseView);
diff --git a/pages/settings/index.js b/pages/settings/index.js
index 9a7b95ad..f417a25b 100644
--- a/pages/settings/index.js
+++ b/pages/settings/index.js
@@ -2,7 +2,6 @@ import Head from "next/head";
import Header from "../../components/header";
import { connect } from "react-redux";
import Footer from "../../components/footer";
-import AccountGrants from "../../components/account/grants";
import Link from "next/link";
export async function getStaticProps() {
@@ -48,18 +47,6 @@ function AccountView(props) {
{props.user.creator}
-
-
-
- Authorizations
-
-
-
-
-
diff --git a/store/actions/env.js b/store/actions/env.js
index 8719a3b9..609e3d88 100644
--- a/store/actions/env.js
+++ b/store/actions/env.js
@@ -121,7 +121,7 @@ export const signMessage = (
{
accountNumber: 0,
sequence: 0,
- chainId: info.default_node_info.network,
+ chainId: "gitopia",
}
);
if (wallet.activeWallet?.isLedger) {
diff --git a/store/actions/repository.js b/store/actions/repository.js
index 5def2eb9..797292e9 100644
--- a/store/actions/repository.js
+++ b/store/actions/repository.js
@@ -1592,31 +1592,14 @@ export const forkRepository = (
if (repoBranch) {
repository.branch = repoBranch;
}
- console.log("forking", repository);
try {
- const message = await env.txClient.msgInvokeForkRepository(repository);
+ const message = await env.txClient.msgForkRepository(repository);
const result = await sendTransaction({ message })(dispatch, getState);
if (result && result.code === 0) {
- const log = JSON.parse(result.rawLog);
- const taskId =
- log[0].events[1].attributes[
- log[0].events[1].attributes.findIndex((a) => a.key === "TaskId")
- ].value;
- try {
- const res = await watchTask(apiClient, taskId);
- if (res.state === "TASK_STATE_SUCCESS") {
getUserDetailsForSelectedAddress(apiClient)(dispatch, getState);
let url = "/" + ownerId + "/" + repository.forkRepositoryName;
return { url };
- } else if (res.state === "TASK_STATE_FAILURE") {
- dispatch(notify(res.message, "error"));
- return null;
- }
- } catch (e) {
- dispatch(notify(e.message, "error"));
- return null;
- }
} else {
dispatch(notify(result.rawLog, "error"));
return null;
@@ -1746,6 +1729,7 @@ export const createRelease = (
draft,
preRelease,
isTag,
+ provider: process.env.NEXT_PUBLIC_GIT_SERVER_WALLET_ADDRESS,
};
if (edit) {
@@ -1826,6 +1810,7 @@ export const createReleaseForDao = (
draft,
preRelease,
isTag,
+ provider: process.env.NEXT_PUBLIC_GIT_SERVER_WALLET_ADDRESS,
};
// Encode the message
@@ -1914,6 +1899,7 @@ export const deleteRelease = (
const release = {
creator: wallet.selectedAddress,
id: releaseId,
+ provider: process.env.NEXT_PUBLIC_GIT_SERVER_WALLET_ADDRESS,
};
try {
@@ -2540,48 +2526,3 @@ export const toggleRepositoryForking = (
}
};
};
-
-export const authorizeGitServer = (
- apiClient,
- cosmosBankApiClient,
- cosmosFeegrantApiClient
-) => {
- return async (dispatch, getState) => {
- if (
- !(await validatePostingEligibility(
- apiClient,
- cosmosBankApiClient,
- cosmosFeegrantApiClient,
- dispatch,
- getState,
- "grant access"
- ))
- )
- return null;
-
- const { wallet, env } = getState();
- try {
- const message = await env.txClient.msgAuthorizeProvider({
- creator: wallet.selectedAddress,
- granter: wallet.selectedAddress,
- provider: process.env.NEXT_PUBLIC_GIT_SERVER_WALLET_ADDRESS,
- permission: 0,
- });
- const result = await sendTransaction({ message })(dispatch, getState);
- updateUserBalance(cosmosBankApiClient, cosmosFeegrantApiClient)(
- dispatch,
- getState
- );
- console.log(result);
- if (result && result.code === 0) {
- return result;
- } else {
- dispatch(notify(result.rawLog, "error"));
- return null;
- }
- } catch (e) {
- console.error(e);
- dispatch(notify(e.message, "error"));
- }
- };
-};
diff --git a/store/actions/user.js b/store/actions/user.js
index 7938f354..e68eb638 100644
--- a/store/actions/user.js
+++ b/store/actions/user.js
@@ -479,66 +479,13 @@ const updateWalletsList = async (
// };
// };
-export const updateAddressGrant = (
- apiClient,
- cosmosBankApiClient,
- cosmosFeegrantApiClient,
- address,
- permission,
- allow
-) => {
- return async (dispatch, getState) => {
- try {
- await setupTxClients(
- apiClient,
- cosmosBankApiClient,
- cosmosFeegrantApiClient,
- dispatch,
- getState
- );
- } catch (e) {
- console.error(e);
- return null;
- }
- const { wallet, env } = getState();
- let fn = allow
- ? env.txClient.msgAuthorizeProvider
- : env.txClient.msgRevokeProviderPermission;
- let provider =
- permission === 1
- ? process.env.NEXT_PUBLIC_STORAGE_BRIDGE_WALLET_ADDRESS
- : process.env.NEXT_PUBLIC_GIT_SERVER_WALLET_ADDRESS;
- const message = await fn({
- creator: wallet.selectedAddress,
- granter: address,
- provider,
- permission,
- });
- return await handlePostingTransaction(
- cosmosBankApiClient,
- cosmosFeegrantApiClient,
- dispatch,
- getState,
- message
- );
- };
-};
-
export const signUploadFileMessage = (
apiClient,
cosmosBankApiClient,
cosmosFeegrantApiClient,
- name,
- size,
- md5
+ data
) => {
return async (dispatch, getState) => {
- const data = {
- // Any arbitrary object
- name,
- size,
- md5,
- };
try {
let TxRaw = (await import("cosmjs-types/cosmos/tx/v1beta1/tx")).TxRaw;
let toBase64 = (await import("@cosmjs/encoding")).toBase64;
diff --git a/store/gitopia.gitopia.storage/rest.js b/store/gitopia.gitopia.storage/rest.js
new file mode 100644
index 00000000..6a6c7693
--- /dev/null
+++ b/store/gitopia.gitopia.storage/rest.js
@@ -0,0 +1,265 @@
+/* eslint-disable */
+/* tslint:disable */
+/*
+ * ---------------------------------------------------------------
+ * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
+ * ## ##
+ * ## AUTHOR: acacode ##
+ * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
+ * ---------------------------------------------------------------
+ */
+export var StorageChallengeStatus;
+(function (StorageChallengeStatus) {
+ StorageChallengeStatus["CHALLENGE_STATUS_UNSPECIFIED"] = "CHALLENGE_STATUS_UNSPECIFIED";
+ StorageChallengeStatus["CHALLENGE_STATUS_PENDING"] = "CHALLENGE_STATUS_PENDING";
+ StorageChallengeStatus["CHALLENGE_STATUS_COMPLETED"] = "CHALLENGE_STATUS_COMPLETED";
+ StorageChallengeStatus["CHALLENGE_STATUS_FAILED"] = "CHALLENGE_STATUS_FAILED";
+ StorageChallengeStatus["CHALLENGE_STATUS_TIMEOUT"] = "CHALLENGE_STATUS_TIMEOUT";
+})(StorageChallengeStatus || (StorageChallengeStatus = {}));
+export var StorageChallengeType;
+(function (StorageChallengeType) {
+ StorageChallengeType["CHALLENGE_TYPE_UNSPECIFIED"] = "CHALLENGE_TYPE_UNSPECIFIED";
+ StorageChallengeType["CHALLENGE_TYPE_PACKFILE"] = "CHALLENGE_TYPE_PACKFILE";
+ StorageChallengeType["CHALLENGE_TYPE_RELEASE_ASSET"] = "CHALLENGE_TYPE_RELEASE_ASSET";
+})(StorageChallengeType || (StorageChallengeType = {}));
+export var StorageProviderStatus;
+(function (StorageProviderStatus) {
+ StorageProviderStatus["PROVIDER_STATUS_UNSPECIFIED"] = "PROVIDER_STATUS_UNSPECIFIED";
+ StorageProviderStatus["PROVIDER_STATUS_ACTIVE"] = "PROVIDER_STATUS_ACTIVE";
+ StorageProviderStatus["PROVIDER_STATUS_INACTIVE"] = "PROVIDER_STATUS_INACTIVE";
+ StorageProviderStatus["PROVIDER_STATUS_SUSPENDED"] = "PROVIDER_STATUS_SUSPENDED";
+ StorageProviderStatus["PROVIDER_STATUS_UNREGISTERING"] = "PROVIDER_STATUS_UNREGISTERING";
+})(StorageProviderStatus || (StorageProviderStatus = {}));
+import axios from "axios";
+export var ContentType;
+(function (ContentType) {
+ ContentType["Json"] = "application/json";
+ ContentType["FormData"] = "multipart/form-data";
+ ContentType["UrlEncoded"] = "application/x-www-form-urlencoded";
+})(ContentType || (ContentType = {}));
+export class HttpClient {
+ constructor({ securityWorker, secure, format, ...axiosConfig } = {}) {
+ this.securityData = null;
+ this.setSecurityData = (data) => {
+ this.securityData = data;
+ };
+ this.request = async ({ secure, path, type, query, format, body, ...params }) => {
+ const secureParams = ((typeof secure === "boolean" ? secure : this.secure) &&
+ this.securityWorker &&
+ (await this.securityWorker(this.securityData))) ||
+ {};
+ const requestParams = this.mergeRequestParams(params, secureParams);
+ const responseFormat = (format && this.format) || void 0;
+ if (type === ContentType.FormData && body && body !== null && typeof body === "object") {
+ requestParams.headers.common = { Accept: "*/*" };
+ requestParams.headers.post = {};
+ requestParams.headers.put = {};
+ body = this.createFormData(body);
+ }
+ return this.instance.request({
+ ...requestParams,
+ headers: {
+ ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}),
+ ...(requestParams.headers || {}),
+ },
+ params: query,
+ responseType: responseFormat,
+ data: body,
+ url: path,
+ });
+ };
+ this.instance = axios.create({ ...axiosConfig, baseURL: axiosConfig.baseURL || "" });
+ this.secure = secure;
+ this.format = format;
+ this.securityWorker = securityWorker;
+ }
+ mergeRequestParams(params1, params2) {
+ return {
+ ...this.instance.defaults,
+ ...params1,
+ ...(params2 || {}),
+ headers: {
+ ...(this.instance.defaults.headers || {}),
+ ...(params1.headers || {}),
+ ...((params2 && params2.headers) || {}),
+ },
+ };
+ }
+ createFormData(input) {
+ return Object.keys(input || {}).reduce((formData, key) => {
+ const property = input[key];
+ formData.append(key, property instanceof Blob
+ ? property
+ : typeof property === "object" && property !== null
+ ? JSON.stringify(property)
+ : `${property}`);
+ return formData;
+ }, new FormData());
+ }
+}
+/**
+ * @title gitopia/gitopia/storage/events.proto
+ * @version version not set
+ */
+export class Api extends HttpClient {
+ constructor() {
+ super(...arguments);
+ /**
+ * No description
+ *
+ * @tags Query
+ * @name QueryChallenge
+ * @summary Challenge queries a challenge by id
+ * @request GET:/gitopia/gitopia/storage/challenge/{id}
+ */
+ this.queryChallenge = (id, params = {}) => this.request({
+ path: `/gitopia/gitopia/storage/challenge/${id}`,
+ method: "GET",
+ format: "json",
+ ...params,
+ });
+ /**
+ * No description
+ *
+ * @tags Query
+ * @name QueryChallenges
+ * @request GET:/gitopia/gitopia/storage/challenges
+ */
+ this.queryChallenges = (query, params = {}) => this.request({
+ path: `/gitopia/gitopia/storage/challenges`,
+ method: "GET",
+ query: query,
+ format: "json",
+ ...params,
+ });
+ /**
+ * No description
+ *
+ * @tags Query
+ * @name QueryPackfile
+ * @summary Packfile queries a packfile by id
+ * @request GET:/gitopia/gitopia/storage/packfile/{id}
+ */
+ this.queryPackfile = (id, params = {}) => this.request({
+ path: `/gitopia/gitopia/storage/packfile/${id}`,
+ method: "GET",
+ format: "json",
+ ...params,
+ });
+ /**
+ * No description
+ *
+ * @tags Query
+ * @name QueryPackfiles
+ * @summary Packfiles queries all packfiles
+ * @request GET:/gitopia/gitopia/storage/packfiles
+ */
+ this.queryPackfiles = (query, params = {}) => this.request({
+ path: `/gitopia/gitopia/storage/packfiles`,
+ method: "GET",
+ query: query,
+ format: "json",
+ ...params,
+ });
+ /**
+ * No description
+ *
+ * @tags Query
+ * @name QueryParams
+ * @summary Params queries the parameters of the module
+ * @request GET:/gitopia/gitopia/storage/params
+ */
+ this.queryParams = (params = {}) => this.request({
+ path: `/gitopia/gitopia/storage/params`,
+ method: "GET",
+ format: "json",
+ ...params,
+ });
+ /**
+ * No description
+ *
+ * @tags Query
+ * @name QueryProvider
+ * @summary Provider queries a storage provider by address
+ * @request GET:/gitopia/gitopia/storage/provider/{address}
+ */
+ this.queryProvider = (address, params = {}) => this.request({
+ path: `/gitopia/gitopia/storage/provider/${address}`,
+ method: "GET",
+ format: "json",
+ ...params,
+ });
+ /**
+ * No description
+ *
+ * @tags Query
+ * @name QueryProviders
+ * @summary Providers queries all storage providers
+ * @request GET:/gitopia/gitopia/storage/providers
+ */
+ this.queryProviders = (query, params = {}) => this.request({
+ path: `/gitopia/gitopia/storage/providers`,
+ method: "GET",
+ query: query,
+ format: "json",
+ ...params,
+ });
+ /**
+ * No description
+ *
+ * @tags Query
+ * @name QueryReleaseAsset
+ * @summary ReleaseAsset queries a release asset by id
+ * @request GET:/gitopia/gitopia/storage/release-asset/{id}
+ */
+ this.queryReleaseAsset = (id, params = {}) => this.request({
+ path: `/gitopia/gitopia/storage/release-asset/${id}`,
+ method: "GET",
+ format: "json",
+ ...params,
+ });
+ /**
+ * No description
+ *
+ * @tags Query
+ * @name QueryReleaseAssets
+ * @summary ReleaseAssets queries all release assets
+ * @request GET:/gitopia/gitopia/storage/release-assets
+ */
+ this.queryReleaseAssets = (query, params = {}) => this.request({
+ path: `/gitopia/gitopia/storage/release-assets`,
+ method: "GET",
+ query: query,
+ format: "json",
+ ...params,
+ });
+ /**
+ * No description
+ *
+ * @tags Query
+ * @name QueryRepositoryPackfile
+ * @summary RepositoryPackfile queries a packfile for a repository
+ * @request GET:/gitopia/gitopia/storage/repository/{repository_id}/packfile
+ */
+ this.queryRepositoryPackfile = (repositoryId, params = {}) => this.request({
+ path: `/gitopia/gitopia/storage/repository/${repositoryId}/packfile`,
+ method: "GET",
+ format: "json",
+ ...params,
+ });
+ /**
+ * No description
+ *
+ * @tags Query
+ * @name QueryRepositoryReleaseAsset
+ * @summary RepositoryReleaseAsset queries a release asset for a repository by repository id, tag and name
+ * @request GET:/gitopia/gitopia/storage/repository/{repository_id}/release-asset/{tag}/{name}
+ */
+ this.queryRepositoryReleaseAsset = (repositoryId, tag, name, params = {}) => this.request({
+ path: `/gitopia/gitopia/storage/repository/${repositoryId}/release-asset/${tag}/${name}`,
+ method: "GET",
+ format: "json",
+ ...params,
+ });
+ }
+}