Skip to content

Commit b5ae4b8

Browse files
committed
Fixed #33: exclusion of mul packages in monolingual detection
1 parent 7f601f9 commit b5ae4b8

4 files changed

Lines changed: 161 additions & 200 deletions

File tree

blocked/attention.svg

Lines changed: 0 additions & 35 deletions
This file was deleted.

blocked/blocked.css

Lines changed: 0 additions & 160 deletions
This file was deleted.

gen-home.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,9 @@ def is_monolingual(packages: list[Package]) -> bool:
224224
langs = []
225225
for package in packages:
226226
langs.extend(package.langs)
227-
if "mul" in langs:
228-
langs.remove("mul")
227+
mul = get_lang_def("mul")
228+
if mul in langs:
229+
langs.remove(mul)
229230
return len(set(langs)) == 1
230231

231232

templates/external.html

Lines changed: 158 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,167 @@
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
66
<title>External Link Detected</title>
7-
<base href="http://{{ fqdn }}/blocked/" />
8-
<link rel="stylesheet" type="text/css" href="blocked.css" />
7+
<base href="//{{ fqdn }}/blocked/"/>
8+
<style type="text/css">
9+
@font-face {
10+
font-family:"DM Sans";
11+
font-style: normal;
12+
font-weight: 400;
13+
src : url("../blocked/fonts/DMSans-Regular.ttf");
14+
}
15+
@font-face {
16+
font-family:"DM Sans Bold";
17+
font-style: normal;
18+
font-weight: 700;
19+
src : url("../blocked/fonts/DMSans-Regular.ttf");
20+
}
21+
22+
body {
23+
background: linear-gradient(to bottom right, #ffffff, #e6e6e6);
24+
background-repeat: no-repeat;
25+
background-attachment: fixed;
26+
}
27+
28+
header {
29+
width: 100%;
30+
margin: auto;
31+
text-align: center;
32+
33+
margin-top: 15%;
34+
margin-bottom: 15%;
35+
}
36+
37+
header svg {
38+
width: 60%;
39+
min-width: 200px;
40+
max-width: 500px;
41+
max-height: 300px;
42+
}
43+
44+
section {
45+
display: flex;
46+
flex-direction: column;
47+
align-items: center;
48+
}
49+
50+
header, .intro {
51+
font-family: "DM Sans";
52+
}
53+
54+
.intro {
55+
font-size: 1em;
56+
padding: 0 10%;
57+
line-height: 1.2em;
58+
text-align: center;
59+
}
60+
61+
.intro h1 {
62+
font-family: "DM Sans Bold";
63+
font-size: 1.2em;
64+
}
65+
66+
.intro code {
67+
font-family: monospace;
68+
font-size: 1.1em;
69+
}
70+
71+
.intro code a, .intro code a:active, .intro code a:visited {
72+
color: #00b4e4;
73+
text-decoration: none;
74+
word-break: break-all;
75+
}
76+
77+
.intro code svg {
78+
width: .8em;
79+
vertical-align: middle;
80+
}
81+
82+
.advice {
83+
width: 80%;
84+
margin: auto;
85+
margin-bottom: 15%;
86+
margin-top: 5em;
87+
88+
background-color: #ffffff;
89+
border-radius: 1rem;
90+
border: 1px solid #b7b7b7;
91+
92+
padding: 2em;
93+
94+
font-family: "DM Sans";
95+
font-size: .9em;
96+
box-sizing: border-box;
97+
98+
align-items: normal;
99+
}
100+
101+
.advice p {
102+
margin-bottom: 1em;
103+
}
104+
105+
.advice p:first-child {
106+
margin-top: 0;
107+
}
108+
109+
.advice p:last-child {
110+
margin-bottom: 0;
111+
}
112+
113+
114+
/* sm: 640px+ */
115+
@media (width >= 40rem) {
116+
header {
117+
margin-bottom: 1em;
118+
margin-top: 5em;
119+
}
120+
121+
header svg {
122+
width: 50%;
123+
}
124+
125+
.intro h1 {
126+
font-size: 2em;
127+
}
128+
129+
.advice {
130+
width: 50%;
131+
}
132+
}
133+
134+
/* md: 768px+ */
135+
@media (width >= 48rem) {}
136+
137+
/* lg: 1024px+ */
138+
@media (width >= 64rem) {}
139+
140+
/* xl: 1280px+ */
141+
@media (width >= 80rem) {
142+
.intro h1 {
143+
font-size: 3.4em;
144+
}
145+
}
146+
147+
/* 2xl: 1536px+ */
148+
@media (width >= 96rem) {
149+
header svg {
150+
width: 25%;
151+
min-width: 200px;
152+
max-width: 500px;
153+
max-height: 300px;
154+
}
155+
156+
.advice {
157+
width: 25%;
158+
min-width: 200px;
159+
min-width: 300px;
160+
max-width: 500px;
161+
}
162+
}
163+
</style>
9164
</head>
10165
<body>
11166
<header>
12-
<img src="attention.svg" alt="Caution!" />
167+
<svg alt="Caution!" viewBox="0 0 1742.79 1984.21" xmlns="http://www.w3.org/2000/svg"><ellipse cx="667.97" cy="1872.93" fill="#c7c8ca" rx="649.71" ry="111.28"/><path d="m933.76 1775.81c0-29.5-23.92-53.42-53.42-53.42h-163.28c-24.37 0-45.97-15.91-52.98-39.26l-105.96-347.65 18.1-9.63c251.03-105.38 519.58 82.75 706.54-97.93l1.17-1.17c23.21-21.02 46.27-42.47 114.72.29 73.56 46.12 236 166.53 309.71 372.32 0 0 44.66-15.91 32.25-70.49-12.41-54.73-102.89-212.36-287.96-352.18-33.86-25.69-64.36-47-89.76-64.07 36.93-158.21-155.14-349.11-342.69-259.21-134.57-126.54-284.6-178.2-422.67-176.16-365.6 5.11-647.58 386.04-344.3 749.45l.58.58c4.67 5.55 9.49 11.09 14.3 16.64 19.7 23.64 32.69 44.51 43.93 81.29l90.34 296.57h-31.96c-29.48 0-53.42 23.94-53.42 53.42h121.43l204.04 96.47c12.55-26.71 1.17-58.53-25.4-71.08l-53.56-25.25h153.83c0-29.48-23.94-53.42-53.42-53.42h-139.38c-24.37 0-45.97-15.91-52.98-39.26l-71.66-235.42c-17.81-61.88 23.21-102.31 61.74-107.13 35.17-4.38 52.83 18.39 69.47 73.27l63.63 208.85h-31.96c-29.48 0-53.42 23.94-53.42 53.42h121.43l204.04 96.47c12.55-26.71 1.17-58.53-25.4-71.08l-53.56-25.25h177.88z"/><path d="m545.68 2.53h52.19v1441.85h-52.19z" fill="#f89a16" transform="matrix(.9855856 -.16917749 .16917749 .9855856 -114.16 107.17)"/><path d="m581.21 624.21-55.8-17.21-93.34-544.54 53.51 3.6z" fill="#da7c2b"/><path d="m981.62 279.44c-30.85 1.91-83.72 3.58-83.72 3.58l79.01-31.06-43.25-251.96-933.66 160.24 56.63 330 68.11 13.66s-38.47 19-60.89 28.37l22.52 131.23 933.66-160.24z" fill="#f89a16"/><circle cx="1144.16" cy="1031.93" fill="#fff" r="82.26" transform="matrix(.70710678 -.70710678 .70710678 .70710678 -394.57 1111.29)"/><circle cx="1124.15" cy="1004.52" r="52.63" transform="matrix(.41786707 -.90850818 .90850818 .41786707 -258.21 1606.05)"/><g fill="#fff"><path d="m387.43 559.95-69.59-57.58 107.75-360.2 93.69-15.45 226.75 308.17-45.64 75.04-312.97 50.02zm-11.05-75.33 25.78 21.33 266.91-42.65 15.63-25.7-187.97-255.46-31.41 5.18-88.94 297.31z"/><path d="m526.16 300.48 5.44 89.61-20.72 3.32-28.24-85.96-9.08-47.73 43.52-6.98 9.08 47.73zm18.46 103.04 7.02 36.88-41.43 6.64-7.02-36.88z"/></g></svg>
13168
</header>
14169
<section class="intro">
15170
<h1>External Link Detected</h1>

0 commit comments

Comments
 (0)