]> git.lizzy.rs Git - cheatdb.git/blob - app/default_data.py
3a9f5f145127e34d8d902e5877ca76ef715dd6f5
[cheatdb.git] / app / default_data.py
1 from .models import *
2 from .utils import make_flask_user_password
3
4
5 def populate(session):
6         admin_user = User("rubenwardy")
7         admin_user.active = True
8         admin_user.password = make_flask_user_password("tuckfrump")
9         admin_user.github_username = "rubenwardy"
10         admin_user.forums_username = "rubenwardy"
11         admin_user.rank = UserRank.ADMIN
12         session.add(admin_user)
13
14         session.add(MinetestRelease("None", 0))
15         session.add(MinetestRelease("0.4.16/17", 32))
16         session.add(MinetestRelease("5.0", 37))
17         session.add(MinetestRelease("5.1", 38))
18
19         tags = {}
20         for tag in ["Inventory", "Mapgen", "Building", \
21                         "Mobs and NPCs", "Tools", "Player effects", \
22                         "Environment", "Transport", "Maintenance", "Plants and farming", \
23                         "PvP", "PvE", "Survival", "Creative", "Puzzle", "Multiplayer", "Singleplayer"]:
24                 row = Tag(tag)
25                 tags[row.name] = row
26                 session.add(row)
27
28         licenses = {}
29         for license in ["GPLv2.1", "GPLv3", "LGPLv2.1", "LGPLv3", "AGPLv2.1", "AGPLv3",
30                                         "Apache", "BSD 3-Clause", "BSD 2-Clause", "CC0", "CC-BY-SA",
31                                         "CC-BY", "MIT", "ZLib", "Other (Free)"]:
32                 row = License(license)
33                 licenses[row.name] = row
34                 session.add(row)
35
36         for license in ["CC-BY-NC-SA", "Other (Non-free)"]:
37                 row = License(license, False)
38                 licenses[row.name] = row
39                 session.add(row)
40
41
42 def populate_test_data(session):
43         licenses = { x.name : x for x in License.query.all() }
44         tags = { x.name : x for x in Tag.query.all() }
45         admin_user = User.query.filter_by(rank=UserRank.ADMIN).first()
46         v4 = MinetestRelease.query.filter_by(protocol=32).first()
47         v50 = MinetestRelease.query.filter_by(protocol=37).first()
48         v51 = MinetestRelease.query.filter_by(protocol=38).first()
49
50         ez = User("Shara")
51         ez.github_username = "Ezhh"
52         ez.forums_username = "Shara"
53         ez.rank = UserRank.EDITOR
54         session.add(ez)
55
56         not1 = Notification(admin_user, ez, "Awards approved", "/packages/rubenwardy/awards/")
57         session.add(not1)
58
59         jeija = User("Jeija")
60         jeija.github_username = "Jeija"
61         jeija.forums_username = "Jeija"
62         session.add(jeija)
63
64
65         mod = Package()
66         mod.state = PackageState.APPROVED
67         mod.name = "alpha"
68         mod.title = "Alpha Test"
69         mod.license = licenses["MIT"]
70         mod.media_license = licenses["MIT"]
71         mod.type = PackageType.MOD
72         mod.author = admin_user
73         mod.tags.append(tags["mapgen"])
74         mod.tags.append(tags["environment"])
75         mod.repo = "https://github.com/ezhh/other_worlds"
76         mod.issueTracker = "https://github.com/ezhh/other_worlds/issues"
77         mod.forums = 16015
78         mod.short_desc = "The content library should not be used yet as it is still in alpha"
79         mod.desc = "This is the long desc"
80         session.add(mod)
81
82         rel = PackageRelease()
83         rel.package = mod
84         rel.title = "v1.0.0"
85         rel.url = "https://github.com/ezhh/handholds/archive/master.zip"
86         rel.approved = True
87         session.add(rel)
88
89         mod1 = Package()
90         mod1.state = PackageState.APPROVED
91         mod1.name = "awards"
92         mod1.title = "Awards"
93         mod1.license = licenses["LGPLv2.1"]
94         mod1.media_license = licenses["MIT"]
95         mod1.type = PackageType.MOD
96         mod1.author = admin_user
97         mod1.tags.append(tags["player_effects"])
98         mod1.repo = "https://github.com/rubenwardy/awards"
99         mod1.issueTracker = "https://github.com/rubenwardy/awards/issues"
100         mod1.forums = 4870
101         mod1.short_desc = "Adds achievements and an API to register new ones."
102         mod1.desc = """
103 Majority of awards are back ported from Calinou's old fork in Carbone, under same license.
104
105 ```
106 awards.register_achievement("award_mesefind",{
107     title = "First Mese Find",
108     description = "Found some Mese!",
109     trigger = {
110         type   = "dig",          -- award is given when
111         node   = "default:mese", -- this type of node has been dug
112         target = 1,              -- this number of times
113     },
114 })
115 ```
116 """
117
118         rel = PackageRelease()
119         rel.package = mod1
120         rel.min_rel = v51
121         rel.title = "v1.0.0"
122         rel.url = "https://github.com/rubenwardy/awards/archive/master.zip"
123         rel.approved = True
124         session.add(rel)
125
126         mod2 = Package()
127         mod2.state = PackageState.APPROVED
128         mod2.name = "mesecons"
129         mod2.title = "Mesecons"
130         mod2.tags.append(tags["tools"])
131         mod2.type = PackageType.MOD
132         mod2.license = licenses["LGPLv3"]
133         mod2.media_license = licenses["MIT"]
134         mod2.author = jeija
135         mod2.repo = "https://github.com/minetest-mods/mesecons/"
136         mod2.issueTracker = "https://github.com/minetest-mods/mesecons/issues"
137         mod2.forums = 628
138         mod2.short_desc = "Mesecons adds everything digital, from all kinds of sensors, switches, solar panels, detectors, pistons, lamps, sound blocks to advanced digital circuitry like logic gates and programmable blocks."
139         mod2.desc = """
140 MESECONS by Jeija and contributors
141
142 Mezzee-what?
143 ------------
144 [Mesecons](http://mesecons.net/)! They're yellow, they're conductive, and they'll add a whole new dimension to Minetest's gameplay.
145
146 Mesecons is a mod for [Minetest](http://minetest.net/) that implements a ton of items related to digital circuitry, such as wires, buttons, lights, and even programmable controllers. Among other things, there are also pistons, solar panels, pressure plates, and note blocks.
147
148 Mesecons has a similar goal to Redstone in Minecraft, but works in its own way, with different rules and mechanics.
149
150 OK, I want in.
151 --------------
152 Go get it!
153
154 [DOWNLOAD IT NOW](https://github.com/minetest-mods/mesecons/archive/master.zip)
155
156 Now go ahead and install it like any other Minetest mod. Don't know how? Check out [the wonderful page about it](http://wiki.minetest.com/wiki/Mods) over at the Minetest Wiki. For your convenience, here's a quick summary:
157
158 1. If Mesecons is still in a ZIP file, extract the folder inside to somewhere on the computer.
159 2. Make sure that when you open the folder, you can directly find `README.md` in the listing. If you just see another folder, move that folder up one level and delete the old one.
160 3. Open up the Minetest mods folder - usually `/mods/`. If you see the `minetest` or folder inside of that, that is your mod folder instead.
161 4. Copy the Mesecons folder into the mods folder.
162
163 Don't like some parts of Mesecons? Open up the Mesecons folder and delete the subfolder containing the mod you don't want. If you didn't want movestones, for example, all you have to do is delete the `mesecons_movestones` folder and they will no longer be available.
164
165 There are no dependencies - it will work right after installing!
166
167 How do I use this thing?
168 ------------------------
169 How about a [quick overview video](https://www.youtube.com/watch?v=6kmeQj6iW5k)?
170
171 Or maybe a [comprehensive reference](http://mesecons.net/items.html) is your style?
172
173 An overview for the very newest of new beginners? How does [this one](http://uberi.mesecons.net/projects/MeseconsBasics/index.html) look?
174
175 Want to get more into building? Why not check out the [Mesecons Laboratory](http://uberi.mesecons.net/), a website dedicated to advanced Mesecons builders?
176
177 Want to contribute to Mesecons itself? Check out the [source code](https://github.com/minetest-mods/mesecons)!
178
179 Who wrote it anyways?
180 ---------------------
181 These awesome people made Mesecons possible!
182
183 | Contributor     | Contribution                     |
184 | --------------- | -------------------------------- |
185 | Hawk777         | Code for VoxelManip caching      |
186 | Jat15           | Various tweaks.                  |
187 | Jeija           | **Main developer! Everything.**  |
188 | Jordach         | Noteblock sounds.                |
189 | khonkhortistan  | Code, recipes, textures.         |
190 | Kotolegokot     | Nodeboxes for items.             |
191 | minerd247       | Textures.                        |
192 | Nore/Novatux    | Code.                            |
193 | RealBadAngel    | Fixes, improvements.             |
194 | sfan5           | Code, recipes, textures.         |
195 | suzenako        | Piston sounds.                   |
196 | Uberi/Temperest | Code, textures, documentation.   |
197 | VanessaE        | Code, recipes, textures, design. |
198 | Whiskers75      | Logic gates implementation.      |
199
200 There are also a whole bunch of other people helping with everything from code to testing and feedback. Mesecons would also not be possible without their help!
201
202 Alright, how can I use it?
203 --------------------------
204 All textures in this project are licensed under the CC-BY-SA 3.0 (Creative Commons Attribution-ShareAlike 3.0 Generic). That means you can distribute and remix them as much as you want to, under the condition that you give credit to the authors and the project, and that if you remix and release them, they must be under the same or similar license to this one.
205
206 All code in this project is licensed under the LGPL version 3 or later. That means you have unlimited freedom to distribute and modify the work however you see fit, provided that if you decide to distribute it or any modified versions of it, you must also use the same license. The LGPL also grants the additional freedom to write extensions for the software and distribute them without the extensions being subject to the terms of the LGPL, although the software itself retains its license.
207
208 No warranty is provided, express or implied, for any part of the project.
209
210 """
211
212         session.add(mod1)
213         session.add(mod2)
214
215         mod = Package()
216         mod.state = PackageState.APPROVED
217         mod.name = "handholds"
218         mod.title = "Handholds"
219         mod.license = licenses["MIT"]
220         mod.media_license = licenses["MIT"]
221         mod.type = PackageType.MOD
222         mod.author = ez
223         mod.tags.append(tags["player_effects"])
224         mod.repo = "https://github.com/ezhh/handholds"
225         mod.issueTracker = "https://github.com/ezhh/handholds/issues"
226         mod.forums = 17069
227         mod.short_desc = "Adds hand holds and climbing thingies"
228         mod.desc = "This is the long desc"
229         session.add(mod)
230
231         rel = PackageRelease()
232         rel.package = mod
233         rel.title = "v1.0.0"
234         rel.max_rel = v4
235         rel.url = "https://github.com/ezhh/handholds/archive/master.zip"
236         rel.approved = True
237         session.add(rel)
238
239         mod = Package()
240         mod.state = PackageState.APPROVED
241         mod.name = "other_worlds"
242         mod.title = "Other Worlds"
243         mod.license = licenses["MIT"]
244         mod.media_license = licenses["MIT"]
245         mod.type = PackageType.MOD
246         mod.author = ez
247         mod.tags.append(tags["mapgen"])
248         mod.tags.append(tags["environment"])
249         mod.repo = "https://github.com/ezhh/other_worlds"
250         mod.issueTracker = "https://github.com/ezhh/other_worlds/issues"
251         mod.forums = 16015
252         mod.short_desc = "Adds space with asteroids and comets"
253         mod.desc = "This is the long desc"
254         session.add(mod)
255
256         mod = Package()
257         mod.state = PackageState.APPROVED
258         mod.name = "food"
259         mod.title = "Food"
260         mod.license = licenses["LGPLv2.1"]
261         mod.media_license = licenses["MIT"]
262         mod.type = PackageType.MOD
263         mod.author = admin_user
264         mod.tags.append(tags["player_effects"])
265         mod.repo = "https://github.com/rubenwardy/food/"
266         mod.issueTracker = "https://github.com/rubenwardy/food/issues/"
267         mod.forums = 2960
268         mod.short_desc = "Adds lots of food and an API to manage ingredients"
269         mod.desc = "This is the long desc"
270         session.add(mod)
271
272         mod = Package()
273         mod.state = PackageState.APPROVED
274         mod.name = "food_sweet"
275         mod.title = "Sweet Foods"
276         mod.license = licenses["CC0"]
277         mod.media_license = licenses["MIT"]
278         mod.type = PackageType.MOD
279         mod.author = admin_user
280         mod.tags.append(tags["player_effects"])
281         mod.repo = "https://github.com/rubenwardy/food_sweet/"
282         mod.issueTracker = "https://github.com/rubenwardy/food_sweet/issues/"
283         mod.forums = 9039
284         mod.short_desc = "Adds sweet food"
285         mod.desc = "This is the long desc"
286         food_sweet = mod
287         session.add(mod)
288
289         game1 = Package()
290         game1.state = PackageState.APPROVED
291         game1.name = "capturetheflag"
292         game1.title = "Capture The Flag"
293         game1.type = PackageType.GAME
294         game1.license = licenses["LGPLv2.1"]
295         game1.media_license = licenses["MIT"]
296         game1.author = admin_user
297         game1.tags.append(tags["pvp"])
298         game1.tags.append(tags["survival"])
299         game1.tags.append(tags["multiplayer"])
300         game1.repo = "https://github.com/rubenwardy/capturetheflag"
301         game1.issueTracker = "https://github.com/rubenwardy/capturetheflag/issues"
302         game1.forums = 12835
303         game1.short_desc = "Two teams battle to snatch and return the enemy's flag, before the enemy takes their own!"
304         game1.desc = """
305 As seen on the Capture the Flag server (minetest.rubenwardy.com:30000)
306
307 ` `[`javascript:/*--></title></style></textarea></script></xmp><svg/onload='+/"/+/onmouseover=1/+/`](javascript:/*--%3E%3C/title%3E%3C/style%3E%3C/textarea%3E%3C/script%3E%3C/xmp%3E%3Csvg/onload='+/%22/+/onmouseover=1/+/)`[*/[]/+alert(1)//'>`
308
309 <IMG SRC="javascript:alert('XSS');">
310
311 <IMG SRC=javascript:alert(&amp;quot;XSS&amp;quot;)>
312
313 ``<IMG SRC=`javascript:alert("RSnake says, 'XSS'")`>``
314
315 \<a onmouseover="alert(document.cookie)"\>xxs link\</a\>
316
317 \<a onmouseover=alert(document.cookie)\>xxs link\</a\>
318
319 <IMG SRC=javascript:alert(String.fromCharCode(88,83,83))>
320
321 <script>alert("hello");</script>
322
323 <SCRIPT SRC=`[`http://xss.rocks/xss.js></SCRIPT>`](http://xss.rocks/xss.js%3E%3C/SCRIPT%3E)`;`
324
325 `<IMG \"\"\">`
326
327 <SCRIPT>
328
329 alert("XSS")
330
331 </SCRIPT>
332
333 <IMG SRC= onmouseover="alert('xxs')">
334
335 <img src=x onerror="&#0000106&#0000097&#0000118&#0000097&#0000115&#0000099&#0000114&#0000105&#0000112&#0000116&#0000058&#0000097&#0000108&#0000101&#0000114&#0000116&#0000040&#0000039&#0000088&#0000083&#0000083&#0000039&#0000041">
336
337 "\>
338
339 Uses the CTF PvP Engine.
340 """
341
342         session.add(game1)
343
344         rel = PackageRelease()
345         rel.package = game1
346         rel.title = "v1.0.0"
347         rel.url = "https://github.com/rubenwardy/capturetheflag/archive/master.zip"
348         rel.approved = True
349         session.add(rel)
350
351
352         mod = Package()
353         mod.state = PackageState.APPROVED
354         mod.name = "pixelbox"
355         mod.title = "PixelBOX Reloaded"
356         mod.license = licenses["CC0"]
357         mod.media_license = licenses["MIT"]
358         mod.type = PackageType.TXP
359         mod.author = admin_user
360         mod.forums = 14132
361         mod.short_desc = "This is an update of the original PixelBOX texture pack by the brillant artist Gambit"
362         mod.desc = "This is the long desc"
363         session.add(mod)
364
365         rel = PackageRelease()
366         rel.package = mod
367         rel.title = "v1.0.0"
368         rel.url = "http://mamadou3.free.fr/Minetest/PixelBOX.zip"
369         rel.approved = True
370         session.add(rel)
371
372         session.commit()
373
374         metas = {}
375         for package in Package.query.filter_by(type=PackageType.MOD).all():
376                 meta = None
377                 try:
378                         meta = metas[package.name]
379                 except KeyError:
380                         meta = MetaPackage(package.name)
381                         session.add(meta)
382                         metas[package.name] = meta
383                 package.provides.append(meta)
384
385         dep = Dependency(food_sweet, meta=metas["food"])
386         session.add(dep)