-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.html
executable file
·235 lines (204 loc) · 9.67 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'/>
<title>Factorio Serverlist</title>
<link rel=stylesheet href="res/style.css">
</head>
<body>
<div id=wrapper>
<header class=part>
<section>
<p><a href="#footer">About this site</a></p>
<p><a href="https://www.factorio.com">www.factorio.com</a></p>
</section>
<img src="res/factorio-logo.png" alt="Factorio"><br>
<span class=title>Server List</span> <span class=unofficial>(unofficial)</span>
</header>
<section id=pagechoice class=part>
<div id=chooseServerlist class=selected>View serverlist</div>
<div id=chooseDownloadMods>Download all popular mods</div>
</section>
<section id=downloadmods class=part>
<span class=info>Get all popular mods in one download</span>
<div id=versionselector></div>
<div id=modpack_settings>
Limit modpack size to <input type=number step='any' style='width: 50px;' id='modpack_maxsize' value=500> MB
<input type=button value='Update list' onclick="calculateModpack();"><br>
<span style='color: #ccc;'>The maximum size (with all <span id='modpack_count'></span> mods) is <span id='modpack_allModsSize'></span></span><br>
<br>
<input type=button value='Download now' onclick="downloadModpack(this);">
<br><br>
</div>
<div id=modpack_output></div>
<div id=modpack_iframe></div>
<div id=status2></div>
</section>
<footer id="modpack_about" class=part>
<h3>About the mod pack (FAQ)</h3>
<p><strong>Why can I not join <i>all</i> servers with the mod pack?</strong></p>
<p>
The number of servers currently online that you can join with the mod pack is less than 100%
for two reasons: not all mods are available on the mod portal and the system cannot look into
the future to download what will be popular when you open the page.
</p>
<p>
You might also notice that the number of servers you can join does not change when you limit
the mod pack size. This is because the mod pack consists of <i>all</i> mods that were popular
(used by 2+ players) at any point in the past week. Many of those mods will not be used by 2+
players at this moment.
</p>
<p><strong>How is the mod pack compiled?</strong></p>
<p>
Factorio servers are tracked 24/7. For every server with more than 1 player, its mods are
added to a list. This keeps track of popularity. Now and then it downloads mods from the mod
portal that it doesn't have yet.
</p>
<p>
The mod pack you download is a zip file with all these mods. Any mods that are no longer
popular are not included in the mod pack. Popularity is measured over 7 days.
</p>
<p><strong>Why only track servers with 2+ players?</strong></p>
<p>
It only includes servers with 2 players because empty servers are definitely not popular
and 1 player might be the owner trying out his weird mod and is apparently also not popular.
</p>
<p><strong>Why only download small mods by default?</strong></p>
<p>
The big ones account for 60% of the size but are used on only 5% of the servers.
(These numbers are very rough estimates.)
</p>
<p><strong>How does it generate dynamic zip files?</strong></p>
<p>
I'm glad you asked! I actually spent a few hours reading the official for ZIP file format
documentation. The document dates back to 1989 and maintains MS DOS and Amiga. Lots of fun.
</p>
<p>
Turns out, you can create zip files on the fly with no need to write a temporary file to
disk, nor keep the whole archive in memory. Aside from about 64 bytes per file, there is
no state to remember. Since I have the list of files already (this is in the database of
mods), I only need to read each file part by part and forward it to the user. Still not
terribly efficient, caching the most popular variants would be smarter, but it's a very
good trade-off between complexity and efficiency.
</p>
<p>
There are very few pieces of software that need this and the only library that I could find
for PHP had some issues, so I looked up the spec and wrote my own.
</p>
<p><strong>What is wrong with the date/time in the zip?</strong></p>
<p>
Because of the highly advanced dynamic zip file generation®, I had to write my own zip
file generator. Turns out, zip files store their date and time in the same format as MS DOS.
That is about as ridiculous as it sounds. I chose to skip that part.
</p>
<p>
Oh and I don't store mods' metadata, so I couldn't fill the field in regardless.
</p>
<p><strong>How big is this mod database?</strong></p>
<p>
At the moment of writing, two days into collecting mods, I have about 1150 mods, taking
2.5GB. Not a lot of new mods appear anymore. This is a bit bigger than expected, but it's
not a problem... yet. Oh and the whole thing was monitored, rate-limited and ran at
off-hours, so nobody had interference from me downloading this <3.
</p>
</footer>
<nav id=filters class=part>
<noscript>
<h1>This page uses Javascript to dynamically search, filter and update the data.</h1>
<h3>But it is disabled in your browser :(</h3>
<hr>
</noscript>
<section>
<strong>Search</strong>
<input id=search size=35 placeholder="0.14.5 team challenge country:GB">
<i>search mods, players, versions... all fields</i>
</section>
<section>
<strong>Hide mods</strong>
<input id=hidemods size=25 placeholder="aircraft 1.0.7 boblogi"><div class=spacing></div>
<label><input type=checkbox id=nomods> hide all</label> <div class=spacing></div>
<input type=number size=2 id=maxmodno> max. number of mods
</section>
<section>
<strong>Players</strong> <input type=number id=minPlayers value=0> or more
</section>
<section>
<strong>User verification</strong>
<label><input type=radio id=allowUserVerif name=userverif checked> show</label>
<label><input type=radio id=hideUserVerif name=userverif> hide</label>
<label><input type=radio id=onlyUserVerif name=userverif> only</label>
</section>
<section>
<strong>Password</strong>
<label><input type=checkbox id=passworded checked> hide passworded</label>
</section>
<section>
<input type=button value=Reset onclick='reset();'>
<span id=loadPrevious>
<input type=button value='Load previous filters' onclick='load();'>
</span>
</section>
<section>
<strong>Sort by</strong>
<select id=sort>
<option value=best>best</option>
<option value=rand>random</option>
<option value=distance>distance (least first)</option>
<option value=uptime+>uptime (most first)</option>
<option value=uptime>uptime (least first)</option>
<option value=players+>players (most first)</option>
<option value=players>players (least first)</option>
<option value=mods+>mod count (most first)</option>
<option value=mods>mod count (least first)</option>
<option value=playtime+>playing time (most first)</option>
<option value=playtime>playing time (least first)</option>
<option value=playerlim+>player limit (most first)</option>
<option value=playerlim>player limit (least first)</option>
<option value=country>country</option>
</select>
</section>
</nav>
<section id=status class=part>
Loading javascript...
</section>
<main id=servers class=part></main>
<footer class=part id=footer> <!-- id added for the fragmentIdentifier #footer -->
<h3>About this website</h3>
This website is made by Luc Gommans ('luc' in game, irc, forums and wiki). It uses
the Factorio API with permission from Factorio staff. The data remains copyright Wube
Software. This software is available under the MIT license on
<a href="https://github.com/lgommans/factorio-serverlist" target="_blank">Github</a>.
<h3>Credits and copyrights</h3>
<p>
The background image is a modified version of
<a href="https://us2.factorio.com/assets/img/screenshots/screenshot-14.jpg" target="_blank">this screenshot</a>,
found <a href="https://www.factorio.com/screenshots" target="_blank">here</a>.
</p>
<p>
Country lookups are done using <a href="http://maxmind.com">Maxmind</a>'s
GeoLite2 country database (CC-BY-SA 4.0 Int.).
<p>
Flags are made by <a href="http://www.IconDrawer.com" target="_blank">www.IconDrawer.com</a>
(via <a href="http://365icon.com/icon-styles/ethnic/classic2/" target="_blank">365icon.com</a>).
User icon is public domain, taken from
<a href="https://pixabay.com/en/blank-profile-picture-mystery-man-973460/" target="_blank">pixabay.com</a>.
The connection icon is taken from
<a href="http://downloadicons.net/connected-icon-61290" target="_blank">downloadicons.net</a>.
I can't find a license but it says "download free" everywhere, so it's probably
fine. The link icon is from
<a href="https://commons.wikimedia.org/wiki/File:Chain_link_icon.png" target="_blank">Mdowdell, Wikimedia</a>,
CC-BY-SA 3.0.
The 'user verification' (customs) icon is by
<a href="https://icons8.com/">icons8</a>, CC-BY-ND (via
<a href="http://www.iconarchive.com/show/windows-8-icons-by-icons8/Travel-Customs-Officer-icon.html">iconarchive.com</a>).
The lock icon is from Grecor Črešnar, via
<a href="https://thenounproject.com/term/password/385803/">thenounproject.com</a>,
CC-BY. I removed the asterisks below the lock (stating changes is a requirement).
The clock and distance icons... I made those, look ma! So that's MIT license.
</p>
</footer>
</div>
<script src="res/serverlist.js"></script>
</body>
</html>