aboutsummaryrefslogtreecommitdiff
path: root/.gitignore
blob: 35d50b35af2b35d22659ac20d591be08ced1ffa5 (plain)
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
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highl
*.eps
*.go
*.log
*.pdf
*.png
*.tar.xz
*.tmp
*~
.#*
\#*\#
,*
/ABOUT-NLS
/INSTALL
/aclocal.m4
/autom4te.cache
/build-aux/ar-lib
/build-aux/compile
/build-aux/config.guess
/build-aux/config.rpath
/build-aux/config.sub
/build-aux/depcomp
/build-aux/install-sh
/build-aux/mdate-sh
/build-aux/missing
/build-aux/test-driver
/build-aux/texinfo.tex
/config.status
/configure
/doc/*.1
/doc/.dirstamp
/doc/guix.*.aux
/doc/guix.*.cp
/doc/guix.*.cps
/doc/guix.*.fn
/doc/guix.*.fns
/doc/guix.*.html
/doc/guix.*.info
/doc/guix.*.info-[0-9]
/doc/guix.*.ky
/doc/guix.*.pg
/doc/guix.*.toc
/doc/guix.*.t2p
/doc/guix.*.tp
/doc/guix.*.vr
/doc/guix.*.vrs
/doc/guix.aux
/doc/guix.cp
/doc/guix.cps
/doc/guix.fn
/doc/guix.fns
/doc/guix.html
/doc/guix.info
/doc/guix.info-[0-9]
/doc/guix.ky
/doc/guix.pg
/doc/guix.toc
/doc/guix.t2p
/doc/guix.tp
/doc/guix.vr
/doc/guix.vrs
/doc/os-config-bare-bones.texi
/doc/os-config-desktop.texi
/doc/stamp-vti
/doc/version.texi
/doc/version-*.texi
/etc/guix-daemon.cil
/etc/guix-daemon.conf
/etc/guix-daemon.service
/etc/guix-publish.conf
/etc/guix-publish.service
/guix-daemon
/guix/config.scm
/libformat.a
/libstore.a
/libutil.a
/m4/*
/m4/ChangeLog
/m4/gettext.m4
/m4/iconv.m4
/m4/lib-ld.m4
/m4/lib-link.m4
/m4/lib-prefix.m4
/m4/nls.m4
/m4/po.m4
/m4/progtest.m4
/nix-setuid-helper
/nix/AUTHORS
/nix/COPYING
/nix/config.h
/nix/config.h.in
/nix/nix-daemon/nix-daemon.cc
/nix/nix-setuid-helper/nix-setuid-helper.cc
/nix/scripts/guix-authenticate
/nix/scripts/list-runtime-roots
/nix/scripts/offload
/nix/scripts/substitute
/po/doc/*.mo
/po/guix/*.gmo
/po/guix/*.insert-header
/po/guix/*.mo
/po/guix/ChangeLog
/po/guix/Makefile.in.in
/po/guix/Makevars.template
/po/guix/POTFILES
/po/guix/Rules-quot
/po/guix/boldquot.sed
/po/guix/en@boldquot.*
/po/guix/en@quot.*
/po/guix/guix.pot
/po/guix/insert-header.sin
/po/guix/quot.sed
/po/guix/remove-potcdate.sed
/po/guix/remove-potcdate.sin
/po/guix/stamp-po
/po/packages/*.gmo
/po/packages/*.insert-header
/po/packages/*.mo
/po/packages/ChangeLog
/po/packages/Makefile.in.in
/po/packages/Makevars.template
/po/packages/POTFILES
/po/packages/Rules-quot
/po/packages/boldquot.sed
/po/packages/en@boldquot.*
/po/packages/en@quot.*
/po/packages/guix-packages.pot
/po/packages/insert-header.sin
/po/packages/quot.sed
/po/packages/remove-potcdate.sed
/po/packages/remove-potcdate.sin
/po/packages/stamp-po
/pre-inst-env
/scripts/guix
/test-env
/test-tmp
/tests/*.trs
GPATH
GRTAGS
GTAGS
Makefile
Makefile.in
config.cache
stamp-h[0-9]
tmp
/doc/os-config-lightweight-desktop.texi
/nix/scripts/download
/etc/indent-code.el
/.version
/doc/stamp-[0-9]

© 2015 - 2026 Jakob L. Kreuze

ss="k">if check_password != new_password: raise errors.ValidationError("Passwords do not match") userfuncs.update_user_password(user, new_password) db.get_session().commit() print("Sucessfully changed password for '%s'" % user.name) def check_audio() -> None: post_list = ( db.session.query(model.Post) .filter(model.Post.type == model.Post.TYPE_VIDEO) .order_by(model.Post.post_id) .all() ) for post in post_list: print("Checking post %d ..." % post.post_id, end="\r", file=stderr) content = files.get(postfuncs.get_post_content_path(post)) has_existing_flag = model.Post.FLAG_SOUND in post.flags try: has_sound_data = images.Image(content).check_for_sound() except errors.ProcessingError: print( "Post %d caused an error when checking for sound" % post.post_id ) if has_sound_data and not has_existing_flag: print("Post %d has sound data but is not flagged" % post.post_id) if not has_sound_data and has_existing_flag: print("Post %d has no sound data but is flagged" % post.post_id) def reset_filenames() -> None: regex = re.compile(r"(\d+)_[0-9a-f]{16}\.(\S+)") def convert_to_new_filename(old_name: str) -> str: matches = regex.match(old_name) if not matches: return None post_id = int(matches.group(1)) post_ext = matches.group(2) return "%d_%s.%s" % ( post_id, postfuncs.get_post_security_hash(post_id), post_ext, ) def rename_in_dir(dir: str) -> None: for old_path in os.listdir(config.config["data_dir"] + dir): new_path = convert_to_new_filename(old_path) if not new_path: continue if old_path != new_path: print("%s -> %s" % (dir + old_path, dir + new_path)) os.rename( config.config["data_dir"] + dir + old_path, config.config["data_dir"] + dir + new_path, ) rename_in_dir("posts/") rename_in_dir("generated-thumbnails/") rename_in_dir("posts/custom-thumbnails/") def main() -> None: parser_top = ArgumentParser( description="Collection of CLI commands for an administrator to use", epilog="Look at README.md for more info", ) parser = parser_top.add_mutually_exclusive_group(required=True) parser.add_argument( "--change-password", metavar="<username>", help="change the password of specified user", ) parser.add_argument( "--check-all-audio", action="store_true", help="check the audio flags of all posts, " "noting discrepancies, without modifying posts", ) parser.add_argument( "--reset-filenames", action="store_true", help="reset and rename the content and thumbnail " "filenames in case of a lost/changed secret key", ) command = parser_top.parse_args() try: if command.change_password: reset_password(command.change_password) elif command.check_all_audio: check_audio() elif command.reset_filenames: reset_filenames() except errors.BaseError as e: print(e, file=stderr) if __name__ == "__main__": main()

© 2015 - 2026 Jakob L. Kreuze