Skip to content
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
9 changes: 3 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,8 @@ yarn-debug.log*
yarn-error.log*

.vscode

# YoYo AI version control directory
.yoyo/

# cursor
.cursor
.playwright-mcp

.playwright-mcp
# YoYo AI version control directory
.yoyo/
2 changes: 2 additions & 0 deletions src/components/challenge-modal/challenge-modal.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@
font-size: 14px;
text-align: center;
padding: 20px 0;
word-break: break-word;
overflow-wrap: break-word;
}

.iframeWrapper {
Expand Down
27 changes: 24 additions & 3 deletions src/components/challenge-modal/challenge-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,25 @@ const RegularChallengeContent = ({ challenge, closeModal }: RegularChallengeCont
}
};

// Get URL for iframe challenge confirmation (hostname only for whitelisted sites, full URL otherwise)
const getChallengeUrl = () => {
try {
const iframeUrl = currentChallenge?.challenge;
if (!iframeUrl) return '';
const url = new URL(iframeUrl);

// Whitelist mintpass.org - only show hostname for trusted sites
if (url.hostname === 'mintpass.org') {
return url.hostname;
}

// For other sites, show full URL for transparency
return url.href;
} catch {
return '';
}
};

const handleLoadIframe = () => {
const iframeUrl = currentChallenge?.challenge;
if (!iframeUrl) return;
Expand Down Expand Up @@ -203,14 +222,16 @@ const RegularChallengeContent = ({ challenge, closeModal }: RegularChallengeCont
<>
<div className={styles.challengeMediaWrapper}>
<div className={`${styles.challengeMedia} ${styles.iframeChallengeWarning}`}>
{t('iframe_challenge_warning', {
defaultValue: 'This challenge requires loading an external website. Loading it will reveal your IP address to that website. Do you want to continue?',
{t('iframe_challenge_open_confirmation', {
subplebbit,
url: decodeURIComponent(getChallengeUrl()),
defaultValue: `p/${subplebbit} challenge wants to open ${decodeURIComponent(getChallengeUrl())}`,
})}
</div>
</div>
<div className={styles.challengeFooter}>
<span className={styles.buttons}>
<button onClick={handleLoadIframe}>{t('load_external_resource', { defaultValue: 'load' })}</button>
<button onClick={handleLoadIframe}>{t('open', { defaultValue: 'open' })}</button>
<button onClick={closeModal}>{t('cancel')}</button>
</span>
</div>
Expand Down
10 changes: 5 additions & 5 deletions src/views/settings/plebbit-options/plebbit-options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ const IPFSGatewaysSettings = ({ ipfsGatewayUrlsRef, mediaIpfsGatewayUrlRef }: Se
const PubsubProvidersSettings = ({ pubsubProvidersRef }: SettingsProps) => {
const account = useAccount();
const { plebbitOptions } = account || {};
const { pubsubHttpClientsOptions } = plebbitOptions || {};
const pubsubProvidersDefaultValue = pubsubHttpClientsOptions?.join('\n');
const { pubsubKuboRpcClientsOptions } = plebbitOptions || {};
const pubsubProvidersDefaultValue = pubsubKuboRpcClientsOptions?.join('\n');

return (
<div className={styles.pubsubProvidersSettings}>
Expand All @@ -57,7 +57,7 @@ const PubsubProvidersSettings = ({ pubsubProvidersRef }: SettingsProps) => {
autoCorrect='off'
autoComplete='off'
spellCheck='false'
rows={pubsubHttpClientsOptions?.length || 3}
rows={pubsubKuboRpcClientsOptions?.length || 3}
/>
</div>
);
Expand Down Expand Up @@ -200,7 +200,7 @@ const PlebbitOptions = () => {

const mediaIpfsGatewayUrl = mediaIpfsGatewayUrlRef.current?.value.trim() || undefined;

const pubsubHttpClientsOptions = pubsubProvidersRef.current?.value
const pubsubKuboRpcClientsOptions = pubsubProvidersRef.current?.value
.split('\n')
.map((url) => url.trim())
.filter((url) => url !== '');
Expand Down Expand Up @@ -242,7 +242,7 @@ const PlebbitOptions = () => {

const newPlebbitOptions: any = {};
if (ipfsGatewayUrls?.length) newPlebbitOptions.ipfsGatewayUrls = ipfsGatewayUrls;
if (pubsubHttpClientsOptions?.length) newPlebbitOptions.pubsubHttpClientsOptions = pubsubHttpClientsOptions;
if (pubsubKuboRpcClientsOptions?.length) newPlebbitOptions.pubsubKuboRpcClientsOptions = pubsubKuboRpcClientsOptions;
if (httpRoutersOptions?.length) newPlebbitOptions.httpRoutersOptions = httpRoutersOptions;
if (plebbitRpcClientsOptions) newPlebbitOptions.plebbitRpcClientsOptions = plebbitRpcClientsOptions;
if (dataPath) newPlebbitOptions.dataPath = dataPath;
Expand Down
2 changes: 1 addition & 1 deletion src/views/subplebbit-settings/subplebbit-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ const SubplebbitSettings = () => {
)}
{isReadOnly && !userIsOwnerOrAdmin && <div className={styles.infobar}>{t('owner_settings_notice')}</div>}
{isOffline && <div className={styles.infobar}>{offlineTitle}</div>}
{isChallengesReadOnly && <div className={styles.infobar}>cannot read or write anti-spam challenges, community node isn't reachable.</div>}
{isChallengesReadOnly && <div className={styles.infobar}>cannot read or write challenges, community node isn't reachable.</div>}
<Title isReadOnly={isReadOnly} />
<Description isReadOnly={isReadOnly} />
{!isInCreateSubplebbitView && <Address isReadOnly={isReadOnly} />}
Expand Down