altcha 3.0.8 → 3.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6074,7 +6074,7 @@ function Widget($$anchor, $$props) {
6074
6074
  }
6075
6075
  });
6076
6076
  onMount(() => {
6077
- log("mounted", "3.0.8");
6077
+ log("mounted", "3.0.9");
6078
6078
  if (instance) {
6079
6079
  globalThis.$altcha.instances.add(instance);
6080
6080
  }
@@ -6173,7 +6173,14 @@ function Widget($$anchor, $$props) {
6173
6173
  return hook;
6174
6174
  }
6175
6175
  if (typeof source2 === "string") {
6176
- if (source2.match(/^(https?:)?\//)) {
6176
+ if (source2.startsWith("{")) {
6177
+ log("parsing JSON challenge");
6178
+ try {
6179
+ challenge = JSON.parse(source2);
6180
+ } catch {
6181
+ throw new Error(`Unable to parse JSON challenge.`);
6182
+ }
6183
+ } else {
6177
6184
  log("fetching challenge from", requestOptions?.method || "GET", source2);
6178
6185
  set(baseUrl, new URL(source2, location.origin), true);
6179
6186
  const resp = await get(config).fetch(source2, {
@@ -6201,13 +6208,6 @@ function Widget($$anchor, $$props) {
6201
6208
  log("HIS result", json.hisResult);
6202
6209
  }
6203
6210
  challenge = json;
6204
- } else {
6205
- log("parsing JSON challenge");
6206
- try {
6207
- challenge = JSON.parse(source2);
6208
- } catch {
6209
- throw new Error(`Unable to parse JSON challenge.`);
6210
- }
6211
6211
  }
6212
6212
  } else if (source2 && typeof source2 === "object") {
6213
6213
  try {