Skip to content

Commit

Permalink
Merge pull request #888 from near/feat/commit-modal-bypass
Browse files Browse the repository at this point in the history
Bypass Commit Modal Config
  • Loading branch information
calebjacob authored Jan 5, 2024
2 parents 16e30a5 + e171bf7 commit 254e1c5
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
NEXT_PUBLIC_LOCAL_ENVIRONMENT=true
NEXT_PUBLIC_NETWORK_ID=mainnet
NEXT_PUBLIC_HOSTNAME=https://near.org
# endpoint to fetch TOS and Privacy Policy from IPFS
Expand All @@ -9,3 +10,6 @@ NEXT_PUBLIC_PRIVACY_CID=
NEXT_PUBLIC_NOTIFICATIONS_HOSTNAME=
NEXT_PUBLIC_NOTIFICATIONS_APPLICATION_SERVER_KEY=
NEXT_PUBLIC_NOTIFICATIONS_GATEWAY_URL=
# commit modal bypass
NEXT_PUBLIC_COMMIT_MODAL_BYPASS_AUTHOR_IDS=near,discom.testnet,discom-dev.testnet
NEXT_PUBLIC_COMMIT_MODAL_BYPASS_SOURCES=
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"local-storage": "^2.0.0",
"lodash": "^4.17.21",
"near-fastauth-wallet": "^0.0.10",
"near-social-vm": "github:NearSocial/VM#0285e7ca7126ebb865492bd6c8523338d09f99f1",
"near-social-vm": "github:NearSocial/VM#2.5.4",
"next": "^13.5.6",
"react": "^18.2.0",
"react-bootstrap": "^2.5.0",
Expand Down
16 changes: 8 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 17 additions & 4 deletions src/components/vm/VmInitializer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { isValidAttribute } from 'dompurify';
import { setupKeypom } from '@keypom/selector';
import type { WalletSelector } from '@near-wallet-selector/core';
import { setupWalletSelector } from '@near-wallet-selector/core';
Expand All @@ -15,6 +14,8 @@ import { setupNightly } from '@near-wallet-selector/nightly';
import { setupSender } from '@near-wallet-selector/sender';
import { setupWelldoneWallet } from '@near-wallet-selector/welldone-wallet';
import Big from 'big.js';
import { isValidAttribute } from 'dompurify';
import { mapValues } from 'lodash';
import { setupFastAuthWallet } from 'near-fastauth-wallet';
import {
CommitButton,
Expand All @@ -36,9 +37,14 @@ import { useAuthStore } from '@/stores/auth';
import { useIdosStore } from '@/stores/idosStore';
import { useVmStore } from '@/stores/vm';
import { recordWalletConnect, reset as resetAnalytics } from '@/utils/analytics';
import { networkId, signInContractId } from '@/utils/config';
import {
commitModalBypassAuthorIds,
commitModalBypassSources,
isLocalEnvironment,
networkId,
signInContractId,
} from '@/utils/config';
import { KEYPOM_OPTIONS } from '@/utils/keypom-options';
import { mapValues } from 'lodash';

export default function VmInitializer() {
const [signedIn, setSignedIn] = useState(false);
Expand Down Expand Up @@ -113,7 +119,14 @@ export default function VmInitializer() {
return <Link {...cleanProps} />;
},
},
features: { enableComponentSrcDataKey: true },
features: {
commitModalBypass: {
authorIds: commitModalBypassAuthorIds,
sources: commitModalBypassSources,
},
enableComponentSrcDataKey: true,
enableWidgetSrcWithCodeOverride: isLocalEnvironment,
},
});
}, [initNear]);

Expand Down
8 changes: 8 additions & 0 deletions src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,11 @@ export const notificationsHostName = process.env.NEXT_PUBLIC_NOTIFICATIONS_HOSTN
export const notificationsGatewayUrl = process.env.NEXT_PUBLIC_NOTIFICATIONS_GATEWAY_URL ?? 'https://near.org';
export const notificationsLocalStorageKey = 'push-notifications-v0';
export const localStorageAccountIdKey = 'near-social-vm:v01::accountId:';
export const isLocalEnvironment = process.env.NEXT_PUBLIC_LOCAL_ENVIRONMENT === 'true';

export const commitModalBypassAuthorIds = (process.env.NEXT_PUBLIC_COMMIT_MODAL_BYPASS_AUTHOR_IDS ?? '')
.split(',')
.filter((item) => !!item);
export const commitModalBypassSources = (process.env.NEXT_PUBLIC_COMMIT_MODAL_BYPASS_SOURCES ?? '')
.split(',')
.filter((item) => !!item);

0 comments on commit 254e1c5

Please sign in to comment.