{getDefaultChallengeDescription(name)}
- {challenge?.optionInputs?.map((inputOption: OptionInput) => (
-
- {inputOption.label}
-
{inputOption.description}
+ {challengeSettings.map((setting) => (
+
+
{setting?.label}
+
{setting?.description}
handleOptionChange(inputOption.option, e.target.value)}
- required={inputOption.required || false}
+ value={options && (options[setting?.option] || setting?.default || '')}
+ placeholder={setting?.placeholder || ''}
+ onChange={(e) => handleOptionChange(setting?.option, e.target.value)}
+ required={setting?.required || false}
/>
))}
Exclude from challenge
+
+ Users
+
Exclude specific users by their addresses, separated by a comma
+
handleExcludeAddress(e.target.value)}
+ />
+
+
+ Users with Karma
+
Minimum post karma required:
+
handleExcludeChange('postScore', e.target.value)} />
+
Minimum comment karma required:
+
handleExcludeChange('postReply', e.target.value)} />
+
+
+ Users by account age
+
Minimum account age in Unix Timestamp (seconds):
+
handleExcludeChange('firstCommentTimestamp', e.target.value)}
+ />
+
+
);
@@ -419,9 +427,11 @@ const Challenges = () => {
};
const handleAddChallenge = () => {
+ const defaultChallenge = 'captcha-canvas-v3';
+ const options = getDefaultChallengeOptions(defaultChallenge);
const newChallenge = {
- name: 'captcha-canvas-v3',
- optionInputs: getDefaultOptionInputs('captcha-canvas-v3'),
+ name: defaultChallenge,
+ options,
exclude: getDefaultExclude(),
};
const updatedChallenges = [...(settings?.challenges || []), newChallenge];
@@ -437,7 +447,7 @@ const Challenges = () => {
const handleChallengeTypeChange = (index: number, newType: string) => {
const updatedChallenges = [...challenges];
- updatedChallenges[index] = { ...updatedChallenges[index], name: newType, optionInputs: getDefaultOptionInputs(newType) };
+ updatedChallenges[index] = { ...updatedChallenges[index], name: newType, options: getDefaultChallengeOptions(newType) };
setSubmitStore({ settings: { ...settings, challenges: updatedChallenges } });
};
@@ -473,13 +483,13 @@ const Challenges = () => {
);
};
-const FullSettings = () => {
+const JSONSettings = () => {
const { title, description, address, suggested, rules, roles, settings, subplebbitAddress, setSubmitStore } = useSubplebbitSettingsStore();
const [text, setText] = useState('');
useEffect(() => {
- const fullSettings = JSON.stringify({ title, description, address, suggested, rules, roles, settings, subplebbitAddress }, null, 2);
- setText(fullSettings);
+ const JSONSettings = JSON.stringify({ title, description, address, suggested, rules, roles, settings, subplebbitAddress }, null, 2);
+ setText(JSONSettings);
}, [title, description, address, suggested, rules, roles, settings, subplebbitAddress]);
const handleChange = (newText: string) => {
@@ -494,9 +504,9 @@ const FullSettings = () => {
return (
-
full settings data
+
JSON Settings
quickly copy or paste the community settings
-
@@ -570,7 +580,7 @@ const SubplebbitSettings = () => {
{/* subplebbit.settings is private, only shows to the sub owner */}
{settings?.challenges &&
}
-
+
diff --git a/yarn.lock b/yarn.lock
index 5198fc6c..79d4b4e3 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2598,58 +2598,6 @@
uuid "9.0.0"
viem "1.5.2"
-"@plebbit/plebbit-js@https://github.com/plebbit/plebbit-js.git#d081a9f4f1a086b5fccee5e9f332e113f61a90f1":
- version "0.0.3"
- resolved "https://github.com/plebbit/plebbit-js.git#d081a9f4f1a086b5fccee5e9f332e113f61a90f1"
- dependencies:
- "@ensdomains/eth-ens-namehash" "2.0.15"
- "@keyv/sqlite" "3.6.2"
- "@plebbit/plebbit-logger" "github:plebbit/plebbit-logger#9525ca9539479918931c3b334e8d490d1c87e507"
- "@plebbit/proper-lockfile" "github:plebbit/node-proper-lockfile#7fd6332117340c1d3d98dd0afee2d31cc06f72b8"
- "@types/node-fetch" "2.6.2"
- "@types/proper-lockfile" "4.1.2"
- "@types/uuid" "8.3.4"
- assert "2.0.0"
- async-wait-until "2.0.12"
- better-sqlite3 "9.2.0"
- buffer "6.0.3"
- captcha-canvas "3.2.1"
- cbor "9.0.1"
- debounce "1.2.1"
- err-code "3.0.1"
- ethers "6.7.0"
- file-type "16.5.4"
- form-data "4.0.0"
- hpagent "1.2.0"
- ipfs-http-client "56.0.3"
- ipfs-only-hash "4.0.0"
- is-ipfs "6.0.2"
- jose "4.11.0"
- js-sha256 "0.9.0"
- keyv "4.5.4"
- knex "3.0.1"
- libp2p-crypto "0.21.2"
- limiter "2.1.0"
- localforage "1.10.0"
- lodash-es "4.17.21"
- lru-cache "7.18.3"
- open-graph-scraper "4.11.1"
- p-limit "3.1.0"
- p-timeout "4.1.0"
- peer-id "0.16.0"
- probe-image-size "^7.2.3"
- retry "0.13.1"
- rpc-websockets "7.6.0"
- safe-stable-stringify "2.4.1"
- sha1-uint8array "0.10.3"
- skia-canvas "1.0.0"
- sqlite3 "5.1.6"
- tiny-typed-emitter "2.1.0"
- tinycache "1.1.2"
- ts-custom-error "3.3.1"
- uuid "9.0.0"
- viem "1.5.2"
-
"@plebbit/plebbit-logger@github:plebbit/plebbit-logger#9525ca9539479918931c3b334e8d490d1c87e507":
version "0.0.1"
uid "9525ca9539479918931c3b334e8d490d1c87e507"
@@ -2663,11 +2611,11 @@
dependencies:
debug "4.3.3"
-"@plebbit/plebbit-react-hooks@https://github.com/plebbit/plebbit-react-hooks.git#57f8891697134e8aa65f286ffd8bdbda9a6bd512":
+"@plebbit/plebbit-react-hooks@https://github.com/plebbit/plebbit-react-hooks.git#6b614e0bf6c304de7b184564198a0ce7b98bca1d":
version "0.0.1"
- resolved "https://github.com/plebbit/plebbit-react-hooks.git#57f8891697134e8aa65f286ffd8bdbda9a6bd512"
+ resolved "https://github.com/plebbit/plebbit-react-hooks.git#6b614e0bf6c304de7b184564198a0ce7b98bca1d"
dependencies:
- "@plebbit/plebbit-js" "https://github.com/plebbit/plebbit-js.git#d081a9f4f1a086b5fccee5e9f332e113f61a90f1"
+ "@plebbit/plebbit-js" "https://github.com/plebbit/plebbit-js.git#4a7ced7497fcbf863e9457b7e83a7bb2889bd518"
"@plebbit/plebbit-logger" "https://github.com/plebbit/plebbit-logger.git"
assert "2.0.0"
ethers "5.6.9"
@@ -13045,7 +12993,7 @@ pretty-format@^29.0.0, pretty-format@^29.7.0:
ansi-styles "^5.0.0"
react-is "^18.0.0"
-probe-image-size@7.2.3, probe-image-size@^7.2.3:
+probe-image-size@7.2.3:
version "7.2.3"
resolved "https://registry.yarnpkg.com/probe-image-size/-/probe-image-size-7.2.3.tgz#d49c64be540ec8edea538f6f585f65a9b3ab4309"
integrity sha512-HubhG4Rb2UH8YtV4ba0Vp5bQ7L78RTONYu/ujmCu5nBI8wGv24s4E9xSKBi0N1MowRpxk76pFCpJtW0KPzOK0w==