diff --git a/config.py.example b/config.py.example index 65e3a41..5e3d504 100644 --- a/config.py.example +++ b/config.py.example @@ -10,7 +10,7 @@ hidedst = 'data/hidedst' # dir to store indicies for hidden files guardsecs = 60 # guard time to prevent indexing during file uploading url = 'https://my.site/files' # external url -hideurl = 'https://my.site/private' # external url for hidden area +hideurl = 'https://my.site/private' # external url for hidden area (can be none) thumbw = 120 # thumbnail width thumbh = 90 # thumbnail height diff --git a/indexer.py b/indexer.py index d04ebed..99872ca 100755 --- a/indexer.py +++ b/indexer.py @@ -1,13 +1,21 @@ #!/usr/bin/python3 -# path.thumb.png - user thumb for 'path' -# path/.thumb.png - user thumb for 'path' -# path/.thumb..png - default thumb for unknown extension -# path/.thumb...png - default thumb for subdirectories -# path/.thumb.ext.png - default thumb for 'ext' -# path/.thumb/.png - default thumb for unknown extension -# path/.thumb/..png - default thumb for subdirectories -# path/.thumb/ext.png - default thumb for 'ext' +# to forece reindex pass a single argument: +# force + +# to 'hide' files +# NB: file still will be accessible for ALL who know a mangled url +# place file into '.hide' subdirectory + +# to set user thumbs: +# path.thumb.png - user thumb for 'path' +# path/.thumb.png - user thumb for 'path' +# path/.thumb..png - default thumb for unknown extension +# path/.thumb...png - default thumb for subdirectories +# path/.thumb.ext.png - default thumb for 'ext' +# path/.thumb/.png - default thumb for unknown extension +# path/.thumb/..png - default thumb for subdirectories +# path/.thumb/ext.png - default thumb for 'ext' import os @@ -135,6 +143,7 @@ class Node: if not self.hide: link(self.src, join(config.dst, self.path)) def makethumb(self): + if self.hide and not config.hidedst: return ts = None td = None dst = config.hidedst if self.hide else config.dst @@ -206,7 +215,7 @@ class Node: with open(touch(fn), 'w') as f: tpl.write(f, r) def makehideindex(self, bydate): - if not self.isdir: return + if not self.isdir or not config.hidedst: return fn = join(config.hidedst, self.path, ('indexd.html' if bydate else 'index.html')) if not force and isfile(fn) and os.path.getmtime(fn) > self.date: touch(fn, False); return r = self.makeinfoex(bydate) @@ -239,7 +248,7 @@ if time.time() - n.date <= config.guardsecs: n.make() clean(config.dst) -clean(config.hidedst) +if config.hidedst: clean(config.hidedst) #print('done') diff --git a/readme b/readme new file mode 100644 index 0000000..479eb9f --- /dev/null +++ b/readme @@ -0,0 +1 @@ +content of this repository is a public domain \ No newline at end of file