workpeg 0.152.0__tar.gz → 0.153.1__tar.gz
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.
- {workpeg-0.152.0/src/workpeg.egg-info → workpeg-0.153.1}/PKG-INFO +1 -1
- {workpeg-0.152.0 → workpeg-0.153.1}/pyproject.toml +1 -1
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/build.py +62 -2
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/compiler/ast_parser.py +5 -3
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/runtime/workpeg-runtime.js +88 -28
- {workpeg-0.152.0 → workpeg-0.153.1/src/workpeg.egg-info}/PKG-INFO +1 -1
- {workpeg-0.152.0 → workpeg-0.153.1}/LICENSE +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/MANIFEST.in +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/README.md +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/setup.cfg +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/__init__.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/auth.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/build.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/cdn.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/cli.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/config.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/context.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/create_new.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/doctor.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/project.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/run.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/runtime.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/sandbox/__init__.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/sandbox/docker_driver.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/sandbox/driver.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/submit.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/templates/__init__.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/templates/functions/Dockerfile +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/templates/functions/LICENSE +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/templates/functions/README.md +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/templates/functions/app/__init__.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/templates/functions/app/main.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/templates/functions/requirements.txt +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/templates/project/README.md +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/templates/project/function/Dockerfile +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/templates/project/function/app/__init__.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/templates/project/function/app/main.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/templates/project/function/requirements.txt +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/templates/project/ui/main.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/templates/project/workpeg.json +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/terminal.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/__init__.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/actions.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/actions_manifest.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/app.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/calendar.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/compiler/__init__.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/compiler/ir.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/compiler/js_generator.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/create.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/dates.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/dev_refused_names.json +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/devmode.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/devserve.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/devsite.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/fake_cloud.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/minify.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/render_nodes.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/renderers_manifest.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/runtime/ai-concurrent-replies.md +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/runtime/ai-prompt-queue.md +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/runtime/ai-question-frame.md +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/runtime/ai-subagent-frame.md +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/runtime/ai.js +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/runtime/editor.js +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/runtime/fonts/OFL.txt +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/runtime/fonts/geist-italic-cyrillic-ext.af944491.woff2 +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/runtime/fonts/geist-italic-cyrillic.88be6946.woff2 +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/runtime/fonts/geist-italic-latin-ext.370a8962.woff2 +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/runtime/fonts/geist-italic-latin.7611b95c.woff2 +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/runtime/fonts/geist-italic-vietnamese.8dfcf303.woff2 +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/runtime/fonts/geist-normal-cyrillic-ext.b7a545bb.woff2 +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/runtime/fonts/geist-normal-cyrillic.6129fc85.woff2 +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/runtime/fonts/geist-normal-latin-ext.58a6b173.woff2 +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/runtime/fonts/geist-normal-latin.9b6f5ff4.woff2 +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/runtime/fonts/geist-normal-vietnamese.f689f638.woff2 +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/runtime/icons.css.gz +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/runtime/overlay.js +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/runtime/pegment.css +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/runtime/scaffold.js +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/scaffold.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/search_manifest.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/serve.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/skills_manifest.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/state.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/validators.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/watcher.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/widgets/__init__.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/widgets/base.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/widgets/canvas.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/widgets/display.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/widgets/fields.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/widgets/forms.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/widgets/futures.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/widgets/gestures.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/widgets/interactive.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/widgets/layout.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/widgets/pickers.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/utils.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg.egg-info/SOURCES.txt +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg.egg-info/dependency_links.txt +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg.egg-info/entry_points.txt +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg.egg-info/requires.txt +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg.egg-info/top_level.txt +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/tests/test_auth.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/tests/test_build.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/tests/test_cdn.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/tests/test_cdn_publish.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/tests/test_changelog.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/tests/test_changelog_guard.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/tests/test_cli.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/tests/test_config.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/tests/test_context.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/tests/test_create_new.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/tests/test_doctor.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/tests/test_project_create.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/tests/test_release_script.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/tests/test_run.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/tests/test_runtime.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/tests/test_submit.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/tests/test_utils.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/tests/test_version.py +0 -0
- {workpeg-0.152.0 → workpeg-0.153.1}/tests/test_watch_pipeline.py +0 -0
|
@@ -883,8 +883,10 @@ def _check_manifest_size(text: str) -> None:
|
|
|
883
883
|
f"manifest.json is {size} bytes; the platform refuses to read one "
|
|
884
884
|
f"over {MAX_MANIFEST_BYTES}. It does not read part of it — the "
|
|
885
885
|
f"whole file is skipped, so every section in it (search, actions, "
|
|
886
|
-
f"renderers, skills) silently never arrives
|
|
887
|
-
f"
|
|
886
|
+
f"renderers, skills, summary, dev) silently never arrives, and a "
|
|
887
|
+
f"\"dev\": {{\"others\": \"deny\"}} with it lets other "
|
|
888
|
+
f"businesses' dev pages back onto this namespace. Shorten the "
|
|
889
|
+
f"longest section; skill instructions are usually what grows.")
|
|
888
890
|
|
|
889
891
|
|
|
890
892
|
def _peg_manifest(ir, namespace: str, source: Path) -> "dict | None":
|
|
@@ -926,6 +928,10 @@ def _peg_manifest(ir, namespace: str, source: Path) -> "dict | None":
|
|
|
926
928
|
summary = _summary_section(source)
|
|
927
929
|
if summary:
|
|
928
930
|
sections["summary"] = summary
|
|
931
|
+
|
|
932
|
+
dev = _dev_section(source)
|
|
933
|
+
if dev:
|
|
934
|
+
sections["dev"] = dev
|
|
929
935
|
# Future sections slot in here, each read from its own workpeg.json block.
|
|
930
936
|
|
|
931
937
|
if not sections:
|
|
@@ -1006,6 +1012,60 @@ def _summary_section(source: Path) -> "str | None":
|
|
|
1006
1012
|
return text
|
|
1007
1013
|
|
|
1008
1014
|
|
|
1015
|
+
#: Who may run a dev page on this Peg's label, besides its owner: the one
|
|
1016
|
+
#: key the ``dev`` section has, and the only two words it takes.
|
|
1017
|
+
DEV_KEYS = ("others",)
|
|
1018
|
+
DEV_OTHERS = ("allow", "deny")
|
|
1019
|
+
|
|
1020
|
+
|
|
1021
|
+
def _dev_section(source: Path) -> "dict | None":
|
|
1022
|
+
"""The Peg's ``dev`` section: whether other businesses may run a dev
|
|
1023
|
+
page (``https://<namespace>.dev.workpeg.com``) on this Peg's label.
|
|
1024
|
+
|
|
1025
|
+
``{"others": "allow"}`` or ``{"others": "deny"}``. The owner's own
|
|
1026
|
+
business is never refused by it. With no section, others are allowed.
|
|
1027
|
+
|
|
1028
|
+
**Exact words, closed key set, refused at build.** The registry reads
|
|
1029
|
+
this from the uploaded ``manifest.json`` and counts anything it cannot
|
|
1030
|
+
read as ``deny``, so a typo would quietly close the Peg to everyone
|
|
1031
|
+
else. Failing here says so where the author can fix it. Nothing is
|
|
1032
|
+
normalised: ``"Deny"`` and ``" deny"`` are refused, not guessed at.
|
|
1033
|
+
"""
|
|
1034
|
+
from workpeg.ui.search_manifest import ManifestValidationError
|
|
1035
|
+
|
|
1036
|
+
config_path = _find_peg_config(source)
|
|
1037
|
+
if config_path is None:
|
|
1038
|
+
return None
|
|
1039
|
+
try:
|
|
1040
|
+
data = json.loads(config_path.read_text(encoding="utf-8"))
|
|
1041
|
+
except (OSError, ValueError):
|
|
1042
|
+
# Reported by _search_section, which reads the same file.
|
|
1043
|
+
return None
|
|
1044
|
+
if not isinstance(data, dict) or "dev" not in data:
|
|
1045
|
+
return None
|
|
1046
|
+
value = data["dev"]
|
|
1047
|
+
shape = ('"dev" must be {"others": "allow"} or {"others": "deny"}')
|
|
1048
|
+
if not isinstance(value, dict):
|
|
1049
|
+
raise ManifestValidationError(
|
|
1050
|
+
f"{config_path}: {shape}, an object; got "
|
|
1051
|
+
f"{type(value).__name__}.")
|
|
1052
|
+
unknown = sorted(str(k) for k in value if k not in DEV_KEYS)
|
|
1053
|
+
if unknown:
|
|
1054
|
+
raise ManifestValidationError(
|
|
1055
|
+
f"{config_path}: {shape}. Unknown key(s) {unknown}; "
|
|
1056
|
+
f'"others" is the only key.')
|
|
1057
|
+
if "others" not in value:
|
|
1058
|
+
raise ManifestValidationError(
|
|
1059
|
+
f'{config_path}: {shape}. "others" is missing; leave the whole '
|
|
1060
|
+
f'"dev" section out to allow others.')
|
|
1061
|
+
others = value["others"]
|
|
1062
|
+
if not isinstance(others, str) or others not in DEV_OTHERS:
|
|
1063
|
+
raise ManifestValidationError(
|
|
1064
|
+
f'{config_path}: {shape}. "others" is {others!r}; it takes '
|
|
1065
|
+
f'exactly "allow" or "deny", in lower case.')
|
|
1066
|
+
return {"others": others}
|
|
1067
|
+
|
|
1068
|
+
|
|
1009
1069
|
def _actions_section(source: Path) -> "list | None":
|
|
1010
1070
|
"""The Peg's ``actions`` manifest section, from ``workpeg.json``.
|
|
1011
1071
|
|
|
@@ -5,7 +5,7 @@ import copy
|
|
|
5
5
|
import re
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
from typing import Any
|
|
8
|
-
from urllib.parse import urlparse
|
|
8
|
+
from urllib.parse import unquote, urlparse
|
|
9
9
|
|
|
10
10
|
from workpeg.ui import dates as _dates_twin
|
|
11
11
|
from workpeg.ui.compiler.ir import (
|
|
@@ -187,14 +187,16 @@ def _is_workpeg_host(url: str) -> bool:
|
|
|
187
187
|
REGISTRABLE label, the one right before the TLD (workpeg.com, *.workpeg.io,
|
|
188
188
|
…), not merely somewhere in the name (so ``foo.workpeg.evil.com`` is NOT
|
|
189
189
|
Workpeg). Relative URLs have no host and are never Workpeg. Mirrors
|
|
190
|
-
``Workpeg._isWorkpegHost`` in the runtime
|
|
190
|
+
``Workpeg._isWorkpegHost`` in the runtime, including what a browser's URL
|
|
191
|
+
parser does to a host: percent-decode it, and take a trailing dot as the
|
|
192
|
+
same host, which DNS does and a comparison of labels does not."""
|
|
191
193
|
try:
|
|
192
194
|
host = urlparse(url).hostname
|
|
193
195
|
except ValueError:
|
|
194
196
|
return False
|
|
195
197
|
if not host:
|
|
196
198
|
return False
|
|
197
|
-
labels = host.lower().split(".")
|
|
199
|
+
labels = unquote(host).lower().rstrip(".").split(".")
|
|
198
200
|
return len(labels) >= 2 and labels[-2] == "workpeg"
|
|
199
201
|
|
|
200
202
|
|
|
@@ -54,13 +54,27 @@
|
|
|
54
54
|
* subdomain — `workpeg` appearing as a domain label, not the TLD). Relative
|
|
55
55
|
* URLs have no host and are never considered Workpeg.
|
|
56
56
|
*/
|
|
57
|
+
// Ask the parser fetch() itself uses. A pattern over the text was wrong in the
|
|
58
|
+
// one direction that matters: "https:\\\\api.workpeg.com/x", " https://..." and
|
|
59
|
+
// "ht\ntps://..." all read as relative to a pattern and as absolute to fetch, so
|
|
60
|
+
// http.post(..., credentials=True) could reach the platform with the session.
|
|
61
|
+
// Two bases, because "http:api.workpeg.com" is a relative path under one scheme
|
|
62
|
+
// and an absolute URL under the other, and a page may be on either. A trailing
|
|
63
|
+
// dot comes off because "api.workpeg.com." is the same host to DNS and another
|
|
64
|
+
// string to a comparison: labels read from it would not say "workpeg".
|
|
65
|
+
var NO_HOST = "relative.invalid";
|
|
57
66
|
function urlHost(url) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
var bases = ["https://" + NO_HOST + "/", "http://" + NO_HOST + "/"];
|
|
68
|
+
for (var i = 0; i < bases.length; i++) {
|
|
69
|
+
try {
|
|
70
|
+
var host = new URL(String(url), bases[i]).hostname.toLowerCase()
|
|
71
|
+
.replace(/\.+$/, "");
|
|
72
|
+
if (host !== NO_HOST) return host;
|
|
73
|
+
} catch (e) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
63
76
|
}
|
|
77
|
+
return null; // relative
|
|
64
78
|
}
|
|
65
79
|
|
|
66
80
|
Workpeg._isWorkpegHost = function (url) {
|
|
@@ -639,7 +653,7 @@
|
|
|
639
653
|
// "fail" (4xx -> redirect to login) | "error" (5xx / network -> retry, no
|
|
640
654
|
// redirect, so a transient outage doesn't log an authed user out) |
|
|
641
655
|
// "refused" (a dev install's page whose address the API refuses: said on
|
|
642
|
-
// the page, never redirected, see
|
|
656
|
+
// the page, never redirected, see devNoticeOf).
|
|
643
657
|
Workpeg.accountsBase = "https://accounts.workpeg.com";
|
|
644
658
|
Workpeg._auth = "unknown";
|
|
645
659
|
Workpeg._authUser = {};
|
|
@@ -819,9 +833,10 @@
|
|
|
819
833
|
// refused lists ever differed, would bounce the person back here).
|
|
820
834
|
// Every other 4xx, on every host, signs in exactly as before.
|
|
821
835
|
if (r.status === 403 && onDevHost()) {
|
|
822
|
-
return
|
|
823
|
-
if (
|
|
836
|
+
return devProblem(r).then(function (said) {
|
|
837
|
+
if (said[0] !== DEV_REFUSED) { signIn(); return; }
|
|
824
838
|
devRefusedLoad = true;
|
|
839
|
+
devRefusedWhy = said[1];
|
|
825
840
|
Workpeg._auth = "refused";
|
|
826
841
|
Workpeg.render();
|
|
827
842
|
});
|
|
@@ -973,15 +988,50 @@
|
|
|
973
988
|
&& (p === DEV_REFUSED || p === DEV_MISSING || p === DEV_PAUSED);
|
|
974
989
|
}
|
|
975
990
|
|
|
976
|
-
//
|
|
991
|
+
// Why the API refused a dev page's address (dev-origin-refused's
|
|
992
|
+
// "reason"), and the runtime's OWN words for each. The API's reason is
|
|
993
|
+
// only ever compared, by exact string equality, with these four names;
|
|
994
|
+
// what is shown is always the fixed sentence next to it, never anything
|
|
995
|
+
// the answer carried. Any other reason, or none, gets the generic words.
|
|
996
|
+
var DEV_REASONS = [
|
|
997
|
+
["developer", "This business is not a developer yet. A business can " +
|
|
998
|
+
"run dev pages once Workpeg approves its first peg."],
|
|
999
|
+
["closed", "The owner of this peg does not allow dev pages on it."],
|
|
1000
|
+
["label", "This name belongs to the platform and cannot be used for " +
|
|
1001
|
+
"a dev page."],
|
|
1002
|
+
["registry", "Workpeg could not check this dev page right now. Try " +
|
|
1003
|
+
"again in a minute."],
|
|
1004
|
+
];
|
|
1005
|
+
|
|
1006
|
+
// The name in DEV_REASONS that *reason* is exactly; "" for anything else.
|
|
1007
|
+
function devReason(reason) {
|
|
1008
|
+
for (var i = 0; i < DEV_REASONS.length; i++) {
|
|
1009
|
+
if (reason === DEV_REASONS[i][0]) return DEV_REASONS[i][0];
|
|
1010
|
+
}
|
|
1011
|
+
return "";
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
// The fixed sentence for a reason devReason returned; "" for "".
|
|
1015
|
+
function devReasonWords(reason) {
|
|
1016
|
+
for (var i = 0; i < DEV_REASONS.length; i++) {
|
|
1017
|
+
if (reason === DEV_REASONS[i][0]) return DEV_REASONS[i][1];
|
|
1018
|
+
}
|
|
1019
|
+
return "";
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
// An answer's problem: [the slug of its type, its dev-origin-refused
|
|
1023
|
+
// reason as devReason reads it]; ["", ""] for a body that has none or
|
|
977
1024
|
// does not parse.
|
|
978
|
-
function
|
|
1025
|
+
function devProblem(r) {
|
|
979
1026
|
try {
|
|
980
1027
|
return Promise.resolve(r.json()).then(function (data) {
|
|
981
|
-
|
|
982
|
-
|
|
1028
|
+
var slug = Workpeg._problemSlug(data && data.type);
|
|
1029
|
+
var why = slug === DEV_REFUSED && data && typeof data === "object"
|
|
1030
|
+
? devReason(data.reason) : "";
|
|
1031
|
+
return [slug, why];
|
|
1032
|
+
}, function () { return ["", ""]; });
|
|
983
1033
|
} catch (e) {
|
|
984
|
-
return Promise.resolve("");
|
|
1034
|
+
return Promise.resolve(["", ""]);
|
|
985
1035
|
}
|
|
986
1036
|
}
|
|
987
1037
|
|
|
@@ -992,7 +1042,9 @@
|
|
|
992
1042
|
// another. Kept here, not on `Workpeg`, so nothing a page runs can clear
|
|
993
1043
|
// it, and only ever set on a dev host.
|
|
994
1044
|
var devRefusedLoad = false;
|
|
995
|
-
var
|
|
1045
|
+
var devRefusedWhy = ""; // users/me's reason, as devReason reads it
|
|
1046
|
+
// [business id, "" | DEV_REFUSED | DEV_MISSING | DEV_PAUSED, reason]
|
|
1047
|
+
var devAnswers = [];
|
|
996
1048
|
|
|
997
1049
|
function devAnswer(biz) {
|
|
998
1050
|
for (var i = 0; i < devAnswers.length; i++) {
|
|
@@ -1001,24 +1053,27 @@
|
|
|
1001
1053
|
return null;
|
|
1002
1054
|
}
|
|
1003
1055
|
|
|
1004
|
-
|
|
1005
|
-
|
|
1056
|
+
// [kind, reason] of the notice this load shows, or null for none.
|
|
1057
|
+
function devNoticeOf() {
|
|
1058
|
+
if (devRefusedLoad) return [DEV_REFUSED, devRefusedWhy];
|
|
1006
1059
|
var a = devAnswer(Workpeg._businessIdFromPath());
|
|
1007
|
-
return a ? a[1] :
|
|
1060
|
+
return a && a[1] ? [a[1], a[2]] : null;
|
|
1008
1061
|
}
|
|
1009
1062
|
|
|
1010
1063
|
// Is this peg installed for testing in this business? Asked once per
|
|
1011
1064
|
// business in the path, once users/me has said yes, on a dev page only
|
|
1012
1065
|
// (the API's gate decides staff/me like any table route). A 403 typed
|
|
1013
1066
|
// dev-install-missing or dev-install-paused puts its notice in place of
|
|
1014
|
-
// the app
|
|
1015
|
-
//
|
|
1067
|
+
// the app, and so does dev-origin-refused, a 403 or the 503 the API gives
|
|
1068
|
+
// when the registry cannot answer, in the words for its reason. Every
|
|
1069
|
+
// other answer, and no answer, leaves the page as it is: its own calls
|
|
1070
|
+
// meet their own refusals, as they would without this.
|
|
1016
1071
|
function devStaffCheck() {
|
|
1017
1072
|
try {
|
|
1018
1073
|
if (!onDevHost()) return;
|
|
1019
1074
|
var biz = Workpeg._businessIdFromPath();
|
|
1020
1075
|
if (!biz || devAnswer(biz)) return;
|
|
1021
|
-
var asked = [biz, ""];
|
|
1076
|
+
var asked = [biz, "", ""];
|
|
1022
1077
|
devAnswers.push(asked);
|
|
1023
1078
|
var headers = {};
|
|
1024
1079
|
var ns = Workpeg._pegNamespace();
|
|
@@ -1027,10 +1082,14 @@
|
|
|
1027
1082
|
encodeURIComponent(biz) + "/staff/me/",
|
|
1028
1083
|
{ method: "GET", credentials: "include", headers: headers })
|
|
1029
1084
|
.then(function (r) {
|
|
1030
|
-
if (r.status !== 403) return;
|
|
1031
|
-
return
|
|
1032
|
-
|
|
1085
|
+
if (r.status !== 403 && r.status !== 503) return;
|
|
1086
|
+
return devProblem(r).then(function (said) {
|
|
1087
|
+
var slug = said[0];
|
|
1088
|
+
if (r.status === 503 ? slug !== DEV_REFUSED
|
|
1089
|
+
: slug !== DEV_REFUSED && slug !== DEV_MISSING
|
|
1090
|
+
&& slug !== DEV_PAUSED) return;
|
|
1033
1091
|
asked[1] = slug;
|
|
1092
|
+
asked[2] = said[1];
|
|
1034
1093
|
Workpeg.render();
|
|
1035
1094
|
});
|
|
1036
1095
|
})
|
|
@@ -1042,7 +1101,7 @@
|
|
|
1042
1101
|
var DEV_INSTALL_PAGE = "https://developers.workpeg.com/dev-install/";
|
|
1043
1102
|
var DEV_LABEL = /^[a-z][a-z0-9-]{1,61}[a-z0-9]$/;
|
|
1044
1103
|
|
|
1045
|
-
function devNotice(kind) {
|
|
1104
|
+
function devNotice(kind, reason) {
|
|
1046
1105
|
var box = document.createElement("div");
|
|
1047
1106
|
box.style.display = "flex";
|
|
1048
1107
|
box.style.flexDirection = "column";
|
|
@@ -1064,7 +1123,8 @@
|
|
|
1064
1123
|
? "Testing is paused for this peg: the registry did not confirm it " +
|
|
1065
1124
|
"just now. Try again in a minute; a rejected peg stays paused " +
|
|
1066
1125
|
"until it is resubmitted."
|
|
1067
|
-
:
|
|
1126
|
+
: devReasonWords(reason)
|
|
1127
|
+
|| "This address cannot be used for a development page.";
|
|
1068
1128
|
box.appendChild(words);
|
|
1069
1129
|
// The peg's page on the developer dashboard, where an owner or admin
|
|
1070
1130
|
// presses Install for testing. Only a namespace that is a label gets a
|
|
@@ -4395,9 +4455,9 @@
|
|
|
4395
4455
|
// else a loader (checking) or notice (5xx/network); a 4xx has already
|
|
4396
4456
|
// redirected. The check is kicked off once, the first time we hit "unknown".
|
|
4397
4457
|
if (Workpeg._auth === "unknown") Workpeg._runAuthCheck();
|
|
4398
|
-
var
|
|
4399
|
-
if (
|
|
4400
|
-
el = devNotice(
|
|
4458
|
+
var dev = devNoticeOf();
|
|
4459
|
+
if (dev) {
|
|
4460
|
+
el = devNotice(dev[0], dev[1]); // a dev page's refusal, said
|
|
4401
4461
|
} else if (Workpeg._auth === "ok") {
|
|
4402
4462
|
devStaffCheck(); // a dev install's page only
|
|
4403
4463
|
el = Workpeg.renderNode(children[0], owner);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/runtime/fonts/geist-italic-latin.7611b95c.woff2
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{workpeg-0.152.0 → workpeg-0.153.1}/src/workpeg/ui/runtime/fonts/geist-normal-latin.9b6f5ff4.woff2
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|