Skip to content

Commit

Permalink
fix(tools): add integrity checks for the jquery cdn link
Browse files Browse the repository at this point in the history
  • Loading branch information
kantord committed Jan 8, 2022
1 parent 7e22872 commit 4805e0a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
4 changes: 3 additions & 1 deletion apps/tools/librelingo_tools/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ def generate_course(sdir, outdir, tdir, course_dir):
python = sys.executable
cmd = f"{python} {lilipy} --course {course_dir} --html {docs_dir}"
print(cmd)
success = os.system(cmd) == 0 # TODO: replace this arbitrary system call with a simple Python call
success = (
os.system(cmd) == 0
) # TODO: replace this arbitrary system call with a simple Python call
# {or refactor this file as a shell script. But Python code is preferable)
os.chdir(current_dir)
with open(os.path.join(docs_dir, "course.json")) as fh:
Expand Down
2 changes: 1 addition & 1 deletion apps/tools/librelingo_tools/templates/converter.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<div id="output">
<div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<script>
$(document).ready(function(){
var source_to_target = null;
Expand Down
2 changes: 1 addition & 1 deletion apps/tools/librelingo_tools/templates/missing_words.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h2>Missing Words</h2>
</div>


<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<script>
$(document).ready(function(){
//var source_to_target = null;
Expand Down
9 changes: 7 additions & 2 deletions apps/tools/practice.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
import argparse
import random

from librelingo_tools import guess_path_to_course, collect_data, collect_words, collect_phrases
from librelingo_tools.lili import (
guess_path_to_course,
collect_data,
collect_words,
collect_phrases,
)
from librelingo_yaml_loader.yaml_loader import load_course


Expand All @@ -21,7 +26,7 @@ def get_args():
return args


def check(translation, lookup, word)
def check(translation, lookup, word):
return translation.lower() in [wrd.lower() for wrd in lookup[word]]


Expand Down

0 comments on commit 4805e0a

Please sign in to comment.