Commit df1d8c30 authored by Benoit Barbot's avatar Benoit Barbot
Browse files

fix direct link

parent 4e92af99
Pipeline #1692 passed with stages
in 31 seconds
......@@ -30,4 +30,5 @@ deploy: web
scp -r website/* barbot@ns.lacl.fr:WWW/wordgen/
server: web
cd website; python -m SimpleHTTPServer 8080
#cd website; python -m SimpleHTTPServer 8080
cd website; ocsigenserver -c simpleserve.conf
<!-- -*- Mode: Xml -*- -->
<!-- This file is intentionnaly very basic. See http://ocsigen.org/ocsigenserver/manual/config
a more elaborate one, as well as for comments on the various options -->
<!-- DO NOT MODIFY. This a generated file.
Additional configurations sit in conf.d/ -->
<ocsigen>
<server>
<port>8080</port>
<logdir>/home/ben/.opam/4.10.0/lib/ocsigenserver/var/log/ocsigenserver</logdir>
<datadir>/home/ben/.opam/4.10.0/lib/ocsigenserver/var/lib/ocsigenserver</datadir>
<user>ben</user>
<group>ben</group>
<!-- <commandpipe>/home/ben/.opam/4.10.0/lib/ocsigenserver/var/run/ocsigenserver_command</commandpipe> -->
<!-- <mimefile>/home/ben/.opam/4.10.0/lib/ocsigenserver/etc/ocsigenserver/mime.types</mimefile> -->
<charset>utf-8</charset>
<findlib path="/home/ben/.opam/4.10.0/lib"/>
<extension findlib-package="ocsigenserver.ext.staticmod"/>
<!--
<findlib path="/home/ben/.opam/4.10.0/lib"/>
<extension findlib-package="ocsigenserver.ext.ocsipersist-sqlite">
<database file="/home/ben/.opam/4.10.0/lib/ocsigenserver/var/lib/ocsigenserver/ocsidb"/>
</extension>
-->
<!--
<findlib path="/home/ben/.opam/4.10.0/lib"/>
<extension findlib-package="ocsigenserver.ext.ocsipersist-pgsql">-->
<!-- the database-tag and its attributes are all optional -->
<!--<database
host="localhost"
port="3000"
user="ben"
password="pw"
database="db"
unix_domain_socket_dir="./udsd"
/>
</extension>
-->
<!-- You may want to use DBM instead of SQLite (if compiled). -->
<!--
<extension findlib-package="ocsigenserver.ext.ocsipersist-dbm">
<store dir="/home/ben/.opam/4.10.0/lib/ocsigenserver/var/lib/ocsigenserver"/>
<ocsidbm name="/home/ben/.opam/4.10.0/lib/ocsigenserver/extensions/ocsidbm"/>
</extension>
-->
<!-- Inclusion of all external configuration files matching *.conf
from the directory 'dir' (in alphabetical order): -->
<!--<extconf dir="/home/ben/.opam/4.10.0/lib/ocsigenserver/etc/ocsigenserver/conf.d" />-->
<host charset="utf-8" hostfilter="*">
<!--<site path="ocsigenstuff" charset="utf-8">
<static dir="/home/ben/.opam/4.10.0/lib/ocsigenserver/var/www/ocsigenstuff" />
</site>-->
<static dir="./" />
</host>
</server>
</ocsigen>
......@@ -82,10 +82,11 @@ endmodule"
open Arguments
let _ = run @@ fun () ->
let args = Js_of_ocaml.Url.Current.arguments in
(match List.assoc_opt "q" args with
None -> ()
| Some q -> file_content := q);
let open Js_of_ocaml.Url in
let args = Current.arguments in
(match List.assoc_opt "q" args with
None -> ()
| Some q -> file_content := urldecode q);
let stdoutput,stdoutput_up = text_area' ~class_:"code col-sm-6" ~is_read_only:true "" in
......@@ -98,6 +99,11 @@ let _ = run @@ fun () ->
let buffstd = Buffer.create 100 in
let buffdata = Buffer.create 100 in
let dirlink,dirlink_up = div' [] in
let dirup x =
file_content:=x;
let open Js_of_ocaml.Url in
let link = Current.path_string in
dirlink_up [a ~href:(link^"?q="^(urlencode x)) [text "Direct link"] ] in
worker##.onmessage := ( Dom.handler (fun m -> (match m##.data with
| Worker_sync.StdOut s ->
Buffer.add_string buffstd s;
......@@ -153,19 +159,17 @@ let _ = run @@ fun () ->
}) in
let txin = text_area ~class_:"input_file col-sm-6" ~on_change:(fun x->
file_content:=x;
let open Js_of_ocaml.Url in
let link = Current.path_string in
dirlink_up [a ~href:(link^"?q="^x) [text "Direct link"] ];
dirup x;
launch_compt false) !file_content in
dirup !file_content;
launch_compt true;
div ~class_:"main container-fluid"[
div ~class_:"jumbotron cmdline" [hi 1 "Wordgen"; p [text "Time word generator. Read more on "; a ~href:"https://git.lacl.fr/barbot/wordgen" [text "the source repository page."] ];
build_interface ~class_:"" ~stop:(fun () -> worker##postMessage (Worker_sync.Stop)) launch_compt spec_short;];
div ~class_:"" [div ~class_:"output" [ txin; container]];
br ();
dirlink;
br ();
alert; sigt;
(div ~class_:"output" [
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment