| 988 | path = "/system/invalidate" |
| 989 | |
| 990 | def POST(self): |
| 991 | global local_ip |
| 992 | if local_ip is None: |
| 993 | local_ip = socket.gethostbyname(socket.gethostname()) |
| 994 | |
| 995 | if web.ctx.ip != "127.0.0.1" and web.ctx.ip.rsplit(".", 1)[0] != local_ip.rsplit(".", 1)[0]: |
| 996 | raise Forbidden("Allowed only in the local network.") |
| 997 | |
| 998 | data = json.loads(web.data()) |
| 999 | if not isinstance(data, list): |
| 1000 | data = [data] |
| 1001 | for d in data: |
| 1002 | thing = client.Thing(web.ctx.site, d["key"], client.storify(d)) |
| 1003 | client._run_hooks("on_new_version", thing) |
| 1004 | return delegate.RawText("ok") |
| 1005 | |
| 1006 | |
| 1007 | def save_error(): |