Removes webclient
This commit is contained in:
parent
f184be8ddc
commit
d644c32676
@ -7,13 +7,10 @@
|
|||||||
tezos-node
|
tezos-node
|
||||||
tezos-protocol-compiler
|
tezos-protocol-compiler
|
||||||
tezos-client
|
tezos-client
|
||||||
tezos-webclient
|
|
||||||
tezos-attacker
|
tezos-attacker
|
||||||
|
|
||||||
src/Makefile.local
|
src/Makefile.local
|
||||||
|
|
||||||
src/webclient_static.ml
|
|
||||||
|
|
||||||
src/node/updater/environment_gen
|
src/node/updater/environment_gen
|
||||||
src/node/updater/proto_environment.mli
|
src/node/updater/proto_environment.mli
|
||||||
src/compiler/embedded_cmis.ml
|
src/compiler/embedded_cmis.ml
|
||||||
@ -25,12 +22,6 @@ src/client/embedded/**/_tzbuild
|
|||||||
src/client/embedded/alpha/concrete_lexer.ml
|
src/client/embedded/alpha/concrete_lexer.ml
|
||||||
src/client/embedded/alpha/concrete_parser.ml
|
src/client/embedded/alpha/concrete_parser.ml
|
||||||
src/client/embedded/alpha/concrete_parser.mli
|
src/client/embedded/alpha/concrete_parser.mli
|
||||||
src/client/embedded/alpha/webclient_proto_static.ml
|
|
||||||
src/client/embedded/alpha/main.byte
|
|
||||||
src/client/embedded/alpha/webclient_static/main.js
|
|
||||||
src/client/embedded/alpha/webclient/browser/main.byte
|
|
||||||
src/client/embedded/alpha/webclient/static/main.js
|
|
||||||
src/client/embedded/alpha/webclient/webclient_proto_static.ml
|
|
||||||
|
|
||||||
test/reports
|
test/reports
|
||||||
test/**/test-*
|
test/**/test-*
|
||||||
|
9
.gitignore
vendored
9
.gitignore
vendored
@ -2,15 +2,12 @@
|
|||||||
/tezos-node
|
/tezos-node
|
||||||
/tezos-protocol-compiler
|
/tezos-protocol-compiler
|
||||||
/tezos-client
|
/tezos-client
|
||||||
/tezos-webclient
|
|
||||||
/tezos-attacker
|
/tezos-attacker
|
||||||
|
|
||||||
/src/.ocamlinit.utils
|
/src/.ocamlinit.utils
|
||||||
/src/.ocamlinit.node
|
/src/.ocamlinit.node
|
||||||
/src/Makefile.local
|
/src/Makefile.local
|
||||||
|
|
||||||
/src/webclient_static.ml
|
|
||||||
|
|
||||||
/src/compiler/environment_gen
|
/src/compiler/environment_gen
|
||||||
/src/node/updater/proto_environment.mli
|
/src/node/updater/proto_environment.mli
|
||||||
/src/compiler/embedded_cmis.ml
|
/src/compiler/embedded_cmis.ml
|
||||||
@ -22,12 +19,6 @@
|
|||||||
/src/client/embedded/alpha/concrete_lexer.ml
|
/src/client/embedded/alpha/concrete_lexer.ml
|
||||||
/src/client/embedded/alpha/concrete_parser.ml
|
/src/client/embedded/alpha/concrete_parser.ml
|
||||||
/src/client/embedded/alpha/concrete_parser.mli
|
/src/client/embedded/alpha/concrete_parser.mli
|
||||||
/src/client/embedded/alpha/webclient_proto_static.ml
|
|
||||||
/src/client/embedded/alpha/main.byte
|
|
||||||
/src/client/embedded/alpha/webclient_static/main.js
|
|
||||||
/src/client/embedded/alpha/webclient/browser/main.byte
|
|
||||||
/src/client/embedded/alpha/webclient/static/main.js
|
|
||||||
/src/client/embedded/alpha/webclient/webclient_proto_static.ml
|
|
||||||
|
|
||||||
/test/reports
|
/test/reports
|
||||||
|
|
||||||
|
55
src/Makefile
55
src/Makefile
@ -6,10 +6,9 @@ include Makefile.files
|
|||||||
TZCOMPILER=../tezos-protocol-compiler
|
TZCOMPILER=../tezos-protocol-compiler
|
||||||
TZNODE=../tezos-node
|
TZNODE=../tezos-node
|
||||||
TZCLIENT=../tezos-client
|
TZCLIENT=../tezos-client
|
||||||
TZWEBCLIENT=../tezos-webclient
|
|
||||||
TZATTACKER=../tezos-attacker
|
TZATTACKER=../tezos-attacker
|
||||||
|
|
||||||
all: ${TZCOMPILER} ${TZNODE} ${TZCLIENT} # ${TZWEBCLIENT} ${TZATTACKER}
|
all: ${TZCOMPILER} ${TZNODE} ${TZCLIENT} # ${TZATTACKER}
|
||||||
|
|
||||||
NODEPS :=
|
NODEPS :=
|
||||||
|
|
||||||
@ -241,47 +240,6 @@ ${TZCLIENT}: minutils.cmxa utils.cmxa compiler.cmxa node.cmxa \
|
|||||||
clean::
|
clean::
|
||||||
-rm -f ${TZCLIENT}
|
-rm -f ${TZCLIENT}
|
||||||
|
|
||||||
############################################################################
|
|
||||||
## Webclient program
|
|
||||||
############################################################################
|
|
||||||
|
|
||||||
WEBCLIENT_OBJS := \
|
|
||||||
${WEBCLIENT_IMPLS:.ml=.cmx} ${WEBCLIENT_IMPLS:.ml=.ml.deps} \
|
|
||||||
${WEBCLIENT_LIB_IMPLS:.ml=.cmx} ${WEBCLIENT_LIB_IMPLS:.ml=.ml.deps} \
|
|
||||||
${WEBCLIENT_LIB_INTFS:.mli=.cmi} ${WEBCLIENT_LIB_INTFS:.mli=.mli.deps} \
|
|
||||||
${TZWEBCLIENT}
|
|
||||||
${WEBCLIENT_OBJS}: PACKAGES=${WEBCLIENT_PACKAGES}
|
|
||||||
${WEBCLIENT_OBJS}: SOURCE_DIRECTORIES=${WEBCLIENT_SOURCE_DIRECTORIES}
|
|
||||||
${WEBCLIENT_OBJS}: OPENED_MODULES=${WEBCLIENT_OPENED_MODULES}
|
|
||||||
|
|
||||||
${WEBCLIENT_LIB_IMPLS:.ml=.cmx} ${WEBCLIENT_LIB_IMPLS:.ml=.ml.deps}: TARGET="(webclient.cmxa)"
|
|
||||||
${WEBCLIENT_LIB_INTFS:.mli=.cmi} ${WEBCLIENT_LIB_INTFS:.mli=.mli.deps}: TARGET="(webclient.cmxa)"
|
|
||||||
|
|
||||||
${EMBEDDED_WEBCLIENT_VERSIONS}: webclient.cmxa
|
|
||||||
${WEBCLIENT_IMPLS:.ml=.cmx}: ${EMBEDDED_CLIENT_VERSIONS} ${EMBEDDED_WEBCLIENT_VERSIONS}
|
|
||||||
|
|
||||||
webclient.cmxa: ${WEBCLIENT_LIB_IMPLS:.ml=.cmx} client.cmxa
|
|
||||||
@echo LINK $(notdir $@)
|
|
||||||
${OCAMLOPT} ${OCAMLFLAGS} -a -o $@ ${WEBCLIENT_LIB_IMPLS:.ml=.cmx}
|
|
||||||
|
|
||||||
${TZWEBCLIENT}: minutils.cmxa utils.cmxa compiler.cmxa node.cmxa \
|
|
||||||
client.cmxa webclient.cmxa \
|
|
||||||
${EMBEDDED_CLIENT_PROTOCOLS} \
|
|
||||||
${EMBEDDED_CLIENT_VERSIONS} \
|
|
||||||
${EMBEDDED_WEBCLIENT_VERSIONS} \
|
|
||||||
${WEBCLIENT_IMPLS:.ml=.cmx}
|
|
||||||
@echo LINK $(notdir $@)
|
|
||||||
@${OCAMLOPT} -linkpkg ${OCAMLFLAGS} -o $@ $^
|
|
||||||
|
|
||||||
clean::
|
|
||||||
-rm -f ${TZCLIENT}
|
|
||||||
|
|
||||||
webclient_static.ml: $(shell find webclient_static/)
|
|
||||||
ocp-ocamlres webclient_static -o $@
|
|
||||||
|
|
||||||
partial-clean::
|
|
||||||
-rm -f webclient_static.ml
|
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
## Generic rules
|
## Generic rules
|
||||||
############################################################################
|
############################################################################
|
||||||
@ -325,9 +283,7 @@ DEPENDS := $(filter-out $(NO_DEPS), \
|
|||||||
$(NODE_INTFS) $(NODE_IMPLS) \
|
$(NODE_INTFS) $(NODE_IMPLS) \
|
||||||
$(CLIENT_LIB_INTFS) $(CLIENT_LIB_IMPLS) \
|
$(CLIENT_LIB_INTFS) $(CLIENT_LIB_IMPLS) \
|
||||||
$(CLIENT_INTFS) $(CLIENT_IMPLS) \
|
$(CLIENT_INTFS) $(CLIENT_IMPLS) \
|
||||||
$(WEBCLIENT_LIB_INTFS) $(WEBCLIENT_LIB_IMPLS) \
|
|
||||||
$(ATTACKER_LIB_INTFS) $(ATTACKER_LIB_IMPLS) \
|
$(ATTACKER_LIB_INTFS) $(ATTACKER_LIB_IMPLS) \
|
||||||
$(WEBCLIENT_INTFS) $(WEBCLIENT_IMPLS) \
|
|
||||||
$(ATTACKER_INTFS) $(ATTACKER_IMPLS) \
|
$(ATTACKER_INTFS) $(ATTACKER_IMPLS) \
|
||||||
)
|
)
|
||||||
DEPENDS_BYTECODE := \
|
DEPENDS_BYTECODE := \
|
||||||
@ -401,16 +357,9 @@ partial-clean::
|
|||||||
client/embedded/client_%.cmx: \
|
client/embedded/client_%.cmx: \
|
||||||
$(patsubst %.ml, %.cmx, $(NODE_LIB_IMPLS) $(CLIENT_LIB_IMPLS)) \
|
$(patsubst %.ml, %.cmx, $(NODE_LIB_IMPLS) $(CLIENT_LIB_IMPLS)) \
|
||||||
proto/client_embedded_proto_%.cmxa \
|
proto/client_embedded_proto_%.cmxa \
|
||||||
$$(shell find client/embedded/% \( -name webclient -or -name _tzbuild \) -prune -or \( -name \*.ml -print -or -name \*.mli -print \))
|
$$(shell find client/embedded/% \( -name _tzbuild \) -prune -or \( -name \*.ml -print -or -name \*.mli -print \))
|
||||||
@$(MAKE) -C client/embedded/$* ../client_$*.cmx
|
@$(MAKE) -C client/embedded/$* ../client_$*.cmx
|
||||||
|
|
||||||
client/embedded/webclient_%.cmx: \
|
|
||||||
client/embedded/client_%.cmx \
|
|
||||||
minutils.cma \
|
|
||||||
$$(shell find client/embedded/%/webclient -name \*.ml -or -name \*.mli 2>/dev/null) \
|
|
||||||
$$(shell find client/embedded/%/webclient/static/ 2>/dev/null)
|
|
||||||
@$(MAKE) -C client/embedded/$* ../webclient_$*.cmx
|
|
||||||
|
|
||||||
partial-clean::
|
partial-clean::
|
||||||
-for d in $$(ls -d client/embedded/*/) ; do make clean -C $$d ; done
|
-for d in $$(ls -d client/embedded/*/) ; do make clean -C $$d ; done
|
||||||
-rm -f client/embedded/*.cm* client/embedded/*.o
|
-rm -f client/embedded/*.cm* client/embedded/*.o
|
||||||
|
@ -376,29 +376,3 @@ CLIENT_VERSIONS := \
|
|||||||
EMBEDDED_CLIENT_VERSIONS := \
|
EMBEDDED_CLIENT_VERSIONS := \
|
||||||
$(patsubst %,${SRCDIR}/client/embedded/client_%.cmx, \
|
$(patsubst %,${SRCDIR}/client/embedded/client_%.cmx, \
|
||||||
${CLIENT_VERSIONS})
|
${CLIENT_VERSIONS})
|
||||||
|
|
||||||
############################################################################
|
|
||||||
## Web-Client program
|
|
||||||
############################################################################
|
|
||||||
|
|
||||||
# we do not include 'node/main'
|
|
||||||
WEBCLIENT_SOURCE_DIRECTORIES := \
|
|
||||||
${NODE_LIB_SOURCE_DIRECTORIES} \
|
|
||||||
${SRCDIR}/client ${SRCDIR}/client/embedded
|
|
||||||
|
|
||||||
WEBCLIENT_OPENED_MODULES := Error_monad Hash Utils Tezos_data
|
|
||||||
|
|
||||||
WEBCLIENT_LIB_INTFS := \
|
|
||||||
|
|
||||||
WEBCLIENT_LIB_IMPLS := \
|
|
||||||
client/webclient_version.ml \
|
|
||||||
|
|
||||||
WEBCLIENT_IMPLS := \
|
|
||||||
webclient_static.ml \
|
|
||||||
webclient_main.ml
|
|
||||||
|
|
||||||
EMBEDDED_WEBCLIENT_VERSIONS := \
|
|
||||||
$(patsubst ${SRCDIR}/client/embedded/%/, \
|
|
||||||
${SRCDIR}/client/embedded/webclient_%.cmx, \
|
|
||||||
$(shell ls -d ${SRCDIR}/client/embedded/*/))
|
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
all: \
|
all: \
|
||||||
../client_$(PROTO_VERSION).cmx \
|
../client_$(PROTO_VERSION).cmx
|
||||||
../webclient_$(PROTO_VERSION).cmx
|
|
||||||
|
|
||||||
-include ../../../Makefile.local
|
-include ../../../Makefile.local
|
||||||
include ../../../Makefile.config
|
include ../../../Makefile.config
|
||||||
@ -42,33 +41,11 @@ ${OBJS} ${OBJS_DEPS} ../client_$(PROTO_VERSION).cmx: \
|
|||||||
${OBJS} ${OBJS_DEPS} ../client_$(PROTO_VERSION).cmx: \
|
${OBJS} ${OBJS_DEPS} ../client_$(PROTO_VERSION).cmx: \
|
||||||
../../../proto/client_embedded_proto_${PROTO_VERSION}.cmxa
|
../../../proto/client_embedded_proto_${PROTO_VERSION}.cmxa
|
||||||
|
|
||||||
WEBOBJS := \
|
|
||||||
${WEBCLIENT_IMPLS:.ml=.cmx} ${WEBCLIENT_INTFS:.mli=.cmi}
|
|
||||||
WEBOBJS_DEPENDS := \
|
|
||||||
${WEBCLIENT_IMPLS:.ml=.ml.deps} ${WEBCLIENT_INTFS:.mli=.mli.deps}
|
|
||||||
|
|
||||||
${WEBOBJS} ${WEBOBJS_DEPS}: TARGET="(webclient_$(PROTO_VERSION).cmx)"
|
|
||||||
${WEBOBJS} ${WEBOBJS_DEPS}: SOURCE_DIRECTORIES += ..
|
|
||||||
${WEBOBJS} ${WEBOBJS_DEPS}: OPENED_MODULES += Client_${PROTO_VERSION}
|
|
||||||
${WEBOBJS}: EXTRA_OCAMLFLAGS = -for-pack Webclient_$(PROTO_VERSION)
|
|
||||||
../client_$(PROTO_VERSION).cmx: EXTRA_OCAMLFLAGS =
|
|
||||||
${WEBOBJS} ${WEBOBJS_DEPS} ../webclient_$(PROTO_VERSION).cmx: \
|
|
||||||
PACKAGES=lwt ocplib-json-typed sodium ocplib-ocamlres
|
|
||||||
${WEBOBJS} ${WEBOBJS_DEPS} ../webclient_$(PROTO_VERSION).cmx: \
|
|
||||||
../../../proto/client_embedded_proto_${PROTO_VERSION}.cmxa
|
|
||||||
${WEBOBJS} ../webclient_$(PROTO_VERSION).cmx: \
|
|
||||||
../client_${PROTO_VERSION}.cmx
|
|
||||||
|
|
||||||
../client_$(PROTO_VERSION).cmx: $(patsubst %.ml, %.cmx, ${CLIENT_IMPLS})
|
../client_$(PROTO_VERSION).cmx: $(patsubst %.ml, %.cmx, ${CLIENT_IMPLS})
|
||||||
@echo LINK $(notdir $@)
|
@echo LINK $(notdir $@)
|
||||||
@$(OCAMLOPT) -linkall ${OCAMLFLAGS} -pack -o $@ \
|
@$(OCAMLOPT) -linkall ${OCAMLFLAGS} -pack -o $@ \
|
||||||
$(patsubst %.ml, %.cmx, ${CLIENT_IMPLS})
|
$(patsubst %.ml, %.cmx, ${CLIENT_IMPLS})
|
||||||
|
|
||||||
../webclient_$(PROTO_VERSION).cmx: $(patsubst %.ml, %.cmx, ${WEBCLIENT_IMPLS})
|
|
||||||
@echo LINK $(notdir $@)
|
|
||||||
@$(OCAMLOPT) -linkall ${OCAMLFLAGS} -pack -o $@ \
|
|
||||||
$(patsubst %.ml, %.cmx, ${WEBCLIENT_IMPLS})
|
|
||||||
|
|
||||||
%.cmx: %.ml
|
%.cmx: %.ml
|
||||||
@echo OCAMLOPT ${TARGET} $(notdir $@)
|
@echo OCAMLOPT ${TARGET} $(notdir $@)
|
||||||
@$(OCAMLOPT) ${OCAMLFLAGS} -c $<
|
@$(OCAMLOPT) ${OCAMLFLAGS} -c $<
|
||||||
@ -92,7 +69,6 @@ ${WEBOBJS} ../webclient_$(PROTO_VERSION).cmx: \
|
|||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean::
|
clean::
|
||||||
-rm -f ../client_$(PROTO_VERSION).cm* ../client_$(PROTO_VERSION).o
|
-rm -f ../client_$(PROTO_VERSION).cm* ../client_$(PROTO_VERSION).o
|
||||||
-rm -f ../webclient_$(PROTO_VERSION).cm* ../webclient_$(PROTO_VERSION).o
|
|
||||||
-rm -f *.cm* *~ *.o *.a *.deps *.deps.byte
|
-rm -f *.cm* *~ *.o *.a *.deps *.deps.byte
|
||||||
-rm -rf _tzbuild
|
-rm -rf _tzbuild
|
||||||
-rm -f .depend
|
-rm -f .depend
|
||||||
@ -104,8 +80,7 @@ endif
|
|||||||
predepend:
|
predepend:
|
||||||
|
|
||||||
DEPENDS += \
|
DEPENDS += \
|
||||||
$(patsubst %,%.deps,${CLIENT_INTFS} ${CLIENT_IMPLS}) \
|
$(patsubst %,%.deps,${CLIENT_INTFS} ${CLIENT_IMPLS})
|
||||||
$(patsubst %,%.deps,${WEBCLIENT_INTFS} ${WEBCLIENT_IMPLS})
|
|
||||||
DEPENDS := $(filter-out ${NODEPENDS}, ${DEPENDS})
|
DEPENDS := $(filter-out ${NODEPENDS}, ${DEPENDS})
|
||||||
|
|
||||||
.SECONDARY: ${DEPENDS}
|
.SECONDARY: ${DEPENDS}
|
||||||
|
@ -22,78 +22,16 @@ CLIENT_IMPLS := \
|
|||||||
client_proto_nonces.ml \
|
client_proto_nonces.ml \
|
||||||
client_proto_main.ml
|
client_proto_main.ml
|
||||||
|
|
||||||
WEBCLIENT_INTFS := \
|
|
||||||
webclient/shared/webclient_proto_services.mli
|
|
||||||
|
|
||||||
WEBCLIENT_IMPLS := \
|
|
||||||
webclient/webclient_proto_static.ml \
|
|
||||||
webclient/shared/webclient_proto_services.ml \
|
|
||||||
webclient/webclient_proto_service_directory.ml \
|
|
||||||
webclient/webclient_proto_main.ml
|
|
||||||
|
|
||||||
SOURCE_DIRECTORIES := webclient/shared webclient/browser webclient
|
|
||||||
|
|
||||||
-include baker/Makefile
|
-include baker/Makefile
|
||||||
|
|
||||||
JS_IMPLS := \
|
|
||||||
webclient/shared/webclient_proto_services.ml \
|
|
||||||
webclient/browser/webclient_main.ml
|
|
||||||
|
|
||||||
JS_INTFS := \
|
|
||||||
webclient/shared/webclient_proto_services.mli
|
|
||||||
|
|
||||||
JS_DEPS := $(patsubst %,%.deps.byte,${JS_IMPLS} ${JS_INTFS})
|
|
||||||
|
|
||||||
DEPENDS += ${JS_DEPS}
|
|
||||||
|
|
||||||
# the generated .ml depends on the result of the bytecode compilation
|
|
||||||
NODEPENDS := webclient/webclient_proto_static.ml.deps
|
|
||||||
|
|
||||||
include ../Makefile.shared
|
include ../Makefile.shared
|
||||||
|
|
||||||
${WEBOBJS}: OPENED_MODULES += Environment Tezos_context
|
|
||||||
${OBJS}: OPENED_MODULES += Environment Tezos_context
|
${OBJS}: OPENED_MODULES += Environment Tezos_context
|
||||||
|
|
||||||
predepend: concrete_parser.ml concrete_lexer.ml
|
predepend: concrete_parser.ml concrete_lexer.ml
|
||||||
|
|
||||||
webclient/webclient_proto_static.ml: $(shell find webclient/static/*) webclient/static/main.js
|
|
||||||
ocp-ocamlres webclient/static -o $@
|
|
||||||
|
|
||||||
webclient/webclient_proto_main.cmx: webclient/webclient_proto_static.cmx
|
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean::
|
clean::
|
||||||
-rm -f webclient/webclient_proto_static.ml
|
|
||||||
-rm -f webclient/*/*.cm* webclient/*/*~ webclient/*/*.o webclient/*/*.a
|
|
||||||
-rm -f webclient/*/*.deps webclient/*/*.deps.byte
|
|
||||||
-rm -f baker/*.cm* baker/*~ baker/*.o baker/*.a
|
-rm -f baker/*.cm* baker/*~ baker/*.o baker/*.a
|
||||||
-rm -f baker/*.deps baker/*.deps.byte
|
-rm -f baker/*.deps baker/*.deps.byte
|
||||||
-rm -f concrete_lexer.ml concrete_parser.ml concrete_parser.mli
|
-rm -f concrete_lexer.ml concrete_parser.ml concrete_parser.mli
|
||||||
-rm -f webclient/static/main.js
|
|
||||||
|
|
||||||
.INTERMEDIATE: webclient/browser/main.byte
|
|
||||||
|
|
||||||
JS_PACKAGES := \
|
|
||||||
lwt \
|
|
||||||
cstruct \
|
|
||||||
ocplib-json-typed.browser \
|
|
||||||
ocplib-json-typed.bson \
|
|
||||||
ocplib-resto.directory \
|
|
||||||
js_of_ocaml.tyxml \
|
|
||||||
js_of_ocaml.ppx
|
|
||||||
${JS_DEPS} ${JS_IMPLS:.ml=.cmo} ${JS_INTFS:.mli=.cmi} webclient/browser/main.byte: \
|
|
||||||
PACKAGES=${JS_PACKAGES}
|
|
||||||
${JS_DEPS} ${JS_IMPLS:.ml=.cmo} ${JS_INTFS:.mli=.cmi} webclient/browser/main.byte: \
|
|
||||||
OPENED_MODULES=
|
|
||||||
${JS_DEPS} ${JS_IMPLS:.ml=.cmo} ${JS_INTFS:.mli=.cmi} webclient/browser/main.byte: \
|
|
||||||
SOURCE_DIRECTORIES=../../../minutils webclient/shared webclient/browser
|
|
||||||
|
|
||||||
webclient/static/main.js: webclient/browser/main.byte
|
|
||||||
@echo JS_OF_OCAML $(notdir $@)
|
|
||||||
@js_of_ocaml +weak.js $< -o $@
|
|
||||||
|
|
||||||
webclient/browser/main.byte: \
|
|
||||||
../../../minutils.cma \
|
|
||||||
${JS_IMPLS:.ml=.cmo}
|
|
||||||
@echo LINK $(notdir $@)
|
|
||||||
${OCAMLC} ${OCAMLFLAGS} -o $@ $^ -linkpkg
|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
REC
|
|
||||||
B browser/
|
|
||||||
S browser/
|
|
||||||
B shared/
|
|
||||||
S shared/
|
|
@ -1,9 +0,0 @@
|
|||||||
B ../../../../../minutils
|
|
||||||
S ../../../../../minutils
|
|
||||||
B ../shared
|
|
||||||
S ../shared
|
|
||||||
PKG lwt
|
|
||||||
PKG ocplib-json-typed.bson
|
|
||||||
PKG ocplib-resto.directory \
|
|
||||||
PKG js_of_ocaml.ppx
|
|
||||||
PKG js_of_ocaml.tyxml
|
|
@ -1,54 +0,0 @@
|
|||||||
(**************************************************************************)
|
|
||||||
(* *)
|
|
||||||
(* Copyright (c) 2014 - 2016. *)
|
|
||||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
||||||
(* *)
|
|
||||||
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
||||||
(* *)
|
|
||||||
(**************************************************************************)
|
|
||||||
|
|
||||||
open Lwt.Infix
|
|
||||||
|
|
||||||
module Services = Webclient_proto_services.Make (struct
|
|
||||||
type root = unit
|
|
||||||
end)
|
|
||||||
|
|
||||||
let call_service service params input =
|
|
||||||
let write_json_body json =
|
|
||||||
let jsobj =
|
|
||||||
Json_repr.convert
|
|
||||||
(module Json_repr.Ezjsonm)
|
|
||||||
(module Json_repr_browser.Repr)
|
|
||||||
json in
|
|
||||||
Js._JSON##stringify jsobj in
|
|
||||||
let read_json_body body =
|
|
||||||
Json_repr.convert
|
|
||||||
(module Json_repr_browser.Repr)
|
|
||||||
(module Json_repr.Ezjsonm)
|
|
||||||
(Js._JSON##parse body) in
|
|
||||||
let meth, path, json = RPC.forge_request service params input in
|
|
||||||
let meth_str = RPC.string_of_method meth in
|
|
||||||
let url = String.concat "/" path in
|
|
||||||
let xhr = XmlHttpRequest.create () in
|
|
||||||
let t, u = Lwt.wait () in
|
|
||||||
xhr##.onreadystatechange := Js.wrap_callback (fun _ ->
|
|
||||||
if xhr##.readyState = XmlHttpRequest.DONE then
|
|
||||||
let response = read_json_body xhr##.responseText in
|
|
||||||
Lwt.wakeup u response) ;
|
|
||||||
xhr##_open (Js.string meth_str) (Js.string url) Js._true ;
|
|
||||||
xhr##send (Js.Opt.return (write_json_body json)) ;
|
|
||||||
t >>= fun json ->
|
|
||||||
match RPC.read_answer service json with
|
|
||||||
| Ok res -> Lwt.return res
|
|
||||||
| Error msg -> Lwt.fail_with msg
|
|
||||||
|
|
||||||
let () = Lwt.async @@ fun () ->
|
|
||||||
call_service Services.contracts () () >>= fun names ->
|
|
||||||
call_service Services.hash () () >>= fun hash ->
|
|
||||||
let list = Tyxml_js.Html.(ul (List.map (fun n -> (li [ pcdata n ])) names)) in
|
|
||||||
Tyxml_js.Register.id "receptacle"
|
|
||||||
Tyxml_js.Html.
|
|
||||||
[ h2 [ pcdata "Block: " ; pcdata hash ] ;
|
|
||||||
h2 [ pcdata "Contract aliases:" ] ;
|
|
||||||
list ] ;
|
|
||||||
Lwt.return ()
|
|
@ -1,5 +0,0 @@
|
|||||||
B ../../../../../minutils
|
|
||||||
S ../../../../../minutils
|
|
||||||
PKG lwt
|
|
||||||
PKG ocplib-json-typed.bson
|
|
||||||
PKG ocplib-resto.directory
|
|
@ -1,30 +0,0 @@
|
|||||||
(**************************************************************************)
|
|
||||||
(* *)
|
|
||||||
(* Copyright (c) 2014 - 2016. *)
|
|
||||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
||||||
(* *)
|
|
||||||
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
||||||
(* *)
|
|
||||||
(**************************************************************************)
|
|
||||||
|
|
||||||
module type RPC_CONTEXT = sig
|
|
||||||
type root
|
|
||||||
end
|
|
||||||
|
|
||||||
module Make (RPC_context : RPC_CONTEXT) = struct
|
|
||||||
|
|
||||||
let box_result field enc =
|
|
||||||
let open Data_encoding in
|
|
||||||
obj1 (req field enc)
|
|
||||||
|
|
||||||
let contracts =
|
|
||||||
let input = Data_encoding.empty in
|
|
||||||
let output = box_result "contracts" Data_encoding.(list string) in
|
|
||||||
RPC.service ~input ~output RPC.Path.(root / "contracts")
|
|
||||||
|
|
||||||
let hash =
|
|
||||||
let input = Data_encoding.empty in
|
|
||||||
let output = box_result "hash" Data_encoding.string in
|
|
||||||
RPC.service ~input ~output RPC.Path.(root / "hash")
|
|
||||||
|
|
||||||
end
|
|
@ -1,19 +0,0 @@
|
|||||||
(**************************************************************************)
|
|
||||||
(* *)
|
|
||||||
(* Copyright (c) 2014 - 2016. *)
|
|
||||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
||||||
(* *)
|
|
||||||
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
||||||
(* *)
|
|
||||||
(**************************************************************************)
|
|
||||||
|
|
||||||
module type RPC_CONTEXT = sig
|
|
||||||
type root
|
|
||||||
end
|
|
||||||
|
|
||||||
module Make (RPC_context : RPC_CONTEXT) : sig
|
|
||||||
val contracts :
|
|
||||||
(RPC_context.root, RPC_context.root, unit, string list) RPC.service
|
|
||||||
val hash :
|
|
||||||
(RPC_context.root, RPC_context.root, unit, string) RPC.service
|
|
||||||
end
|
|
@ -1,12 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Tezos Web Client :: Bootstrap Version</title>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<script src="main.js" defer></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Tezos Web client :: Bootstrap Version</h1>
|
|
||||||
<div id="receptacle"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,10 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Tezos Web Client :: Bootstrap Version</title>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Not Found</h1>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,15 +0,0 @@
|
|||||||
(**************************************************************************)
|
|
||||||
(* *)
|
|
||||||
(* Copyright (c) 2014 - 2016. *)
|
|
||||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
||||||
(* *)
|
|
||||||
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
||||||
(* *)
|
|
||||||
(**************************************************************************)
|
|
||||||
|
|
||||||
|
|
||||||
let () =
|
|
||||||
Webclient_version.register_services
|
|
||||||
Client_proto_main.protocol Webclient_proto_service_directory.root ;
|
|
||||||
Webclient_version.register_static_files
|
|
||||||
Client_proto_main.protocol Webclient_proto_static.root
|
|
@ -1,26 +0,0 @@
|
|||||||
(**************************************************************************)
|
|
||||||
(* *)
|
|
||||||
(* Copyright (c) 2014 - 2016. *)
|
|
||||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
||||||
(* *)
|
|
||||||
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
||||||
(* *)
|
|
||||||
(**************************************************************************)
|
|
||||||
|
|
||||||
module Services = Webclient_proto_services.Make (struct
|
|
||||||
type root = Node_rpc_services.Blocks.block
|
|
||||||
end)
|
|
||||||
|
|
||||||
let cctxt = Client_commands.ignore_context
|
|
||||||
|
|
||||||
let root =
|
|
||||||
let root =
|
|
||||||
RPC.register RPC.empty Services.contracts @@ fun _block () ->
|
|
||||||
Client_proto_contracts.RawContractAlias.load cctxt >>= fun list ->
|
|
||||||
let (names, _) = List.split list in
|
|
||||||
RPC.Answer.return names in
|
|
||||||
let root =
|
|
||||||
RPC.register root Services.hash @@ fun block () ->
|
|
||||||
Client_node_rpcs.(call_service1 cctxt Node_rpc_services.Blocks.hash block ()) >>= fun res ->
|
|
||||||
RPC.Answer.return (Hash.Block_hash.to_b58check res) in
|
|
||||||
root
|
|
@ -1,28 +0,0 @@
|
|||||||
(**************************************************************************)
|
|
||||||
(* *)
|
|
||||||
(* Copyright (c) 2014 - 2016. *)
|
|
||||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
||||||
(* *)
|
|
||||||
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
||||||
(* *)
|
|
||||||
(**************************************************************************)
|
|
||||||
|
|
||||||
(* Tezos Web Interface - version dependent services *)
|
|
||||||
|
|
||||||
let contextual_static_files : string OCamlRes.Res.root Protocol_hash.Table.t =
|
|
||||||
Protocol_hash.Table.create 7
|
|
||||||
|
|
||||||
let register_static_files version root =
|
|
||||||
Protocol_hash.Table.add contextual_static_files version root
|
|
||||||
|
|
||||||
let find_contextual_static_files version =
|
|
||||||
Protocol_hash.Table.find contextual_static_files version
|
|
||||||
|
|
||||||
let contextual_services : Node_rpc_services.Blocks.block RPC.directory Protocol_hash.Table.t =
|
|
||||||
Protocol_hash.Table.create 7
|
|
||||||
|
|
||||||
let register_services version root =
|
|
||||||
Protocol_hash.Table.add contextual_services version root
|
|
||||||
|
|
||||||
let find_contextual_services version =
|
|
||||||
Protocol_hash.Table.find contextual_services version
|
|
@ -33,8 +33,6 @@ depends: [
|
|||||||
"ocplib-json-typed"
|
"ocplib-json-typed"
|
||||||
"ocplib-resto" {>= "dev" }
|
"ocplib-resto" {>= "dev" }
|
||||||
"reactiveData"
|
"reactiveData"
|
||||||
"tyxml"
|
|
||||||
"js_of_ocaml"
|
|
||||||
"sodium" {>= "0.3.0" }
|
"sodium" {>= "0.3.0" }
|
||||||
"magic-mime"
|
"magic-mime"
|
||||||
"leveldb" {>= "1.1.2" }
|
"leveldb" {>= "1.1.2" }
|
||||||
|
@ -89,7 +89,6 @@ module Client = struct
|
|||||||
module Revelation = Make(struct let name = "client.revealation" end)
|
module Revelation = Make(struct let name = "client.revealation" end)
|
||||||
module Denunciation = Make(struct let name = "client.denunciation" end)
|
module Denunciation = Make(struct let name = "client.denunciation" end)
|
||||||
end
|
end
|
||||||
module Webclient = Make(struct let name = "webclient" end)
|
|
||||||
|
|
||||||
type template = Lwt_log.template
|
type template = Lwt_log.template
|
||||||
let default_template = "$(date) - $(section): $(message)"
|
let default_template = "$(date) - $(section): $(message)"
|
||||||
|
@ -44,7 +44,6 @@ module Client : sig
|
|||||||
module Revelation : LOG
|
module Revelation : LOG
|
||||||
module Denunciation : LOG
|
module Denunciation : LOG
|
||||||
end
|
end
|
||||||
module Webclient : LOG
|
|
||||||
|
|
||||||
module Make(S: sig val name: string end) : LOG
|
module Make(S: sig val name: string end) : LOG
|
||||||
|
|
||||||
|
@ -1,213 +0,0 @@
|
|||||||
(**************************************************************************)
|
|
||||||
(* *)
|
|
||||||
(* Copyright (c) 2014 - 2016. *)
|
|
||||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
||||||
(* *)
|
|
||||||
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
||||||
(* *)
|
|
||||||
(**************************************************************************)
|
|
||||||
|
|
||||||
(* Tezos Command line interface - Main Program *)
|
|
||||||
|
|
||||||
open Lwt.Infix
|
|
||||||
open Logging.Webclient
|
|
||||||
|
|
||||||
let make_context () =
|
|
||||||
let buffers = Hashtbl.create 50 in
|
|
||||||
Hashtbl.add buffers "stdout" (Buffer.create 1000) ;
|
|
||||||
Hashtbl.add buffers "stderr" (Buffer.create 1000) ;
|
|
||||||
let log channel msg =
|
|
||||||
let buffer =
|
|
||||||
try Hashtbl.find buffers channel with
|
|
||||||
Not_found ->
|
|
||||||
let buffer = Buffer.create 1000 in
|
|
||||||
Hashtbl.add buffers channel buffer ;
|
|
||||||
buffer in
|
|
||||||
Buffer.add_string buffer msg ;
|
|
||||||
Buffer.add_char buffer '\n' ;
|
|
||||||
Lwt.return () in
|
|
||||||
Client_commands.make_context log,
|
|
||||||
(fun () ->
|
|
||||||
Hashtbl.fold
|
|
||||||
(fun channel buffer acc ->
|
|
||||||
(channel, Buffer.contents buffer) :: acc)
|
|
||||||
buffers [])
|
|
||||||
|
|
||||||
let block_protocol cctxt block =
|
|
||||||
Lwt.catch
|
|
||||||
(fun () ->
|
|
||||||
Client_node_rpcs.Blocks.protocol cctxt block)
|
|
||||||
(fun _ ->
|
|
||||||
cctxt.Client_commands.message
|
|
||||||
"\n\
|
|
||||||
The connection to the RPC server failed, \
|
|
||||||
using the default protocol version.\n" >>= fun () ->
|
|
||||||
Lwt.return Client_alpha.Client_proto_main.protocol)
|
|
||||||
|
|
||||||
let eval_command argv =
|
|
||||||
let cctxt, result = make_context () in
|
|
||||||
Lwt.catch
|
|
||||||
(fun () ->
|
|
||||||
Client_config.preparse_args argv cctxt >>= fun config ->
|
|
||||||
let cctxt = { cctxt with config } in
|
|
||||||
block_protocol cctxt Client_commands.(cctxt.config.block)
|
|
||||||
>>= fun version ->
|
|
||||||
let commands =
|
|
||||||
Client_generic_rpcs.commands @
|
|
||||||
Client_keys.commands () @
|
|
||||||
Client_protocols.commands () @
|
|
||||||
Client_helpers.commands () @
|
|
||||||
Client_commands.commands_for_version version in
|
|
||||||
Client_config.parse_args ~version
|
|
||||||
(Cli_entries.usage ~commands)
|
|
||||||
(Cli_entries.inline_dispatch commands)
|
|
||||||
argv cctxt >>= fun (command, config) ->
|
|
||||||
command Client_commands.({ cctxt with config }) >>= fun () ->
|
|
||||||
Lwt.return (Ok (result ())))
|
|
||||||
(fun exn ->
|
|
||||||
let msg = match exn with
|
|
||||||
| Arg.Help help ->
|
|
||||||
Format.asprintf "%s%!" help
|
|
||||||
| Arg.Bad help ->
|
|
||||||
Format.asprintf "%s%!" help
|
|
||||||
| Cli_entries.Command_not_found ->
|
|
||||||
Format.asprintf "Unknown command, try `-help`.\n%!"
|
|
||||||
| Client_commands.Version_not_found ->
|
|
||||||
Format.asprintf "Unknown protocol version, try `list versions`.\n%!"
|
|
||||||
| Cli_entries.Bad_argument (idx, _n, v) ->
|
|
||||||
Format.asprintf "There's a problem with argument %d, %s.\n%!" idx v
|
|
||||||
| Cli_entries.Command_failed message ->
|
|
||||||
Format.asprintf "Command failed, %s.\n%!" message
|
|
||||||
| Failure msg ->
|
|
||||||
Format.asprintf "Fatal error: %s\n%!" msg
|
|
||||||
| exn ->
|
|
||||||
Format.asprintf "Fatal internal error: %s\n%!" (Printexc.to_string exn) in
|
|
||||||
let result =
|
|
||||||
result () in
|
|
||||||
let stderr =
|
|
||||||
List.assoc "stderr" result in
|
|
||||||
let stderr =
|
|
||||||
if stderr = ""
|
|
||||||
|| String.get stderr (String.length stderr - 1) = '\n' then
|
|
||||||
msg
|
|
||||||
else
|
|
||||||
stderr ^ "\n" ^ msg in
|
|
||||||
let result =
|
|
||||||
("stderr", stderr)::
|
|
||||||
List.filter (fun (n, _) -> n <> "stderr") result in
|
|
||||||
Lwt.return (Error result))
|
|
||||||
|
|
||||||
module ConnectionMap = Map.Make(Cohttp.Connection)
|
|
||||||
|
|
||||||
exception Invalid_method
|
|
||||||
exception Cannot_parse_body of string
|
|
||||||
|
|
||||||
let root =
|
|
||||||
let input, output =
|
|
||||||
let open Data_encoding in
|
|
||||||
(obj1 (req "command" string)),
|
|
||||||
(obj1 (req "outputs" (assoc string))) in
|
|
||||||
let root =
|
|
||||||
RPC.empty in
|
|
||||||
let root =
|
|
||||||
RPC.register0 root
|
|
||||||
(RPC.service ~input ~output RPC.Path.(root / "command"))
|
|
||||||
(fun command ->
|
|
||||||
let argv = Array.of_list (Utils.split ' ' command) in
|
|
||||||
eval_command argv >>= function
|
|
||||||
| Ok output | Error output ->
|
|
||||||
RPC.Answer.return output) in
|
|
||||||
let root =
|
|
||||||
RPC.register_dynamic_directory1 root
|
|
||||||
RPC.Path.(root / "block" /: Node_rpc_services.Blocks.blocks_arg)
|
|
||||||
(fun block ->
|
|
||||||
Client_node_rpcs.Blocks.protocol Client_commands.ignore_context block >>= fun version ->
|
|
||||||
let directory = Webclient_version.find_contextual_services version in
|
|
||||||
let directory = RPC.map (fun ((), block) -> block) directory in
|
|
||||||
Lwt.return directory) in
|
|
||||||
root
|
|
||||||
|
|
||||||
let find_static_file path_str =
|
|
||||||
let path = OCamlRes.Path.of_string path_str in
|
|
||||||
let index path = match path with
|
|
||||||
| [], None -> "text/html", ([], Some ("index", Some "html"))
|
|
||||||
| oth -> Magic_mime.lookup path_str, oth in
|
|
||||||
match path with
|
|
||||||
| ("block" :: block :: path, file) ->
|
|
||||||
let content_type, path = index (path, file) in
|
|
||||||
(match Node_rpc_services.Blocks.parse_block block with
|
|
||||||
| Ok block ->
|
|
||||||
block_protocol Client_commands.ignore_context block >>= fun version ->
|
|
||||||
Lwt.return
|
|
||||||
(try
|
|
||||||
let root =
|
|
||||||
Webclient_version.find_contextual_static_files version in
|
|
||||||
Some (content_type, OCamlRes.Res.find path root)
|
|
||||||
with Not_found -> None)
|
|
||||||
| Error _ -> Lwt.return None)
|
|
||||||
| _ ->
|
|
||||||
Lwt.return
|
|
||||||
(try
|
|
||||||
let content_type, path = index path in
|
|
||||||
Some (content_type, OCamlRes.Res.find path Webclient_static.root)
|
|
||||||
with Not_found -> None)
|
|
||||||
|
|
||||||
let http_proxy mode =
|
|
||||||
let pre_hook path =
|
|
||||||
find_static_file path >>= function
|
|
||||||
| Some (content_type, body) ->
|
|
||||||
Lwt.return
|
|
||||||
(Some content_type,
|
|
||||||
{ RPC.Answer.code = 200 ; body = RPC.Answer.Single body })
|
|
||||||
| None ->
|
|
||||||
Lwt.return
|
|
||||||
(None, { RPC.Answer.code = 404 ; body = RPC.Answer.Empty }) in
|
|
||||||
let post_hook _ =
|
|
||||||
(find_static_file "not_found.html" >>= function
|
|
||||||
| Some (content_type, body) ->
|
|
||||||
Lwt.return (Some content_type, RPC.Answer.Single body)
|
|
||||||
| None ->
|
|
||||||
Lwt.return (None, RPC.Answer.Empty)) >>= fun (content_type, body) ->
|
|
||||||
Lwt.return (content_type, { RPC.Answer.code = 404 ; body }) in
|
|
||||||
RPC_server.launch ~pre_hook ~post_hook mode root [] []
|
|
||||||
|
|
||||||
let webclient_args cfg =
|
|
||||||
let open Client_commands in
|
|
||||||
[
|
|
||||||
"-web-port", Arg.Int (fun x -> cfg := { !cfg with web_port = x }),
|
|
||||||
"The TCP port to point the web browser to.\n\
|
|
||||||
default: " ^ string_of_int Client_commands.(default_cfg.web_port);
|
|
||||||
]
|
|
||||||
|
|
||||||
(* Where all the user friendliness starts *)
|
|
||||||
let () =
|
|
||||||
Pervasives.exit @@ Lwt_main.run
|
|
||||||
(Lwt.catch
|
|
||||||
(fun () ->
|
|
||||||
Client_config.parse_args
|
|
||||||
~extra:webclient_args
|
|
||||||
(Cli_entries.usage ~commands: [])
|
|
||||||
(fun () -> function
|
|
||||||
| `Arg arg -> raise (Arg.Bad ("unexpected argument " ^ arg))
|
|
||||||
| `End -> `Res (fun () -> Lwt.return ()))
|
|
||||||
Sys.argv Client_commands.ignore_context
|
|
||||||
>>= fun (_no_command, config) ->
|
|
||||||
Random.self_init () ;
|
|
||||||
Sodium.Random.stir () ;
|
|
||||||
(* TODO: add TLS? *)
|
|
||||||
http_proxy (`TCP (`Port Client_commands.(config.web_port)))
|
|
||||||
>>= fun _server ->
|
|
||||||
fst (Lwt.wait ()))
|
|
||||||
(function
|
|
||||||
| Arg.Help help ->
|
|
||||||
Format.eprintf "%s%!" help ;
|
|
||||||
Lwt.return 0
|
|
||||||
| Arg.Bad help ->
|
|
||||||
Format.eprintf "%s%!" help ;
|
|
||||||
Lwt.return 1
|
|
||||||
| Failure msg ->
|
|
||||||
Format.eprintf "Fatal error: %s\n%!" msg ;
|
|
||||||
Lwt.return 1
|
|
||||||
| exn ->
|
|
||||||
Format.eprintf "Fatal internal error: %s\n%!" (Printexc.to_string exn) ;
|
|
||||||
Lwt.return 1))
|
|
@ -1,38 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Tezos Web Client</title>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<script src="//code.jquery.com/jquery-2.1.0.min.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Tezos Web client</h1>
|
|
||||||
<pre id="console"></pre>
|
|
||||||
<br/>
|
|
||||||
<form id="form">
|
|
||||||
./tezos-client <input type="text" name="command" id="command">
|
|
||||||
<input type="submit" value="RUN">
|
|
||||||
</form>
|
|
||||||
<script>
|
|
||||||
$('#form').on('submit', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
$.ajax ({
|
|
||||||
url: '/command',
|
|
||||||
method: 'POST',
|
|
||||||
contentType: 'application/json',
|
|
||||||
dataType: 'json',
|
|
||||||
data: JSON.stringify({ command : './tezos-client ' + $('#command')[0].value }),
|
|
||||||
processData: false
|
|
||||||
}).done (function ({ outputs }) {
|
|
||||||
let stdout = document.createElement ("span");
|
|
||||||
stdout.appendChild (document.createTextNode (outputs.stdout));
|
|
||||||
let stderr = document.createElement ("span");
|
|
||||||
stderr.appendChild (document.createTextNode (outputs.stderr));
|
|
||||||
stderr.style.color = "darkred";
|
|
||||||
$('#console')[0].appendChild (stdout);
|
|
||||||
$('#console')[0].appendChild (stderr);
|
|
||||||
})
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,10 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Tezos Web Client</title>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Not Found</h1>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Loading…
Reference in New Issue
Block a user