Commit 5e2c5e62529d26869f1c8bdd0b5887a586acf4a1
1 parent
4b703498
Exists in
master
and in
1 other branch
add package.json to install javascript libraries with npm
Showing
19 changed files
with
219 additions
and
195 deletions
Show diff stats
.gitignore
@@ -6,4 +6,7 @@ static/lib | @@ -6,4 +6,7 @@ static/lib | ||
6 | 6 | ||
7 | # Python egg metadata, regenerated from source files by setuptools. | 7 | # Python egg metadata, regenerated from source files by setuptools. |
8 | /*.egg-info | 8 | /*.egg-info |
9 | -/*.egg | ||
10 | \ No newline at end of file | 9 | \ No newline at end of file |
10 | +/*.eggnode_modules | ||
11 | + | ||
12 | +# ignore javascript libraries installed with npm | ||
13 | +node_modules/ | ||
11 | \ No newline at end of file | 14 | \ No newline at end of file |
README.md
@@ -8,17 +8,17 @@ | @@ -8,17 +8,17 @@ | ||
8 | 8 | ||
9 | ## 1. Requirements | 9 | ## 1. Requirements |
10 | 10 | ||
11 | -The webserver is a python application that requires `python3.6` and `pip` to be | ||
12 | -installed. | ||
13 | -It's also recommended to install `npm` (Node package management) to install the | 11 | +The webserver is a python application that requires `>=python3.6` and `pip` to be |
12 | +installed. `npm` (Node package management) is also necessary to install the | ||
14 | javascript libraries. | 13 | javascript libraries. |
15 | 14 | ||
16 | ```bash | 15 | ```bash |
17 | sudo apt install python3 python3-pip npm # debian, ubuntu, mint, ... | 16 | sudo apt install python3 python3-pip npm # debian, ubuntu, mint, ... |
18 | sudo pkg install python36 py36-sqlite3 py36-pip py36-setuptools npm # FreeBSD | 17 | sudo pkg install python36 py36-sqlite3 py36-pip py36-setuptools npm # FreeBSD |
18 | +sudo port install python37 py37-pip py37-setuptools npm6 # MacOS | ||
19 | ``` | 19 | ``` |
20 | 20 | ||
21 | -The file `~/.config/pip/pip.conf` should be configured to the following: | 21 | +The file `pip.conf` should be configured to the following: |
22 | 22 | ||
23 | ```ini | 23 | ```ini |
24 | [global] | 24 | [global] |
@@ -28,21 +28,25 @@ user=yes | @@ -28,21 +28,25 @@ user=yes | ||
28 | format=columns | 28 | format=columns |
29 | ``` | 29 | ``` |
30 | 30 | ||
31 | -Note: In MacOS this file is in `~/Library/Application Support/pip/pip.conf`. | 31 | +The file is in `~/.config/pip/` in Linux/FreeBSD and `~/Library/Application Support/pip/pip.conf` in MacOS. |
32 | + | ||
32 | 33 | ||
33 | --- | 34 | --- |
34 | 35 | ||
35 | ## 2. Installation | 36 | ## 2. Installation |
36 | 37 | ||
37 | -Download and install: | 38 | +Download and install (`USERNAME` is your account on bitbucket): |
38 | 39 | ||
39 | ```bash | 40 | ```bash |
40 | git clone https://USERNAME@bitbucket.org/USERNAME/perguntations.git | 41 | git clone https://USERNAME@bitbucket.org/USERNAME/perguntations.git |
41 | -pip3 install --user perguntations | 42 | +cd perguntations |
43 | +npm install | ||
44 | +pip3 install . | ||
42 | ``` | 45 | ``` |
43 | 46 | ||
44 | -where `USERNAME` is your account on bitbucket. | ||
45 | -This will also install any dependencies required to run the software. | 47 | +The command `npm` installs the javascript libraries and `pip3` installs the |
48 | +python webserver. | ||
49 | +This will also automatically install the python dependencies required. | ||
46 | 50 | ||
47 | --- | 51 | --- |
48 | 52 | ||
@@ -53,12 +57,11 @@ To generate certificates, there are two possibilities: public server with | @@ -53,12 +57,11 @@ To generate certificates, there are two possibilities: public server with | ||
53 | static IP address or a private server on a local network. | 57 | static IP address or a private server on a local network. |
54 | 58 | ||
55 | Certificates must be saved in the `$XDG_DATA_HOME` path if defined in the | 59 | Certificates must be saved in the `$XDG_DATA_HOME` path if defined in the |
56 | -environment, otherwise in `~/.local/share/certs`. | ||
57 | - | ||
58 | -Create the directory if needed: | 60 | +environment, otherwise in `~/.local/share/certs` (I will assume the latter |
61 | +case). | ||
59 | 62 | ||
60 | ```bash | 63 | ```bash |
61 | -[ ! -z "$XDG_DATA_HOME" ] || mkdir -p ~/.local/share/certs | 64 | +mkdir -p ~/.local/share/certs |
62 | ``` | 65 | ``` |
63 | 66 | ||
64 | ### Selfsigned certificates | 67 | ### Selfsigned certificates |
@@ -67,7 +70,7 @@ Self-signed certificates are not certified by a recognised authority and | @@ -67,7 +70,7 @@ Self-signed certificates are not certified by a recognised authority and | ||
67 | browsers will complain that the certificate is not trusted. | 70 | browsers will complain that the certificate is not trusted. |
68 | 71 | ||
69 | ```bash | 72 | ```bash |
70 | -cd WHERE/TO/PUT/CERTS | 73 | +cd ~/.local/share/certs |
71 | openssl req -x509 -newkey rsa:4096 -keyout privkey.pem -out cert.pem -days 365 -nodes | 74 | openssl req -x509 -newkey rsa:4096 -keyout privkey.pem -out cert.pem -days 365 -nodes |
72 | ``` | 75 | ``` |
73 | 76 | ||
@@ -77,14 +80,14 @@ Generating certificates for a public server (FreeBSD) requires a registered | @@ -77,14 +80,14 @@ Generating certificates for a public server (FreeBSD) requires a registered | ||
77 | domain with fixed IP. | 80 | domain with fixed IP. |
78 | 81 | ||
79 | ```sh | 82 | ```sh |
80 | -sudo pkg install py27-certbot # FreeBSD | 83 | +sudo pkg install py27-certbot # FreeBSD |
81 | sudo service pf stop # disable pf firewall (FreeBSD) | 84 | sudo service pf stop # disable pf firewall (FreeBSD) |
82 | sudo certbot certonly --standalone -d www.example.com | 85 | sudo certbot certonly --standalone -d www.example.com |
83 | sudo service pf start # enable pf firewall | 86 | sudo service pf start # enable pf firewall |
84 | ``` | 87 | ``` |
85 | 88 | ||
86 | Certificates are saved in `/usr/local/etc/letsencrypt/live/www.example.com/`. | 89 | Certificates are saved in `/usr/local/etc/letsencrypt/live/www.example.com/`. |
87 | -Copy them to the appropriate `certs` directory and change permissions: | 90 | +Copy them to the `certs` directory and change permissions: |
88 | 91 | ||
89 | ```sh | 92 | ```sh |
90 | chmod 400 cert.pem privkey.pem | 93 | chmod 400 cert.pem privkey.pem |
@@ -101,77 +104,57 @@ sudo service pf start # start firewall | @@ -101,77 +104,57 @@ sudo service pf start # start firewall | ||
101 | Again, copy certificate files `privkey.pem` and `cert.pem` to the `certs` | 104 | Again, copy certificate files `privkey.pem` and `cert.pem` to the `certs` |
102 | directory. | 105 | directory. |
103 | 106 | ||
104 | ---- | ||
105 | - | ||
106 | -## Installing 3rd party javascript libraries | ||
107 | - | ||
108 | -The javascript libraries are not included in the repository. | ||
109 | -The following libraries are currently necessary (as of 24/1/2019): | ||
110 | - | ||
111 | -``` | ||
112 | -DataTables | ||
113 | -MDB-Free_4 | ||
114 | -MathJax-2.7.5 | ||
115 | -bootstrap-4.2.1-dist | ||
116 | -codemirror-5.42.2 | ||
117 | -fontawesome-free-5.6.3-web | ||
118 | -jquery-3.3.1.min.js | ||
119 | -popper.min.js | ||
120 | -``` | ||
121 | - | ||
122 | -Downloaded and install them in the directory perguntations/static/lib. | ||
123 | - | ||
124 | -FIXME: use `npm` | ||
125 | 107 | ||
126 | --- | 108 | --- |
127 | 109 | ||
128 | ## Running a demo | 110 | ## Running a demo |
129 | 111 | ||
130 | -The directory `demo` includes a demo test that can be used as a template for | ||
131 | -your own tests and questions. | 112 | +The directory `demo` in the repository includes a demo test that can be used |
113 | +as a template for your own tests and questions. | ||
132 | 114 | ||
133 | To run the demonstration test you need to initialize the database using one of | 115 | To run the demonstration test you need to initialize the database using one of |
134 | the following methods: | 116 | the following methods: |
135 | 117 | ||
136 | ```.bash | 118 | ```.bash |
137 | -./initdb.py students.csv # initialize from a CSV file | ||
138 | -./initdb.py --admin # only adds the administrator account | ||
139 | -./initdb.py --add 123 "Asterix Gaules" # add one student | 119 | +cd demo |
140 | 120 | ||
141 | -# a database file "students.db" is created | ||
142 | -mv students.db demo/ | 121 | +initdb students.csv # initialize from a CSV file |
122 | +initdb --admin # only adds the administrator account | ||
123 | +initdb --add 123 "Asterix Gaules" # add one student | ||
143 | 124 | ||
144 | -# create directory to save the finished tests | ||
145 | -mkdir demo/ans | 125 | +mkdir ans # directory where the student tests are saved |
146 | 126 | ||
147 | -# edit test configuration and check if everything looks right | ||
148 | -vi demo/test-tutorial.yaml | ||
149 | -``` | 127 | +$EDITOR test-tutorial.yaml # edit test configuration |
150 | 128 | ||
151 | -We are now ready to run the server: | ||
152 | - | ||
153 | -```.bash | ||
154 | -./serve.py --help # get help | ||
155 | -./serve.py demo/test-tutorial.yaml # run demo test | 129 | +perguntations --help # get help |
130 | +perguntations tutorial.yaml # run demo test | ||
156 | ``` | 131 | ``` |
157 | 132 | ||
158 | -By default the server listens on port 8443 and on all IPs of all network interfaces. | ||
159 | -Open the browser at `http://127.0.0.1:8443/` and login as user number `0` (administrator) and choose any password. Then | 133 | +The server listens on port 8443 of all IPs of all network interfaces. |
134 | +Open the browser at `http://127.0.0.1:8443/` and login as user number `0` | ||
135 | +(administrator) and choose any password. The administrator is redirected to the | ||
136 | +administration page that shows all the students and their state. | ||
160 | 137 | ||
161 | 1. Authorize students by clicking the checkboxes. | 138 | 1. Authorize students by clicking the checkboxes. |
162 | -2. Open a different browser at `http://127.0.0.1:8443/` and login as one of the authorized students. Answer the questions and submit. | 139 | +2. Open a different browser at `http://127.0.0.1:8443/` and login as one of the |
140 | +authorized students. Answer the questions and submit. | ||
163 | 141 | ||
164 | The server can be stoped from the terminal with `^C`. | 142 | The server can be stoped from the terminal with `^C`. |
165 | 143 | ||
166 | ## Running on lower ports 80 or 443 | 144 | ## Running on lower ports 80 or 443 |
167 | 145 | ||
168 | -Ports 80 and 443 are reserved for the root user and and this software _should NOT be run as root_. Instead, the firewall should be configured to forward tcp traffic from port 443 to 8443 where the server is listening. The details depend on the operating system. | 146 | +Ports 80 and 443 are reserved for the root user and and this software **should |
147 | +NOT be run as root**. | ||
148 | +Instead, the firewall should be configured to forward tcp traffic from port 443 | ||
149 | +to 8443 where the server is listening. | ||
150 | +The details depend on the operating system. | ||
169 | 151 | ||
170 | ### debian: | 152 | ### debian: |
171 | 153 | ||
154 | +FIXME: Untested | ||
155 | + | ||
172 | ```.bash | 156 | ```.bash |
173 | -iptables -t nat -I PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-ports 8080 | ||
174 | -FIXME: also for port 443... | 157 | +iptables -t nat -I PREROUTING -i eth0 -p tcp --dport 443 -j REDIRECT --to-ports 8443 |
175 | ``` | 158 | ``` |
176 | 159 | ||
177 | Explanation: | 160 | Explanation: |
@@ -181,19 +164,20 @@ Explanation: | @@ -181,19 +164,20 @@ Explanation: | ||
181 | - `-p tcp` selected protocol. | 164 | - `-p tcp` selected protocol. |
182 | - `-s 0/0` source network address/mask. | 165 | - `-s 0/0` source network address/mask. |
183 | - `-i eth0` interface via which the packet was received. | 166 | - `-i eth0` interface via which the packet was received. |
184 | -- `--dport 80` destination port. | 167 | +- `--dport 443` destination port. |
185 | - `-j REDIRECT` what to do when packet matches the rule. | 168 | - `-j REDIRECT` what to do when packet matches the rule. |
186 | -- `--to-ports 8080` where to redirect the packets. | 169 | +- `--to-ports 8443` where to redirect the packets. |
187 | 170 | ||
188 | ### FreeBSD and pf | 171 | ### FreeBSD and pf |
189 | 172 | ||
190 | Edit `/etc/pf.conf`: | 173 | Edit `/etc/pf.conf`: |
191 | 174 | ||
192 | - ext_if="em0" | 175 | + ext_if="wlan1" |
193 | rdr on $ext_if proto tcp from any to any port 80 -> 127.0.0.1 port 8080 | 176 | rdr on $ext_if proto tcp from any to any port 80 -> 127.0.0.1 port 8080 |
194 | rdr on $ext_if proto tcp from any to any port 443 -> 127.0.0.1 port 8443 | 177 | rdr on $ext_if proto tcp from any to any port 443 -> 127.0.0.1 port 8443 |
195 | 178 | ||
196 | -or `ext_if="vtnet0"` for guest additions under virtual box. | 179 | +The `wlan1` should be the name of the network interface. |
180 | +Use `ext_if="vtnet0"` for guest additions under virtual box. | ||
197 | 181 | ||
198 | Start firewall with `sudo service pf start`. | 182 | Start firewall with `sudo service pf start`. |
199 | 183 | ||
@@ -211,10 +195,17 @@ Optionally, to activate pf on boot, edit `rc.conf`: | @@ -211,10 +195,17 @@ Optionally, to activate pf on boot, edit `rc.conf`: | ||
211 | 195 | ||
212 | ## Troubleshooting | 196 | ## Troubleshooting |
213 | 197 | ||
214 | -* The server tries to run `python3` so this command must be accessible from user accounts. Currently, the minimum supported python version is 3.6. | ||
215 | -* If you are getting any `UnicodeEncodeError` type of errors that's because the terminal is not supporting UTF-8. This error may occur when a unicode character is printed to the screen by the server or, when running question generator or correction scripts, a message is piped between the server and the scripts that includes unicode characters. | ||
216 | -Try running `locale` on the terminal and see if there are any error messages. Solutions: | ||
217 | - - debian: fix it with `sudo dpkg-reconfigure locales`, select your UTF-8 locales and try again. | 198 | +* The server tries to run `python3` so this command must be accessible from |
199 | +user accounts. Currently, the minimum supported python version is 3.6. | ||
200 | + | ||
201 | +* If you are getting any `UnicodeEncodeError` type of errors that's because the | ||
202 | +terminal is not supporting UTF-8. | ||
203 | +This error may occur when a unicode character is printed to the screen by the | ||
204 | +server or, when running question generator or correction scripts, a message is | ||
205 | +piped between the server and the scripts that includes unicode characters. | ||
206 | +Try running `locale` on the terminal and see if there are any error messages. | ||
207 | +Solutions: | ||
208 | + - debian: `sudo dpkg-reconfigure locales` and select your UTF-8 locales. | ||
218 | - FreeBSD: edit `~/.login_conf` to use UTF-8, for example: | 209 | - FreeBSD: edit `~/.login_conf` to use UTF-8, for example: |
219 | 210 | ||
220 | ``` | 211 | ``` |
demo/test-tutorial.yaml
@@ -1,64 +0,0 @@ | @@ -1,64 +0,0 @@ | ||
1 | ---- | ||
2 | -# ============================================================================ | ||
3 | -# The test reference should be a unique identifier. It is saved in the database | ||
4 | -# so that queries for the results can be done in the terminal with | ||
5 | -# $ sqlite3 students.db "select * from tests where ref='demo'" | ||
6 | -ref: tutorial | ||
7 | - | ||
8 | -# (optional, default: '') You may wish to refer the course, year or kind of test | ||
9 | -title: Teste tutorial | ||
10 | - | ||
11 | -# (optional) duration in minutes, 0 or undefined is infinite | ||
12 | -duration: 120 | ||
13 | - | ||
14 | -# Database with student credentials and grades of all questions and tests done | ||
15 | -# The database is an sqlite3 file generate with the script initdb.py | ||
16 | -database: demo/students.db | ||
17 | - | ||
18 | -# Generate a file for each test done by a student. | ||
19 | -# It includes the questions, answers and grades. | ||
20 | -answers_dir: demo/ans | ||
21 | - | ||
22 | -# (optional, default: False) Show points for each question, scale 0-20. | ||
23 | -show_points: true | ||
24 | -# scale_points: True | ||
25 | -# scale_max: 20 | ||
26 | - | ||
27 | -# (optional, default: False) Show hints if available | ||
28 | -show_hints: true | ||
29 | - | ||
30 | -# (optional, default: False) Show lots of information for debugging | ||
31 | -# debug: True | ||
32 | - | ||
33 | - | ||
34 | -# ---------------------------------------------------------------------------- | ||
35 | -# Base path applied to the questions files and all the scripts | ||
36 | -# including question generators and correctors. | ||
37 | -# Either absolute path or relative to current directory can be used. | ||
38 | -questions_dir: demo | ||
39 | - | ||
40 | -# (optional) List of files containing questions in yaml format. | ||
41 | -# Selected questions will be obtained from these files. | ||
42 | -# If undefined, all yaml files in questions_dir are loaded (not recommended). | ||
43 | -files: | ||
44 | - - questions/questions-tutorial.yaml | ||
45 | - | ||
46 | -# This is the list of questions that will make up the test. | ||
47 | -# The order is preserved. | ||
48 | -# There are several ways to define each question (explained below). | ||
49 | -questions: | ||
50 | - - tut-test | ||
51 | - - tut-questions | ||
52 | - | ||
53 | - - tut-radio | ||
54 | - - tut-checkbox | ||
55 | - - tut-text | ||
56 | - - tut-text-regex | ||
57 | - - tut-numeric-interval | ||
58 | - - ref: tut-textarea | ||
59 | - points: 2.0 | ||
60 | - | ||
61 | - - tut-information | ||
62 | - - tut-success | ||
63 | - - tut-warning | ||
64 | - - tut-alert |
@@ -0,0 +1,57 @@ | @@ -0,0 +1,57 @@ | ||
1 | +--- | ||
2 | +# ============================================================================ | ||
3 | +# The test reference should be a unique identifier. It is saved in the database | ||
4 | +# so that queries for the results can be done in the terminal with | ||
5 | +# $ sqlite3 students.db "select * from tests where ref='demo'" | ||
6 | +ref: tutorial | ||
7 | + | ||
8 | +# (optional, default: '') You may wish to refer the course, year or kind of test | ||
9 | +title: Teste de demonstração (tutorial) | ||
10 | + | ||
11 | +# (optional) duration in minutes, 0 or undefined is infinite | ||
12 | +duration: 120 | ||
13 | + | ||
14 | +# Database with student credentials and grades of all questions and tests done | ||
15 | +# The database is an sqlite3 file generate with the script initdb.py | ||
16 | +database: demo/students.db | ||
17 | + | ||
18 | +# Generate a file for each test done by a student. | ||
19 | +# It includes the questions, answers and grades. | ||
20 | +answers_dir: demo/ans | ||
21 | + | ||
22 | +# (optional, default: False) Show points for each question, scale 0-20. | ||
23 | +show_points: true | ||
24 | +# scale_points: true | ||
25 | +# scale_max: 20 | ||
26 | + | ||
27 | +# ---------------------------------------------------------------------------- | ||
28 | +# Base path applied to the questions files and all the scripts | ||
29 | +# including question generators and correctors. | ||
30 | +# Either absolute path or relative to current directory can be used. | ||
31 | +questions_dir: demo | ||
32 | + | ||
33 | +# (optional) List of files containing questions in yaml format. | ||
34 | +# Selected questions will be obtained from these files. | ||
35 | +# If undefined, all yaml files in questions_dir are loaded (not recommended). | ||
36 | +files: | ||
37 | + - questions/questions-tutorial.yaml | ||
38 | + | ||
39 | +# This is the list of questions that will make up the test. | ||
40 | +# The order is preserved. | ||
41 | +# There are several ways to define each question (explained below). | ||
42 | +questions: | ||
43 | + - tut-test | ||
44 | + - tut-questions | ||
45 | + | ||
46 | + - tut-radio | ||
47 | + - tut-checkbox | ||
48 | + - tut-text | ||
49 | + - tut-text-regex | ||
50 | + - tut-numeric-interval | ||
51 | + - ref: tut-textarea | ||
52 | + points: 2.0 | ||
53 | + | ||
54 | + - tut-information | ||
55 | + - tut-success | ||
56 | + - tut-warning | ||
57 | + - tut-alert |
@@ -0,0 +1,44 @@ | @@ -0,0 +1,44 @@ | ||
1 | +{ | ||
2 | + "requires": true, | ||
3 | + "lockfileVersion": 1, | ||
4 | + "dependencies": { | ||
5 | + "@fortawesome/fontawesome-free": { | ||
6 | + "version": "5.7.1", | ||
7 | + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-5.7.1.tgz", | ||
8 | + "integrity": "sha512-gukWJ7Mwf0WXQbkcwcm5zi8+H8aT5MMnphf5hpydOw898H1ibgm2cyejHgk6Km/FTvrPp5ppUHLrlFwt0QxsQw==" | ||
9 | + }, | ||
10 | + "bootstrap": { | ||
11 | + "version": "4.3.0", | ||
12 | + "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.3.0.tgz", | ||
13 | + "integrity": "sha512-M0vqY0Z6UDweV2nLFl5dXcb+GIo53EBCGMMVxCGH5vJxl/jsr+HkULBMd4kn9rdpdBZwd3BduCgMOYOwJybo4Q==" | ||
14 | + }, | ||
15 | + "codemirror": { | ||
16 | + "version": "5.43.0", | ||
17 | + "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.43.0.tgz", | ||
18 | + "integrity": "sha512-mljwQWUaWIf85I7QwTBryF2ASaIvmYAL4s5UCanCJFfKeXOKhrqdHWdHiZWAMNT+hjLTCnVx2S/SYTORIgxsgA==" | ||
19 | + }, | ||
20 | + "datatables": { | ||
21 | + "version": "1.10.18", | ||
22 | + "resolved": "https://registry.npmjs.org/datatables/-/datatables-1.10.18.tgz", | ||
23 | + "integrity": "sha512-ntatMgS9NN6UMpwbmO+QkYJuKlVeMA2Mi0Gu/QxyIh+dW7ZjLSDhPT2tWlzjpIWEkDYgieDzS9Nu7bdQCW0sbQ==", | ||
24 | + "requires": { | ||
25 | + "jquery": ">=1.7" | ||
26 | + } | ||
27 | + }, | ||
28 | + "jquery": { | ||
29 | + "version": "3.3.1", | ||
30 | + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz", | ||
31 | + "integrity": "sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg==" | ||
32 | + }, | ||
33 | + "mathjax": { | ||
34 | + "version": "2.7.5", | ||
35 | + "resolved": "https://registry.npmjs.org/mathjax/-/mathjax-2.7.5.tgz", | ||
36 | + "integrity": "sha512-OzsJNitEHAJB3y4IIlPCAvS0yoXwYjlo2Y4kmm9KQzyIBZt2d8yKRalby3uTRNN4fZQiGL2iMXjpdP1u2Rq2DQ==" | ||
37 | + }, | ||
38 | + "popper.js": { | ||
39 | + "version": "1.14.7", | ||
40 | + "resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.14.7.tgz", | ||
41 | + "integrity": "sha512-4q1hNvoUre/8srWsH7hnoSJ5xVmIL4qgz+s4qf2TnJIMyZFUFMGH+9vE7mXynAlHSZ/NdTmmow86muD0myUkVQ==" | ||
42 | + } | ||
43 | + } | ||
44 | +} |
@@ -0,0 +1,13 @@ | @@ -0,0 +1,13 @@ | ||
1 | +{ | ||
2 | + "description": "Javascript libraries required to run the server", | ||
3 | + "email": "mjsb@uevora.pt", | ||
4 | + "dependencies": { | ||
5 | + "@fortawesome/fontawesome-free": "^5.7.1", | ||
6 | + "bootstrap": "^4.3.0", | ||
7 | + "codemirror": "^5.43.0", | ||
8 | + "datatables": "^1.10.18", | ||
9 | + "jquery": "^3.3.1", | ||
10 | + "mathjax": "^2.7.5", | ||
11 | + "popper.js": "^1.14.7" | ||
12 | + } | ||
13 | +} |
perguntations/static/README
@@ -1,28 +0,0 @@ | @@ -1,28 +0,0 @@ | ||
1 | -# Javascript libraries | ||
2 | - | ||
3 | -The javascript libraries should be installed in the `lib` directory. | ||
4 | -Either make a `lib` directory here or a symbolic link to somewhere else. | ||
5 | - | ||
6 | -Currently, libs should contain: | ||
7 | - | ||
8 | - bootstrap | ||
9 | - codemirror | ||
10 | - DataTables | ||
11 | - fontawesome | ||
12 | - MathJax | ||
13 | - | ||
14 | -and the files: | ||
15 | - | ||
16 | - jquery.min.js | ||
17 | - popper.min.js | ||
18 | - | ||
19 | -The DataTables directory was generated by https://www.datatables.net/download/ | ||
20 | -Select: | ||
21 | - | ||
22 | -- styling: bootstrap4 | ||
23 | -- packages: datatables | ||
24 | -- extensions: responsive | ||
25 | - | ||
26 | -This will generate a zip that contains the directory `DataTables`. Expand the | ||
27 | -zip into `lib`. | ||
28 | - |
perguntations/templates/admin.html
@@ -7,8 +7,8 @@ | @@ -7,8 +7,8 @@ | ||
7 | <link rel="icon" href="/static/favicon.ico"> | 7 | <link rel="icon" href="/static/favicon.ico"> |
8 | 8 | ||
9 | <!-- styles --> | 9 | <!-- styles --> |
10 | - <link rel="stylesheet" type="text/css" href="/static/lib/bootstrap/css/bootstrap.min.css"> | ||
11 | - <link rel="stylesheet" type="text/css" href="/static/lib/DataTables/datatables.min.css"/> | 10 | + <link rel="stylesheet" type="text/css" href="/static/bootstrap/css/bootstrap.min.css"> |
11 | + <link rel="stylesheet" type="text/css" href="/static/datatables/css/jquery.dataTables.min.css"/> | ||
12 | 12 | ||
13 | <style> | 13 | <style> |
14 | html { | 14 | html { |
@@ -20,11 +20,11 @@ | @@ -20,11 +20,11 @@ | ||
20 | </style> | 20 | </style> |
21 | 21 | ||
22 | <!-- Scripts --> | 22 | <!-- Scripts --> |
23 | - <script src="/static/lib/jquery.min.js"></script> | ||
24 | - <script defer src="/static/lib/fontawesome/js/all.min.js"></script> | ||
25 | - <script defer src="/static/lib/popper.min.js"></script> | ||
26 | - <script defer src="/static/lib/bootstrap/js/bootstrap.min.js"></script> | ||
27 | - <script defer src="/static/lib/DataTables/datatables.min.js"></script> | 23 | + <script src="/static/jquery/jquery.min.js"></script> |
24 | + <script defer src="/static/popper.js/popper.min.js"></script> | ||
25 | + <script defer src="/static/fontawesome-free/js/all.min.js"></script> | ||
26 | + <script defer src="/static/bootstrap/js/bootstrap.min.js"></script> | ||
27 | + <script defer src="/static/datatables/js/jquery.dataTables.min.js"></script> | ||
28 | 28 | ||
29 | <script defer src="/static/js/admin.js"></script> | 29 | <script defer src="/static/js/admin.js"></script> |
30 | <script defer src="/static/js/clock.js"></script> | 30 | <script defer src="/static/js/clock.js"></script> |
perguntations/templates/grade.html
@@ -7,14 +7,15 @@ | @@ -7,14 +7,15 @@ | ||
7 | <link rel="icon" href="/static/favicon.ico"> | 7 | <link rel="icon" href="/static/favicon.ico"> |
8 | 8 | ||
9 | <!-- Styles --> | 9 | <!-- Styles --> |
10 | - <link rel="stylesheet" type="text/css" href="/static/lib/bootstrap/css/bootstrap.min.css"> | 10 | + <link rel="stylesheet" type="text/css" href="/static/bootstrap/css/bootstrap.min.css"> |
11 | + | ||
11 | <link rel="stylesheet" type="text/css" href="/static/css/test.css"> | 12 | <link rel="stylesheet" type="text/css" href="/static/css/test.css"> |
12 | 13 | ||
13 | <!-- Scripts --> | 14 | <!-- Scripts --> |
14 | - <script defer src="/static/lib/fontawesome/js/all.min.js"></script> | ||
15 | - <script defer src="/static/lib/jquery.min.js"></script> | ||
16 | - <script defer src="/static/lib/popper.min.js"></script> | ||
17 | - <script defer src="/static/lib/bootstrap/js/bootstrap.min.js"></script> | 15 | + <script src="/static/jquery/jquery.min.js"></script> |
16 | + <script defer src="/static/popper.js/popper.min.js"></script> | ||
17 | + <script defer src="/static/fontawesome-free/js/all.min.js"></script> | ||
18 | + <script defer src="/static/bootstrap/js/bootstrap.min.js"></script> | ||
18 | </head> | 19 | </head> |
19 | <!-- ================================================================= --> | 20 | <!-- ================================================================= --> |
20 | <body> | 21 | <body> |
perguntations/templates/login.html
@@ -11,10 +11,10 @@ | @@ -11,10 +11,10 @@ | ||
11 | <link rel="stylesheet" type="text/css" href="/static/bootstrap/css/bootstrap.min.css"> | 11 | <link rel="stylesheet" type="text/css" href="/static/bootstrap/css/bootstrap.min.css"> |
12 | 12 | ||
13 | <!-- Scripts --> | 13 | <!-- Scripts --> |
14 | - <script src="/static/lib/jquery.min.js"></script> | ||
15 | - <script defer src="/static/lib/fontawesome/js/all.min.js"></script> | ||
16 | - <script defer src="/static/lib/popper.min.js"></script> | ||
17 | - <script defer src="/static/lib/bootstrap/js/bootstrap.min.js"></script> | 14 | + <script src="/static/jquery/jquery.min.js"></script> |
15 | + <script defer src="/static/popper.js/popper.min.js"></script> | ||
16 | + <script defer src="/static/fontawesome-free/js/all.min.js"></script> | ||
17 | + <script defer src="/static/bootstrap/js/bootstrap.min.js"></script> | ||
18 | 18 | ||
19 | </head> | 19 | </head> |
20 | <!-- =================================================================== --> | 20 | <!-- =================================================================== --> |
perguntations/templates/review.html
@@ -17,15 +17,15 @@ | @@ -17,15 +17,15 @@ | ||
17 | <script defer type="text/javascript" src="/static/MathJax/MathJax.js?config=TeX-AMS_CHTML-full"></script> | 17 | <script defer type="text/javascript" src="/static/MathJax/MathJax.js?config=TeX-AMS_CHTML-full"></script> |
18 | 18 | ||
19 | <!-- Styles --> | 19 | <!-- Styles --> |
20 | - <link rel="stylesheet" href="/static/lib/bootstrap/css/bootstrap.min.css"> | ||
21 | - <link rel="stylesheet" href="/static/css/github.css"> <!-- syntax highlight --> | ||
22 | - <link rel="stylesheet" href="/static/css/test.css"> | 20 | + <link rel="stylesheet" type="text/css" href="/static/bootstrap/css/bootstrap.min.css"> |
21 | + <link rel="stylesheet" type="text/css" href="/static/css/github.css"> <!-- syntax highlight --> | ||
22 | + <link rel="stylesheet" type="text/css" href="/static/css/test.css"> | ||
23 | 23 | ||
24 | <!-- Scripts --> | 24 | <!-- Scripts --> |
25 | - <script defer src="/static/lib/jquery.min.js"></script> | ||
26 | - <script defer src="/static/lib/popper.min.js"></script> | ||
27 | - <script defer src="/static/lib/bootstrap/js/bootstrap.min.js"></script> | ||
28 | - <script defer src="/static/lib/fontawesome/js/all.min.js"></script> | 25 | + <script src="/static/jquery/jquery.min.js"></script> |
26 | + <script defer src="/static/popper.js/popper.min.js"></script> | ||
27 | + <script defer src="/static/fontawesome-free/js/all.min.js"></script> | ||
28 | + <script defer src="/static/bootstrap/js/bootstrap.min.js"></script> | ||
29 | </head> | 29 | </head> |
30 | <!-- ===================================================================== --> | 30 | <!-- ===================================================================== --> |
31 | <body> | 31 | <body> |
perguntations/templates/test.html
@@ -14,22 +14,22 @@ | @@ -14,22 +14,22 @@ | ||
14 | } | 14 | } |
15 | }); | 15 | }); |
16 | </script> | 16 | </script> |
17 | - <script type="text/javascript" src="/static/MathJax/MathJax.js?config=TeX-AMS_CHTML-full"></script> | 17 | + <script type="text/javascript" src="/static/mathjax/MathJax.js?config=TeX-AMS_CHTML-full"></script> |
18 | 18 | ||
19 | <!-- Scripts --> | 19 | <!-- Scripts --> |
20 | - <script src="/static/lib/jquery.min.js"></script> | ||
21 | - <script defer src="/static/lib/popper.min.js"></script> | ||
22 | - <script defer src="/static/lib/bootstrap/js/bootstrap.min.js"></script> | ||
23 | - <script defer src="/static/lib/fontawesome/js/all.min.js"></script> | ||
24 | - <script src="/static/lib/codemirror/lib/codemirror.js"></script> | ||
25 | - <script src="/static/lib/codemirror/addon/selection/active-line.js"></script> | ||
26 | - <script src="/static/lib/codemirror/addon/edit/matchbrackets.js"></script> | 20 | + <script src="/static/jquery/jquery.min.js"></script> |
21 | + <script defer src="/static/popper.js/popper.min.js"></script> | ||
22 | + <script defer src="/static/fontawesome-free/js/all.min.js"></script> | ||
23 | + <script defer src="/static/bootstrap/js/bootstrap.min.js"></script> | ||
24 | + <script src="/static/codemirror/lib/codemirror.js"></script> | ||
25 | + <script src="/static/codemirror/addon/selection/active-line.js"></script> | ||
26 | + <script src="/static/codemirror/addon/edit/matchbrackets.js"></script> | ||
27 | 27 | ||
28 | <!-- Styles --> | 28 | <!-- Styles --> |
29 | - <link rel="stylesheet" type="text/css" href="/static/lib/bootstrap/css/bootstrap.min.css"> | 29 | + <link rel="stylesheet" type="text/css" href="/static/bootstrap/css/bootstrap.min.css"> |
30 | + <link rel="stylesheet" type="text/css" href="/static/codemirror/lib/codemirror.css"> | ||
31 | + <link rel="stylesheet" type="text/css" href="/static/codemirror/theme/darcula.css"> | ||
30 | <link rel="stylesheet" type="text/css" href="/static/css/github.css"> <!-- syntax highlight --> | 32 | <link rel="stylesheet" type="text/css" href="/static/css/github.css"> <!-- syntax highlight --> |
31 | - <link rel="stylesheet" type="text/css" href="/static/lib/codemirror/lib/codemirror.css"> | ||
32 | - <link rel="stylesheet" type="text/css" href="/static/lib/codemirror/theme/darcula.css"> | ||
33 | <link rel="stylesheet" type="text/css" href="/static/css/test.css"> | 33 | <link rel="stylesheet" type="text/css" href="/static/css/test.css"> |
34 | 34 | ||
35 | <!-- My scripts --> | 35 | <!-- My scripts --> |