summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-12-18 23:14:40 -0300
committerJesusaves <cpntb1@ymail.com>2020-12-18 23:14:40 -0300
commit0933a22a34d26dbe64e20e84e4700807ba7be3a9 (patch)
tree9e61382c172da4b3bd0a69e470547db8df4ff233
downloadupdates-0933a22a34d26dbe64e20e84e4700807ba7be3a9.tar.gz
updates-0933a22a34d26dbe64e20e84e4700807ba7be3a9.tar.bz2
updates-0933a22a34d26dbe64e20e84e4700807ba7be3a9.tar.xz
updates-0933a22a34d26dbe64e20e84e4700807ba7be3a9.zip
Initial commit
-rw-r--r--.gitignore16
-rw-r--r--README14
-rwxr-xr-xcomp.py68
-rw-r--r--raw/ATTRIBUTION.md50
-rw-r--r--raw/bg/battle2.jpgbin0 -> 458612 bytes
-rw-r--r--raw/bg/castle.jpgbin0 -> 574349 bytes
-rw-r--r--raw/bg/tavern.jpgbin0 -> 655315 bytes
7 files changed, 148 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..455e12e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,16 @@
+# Patterns to ignore.
+
+# Binaries
+*.pyc
+resources.json
+
+#Back up
+*.bak
+*~
+
+# Development files
+live
+*.dev.*
+*.dev**
+tba/*
+x*
diff --git a/README b/README
new file mode 100644
index 0000000..adbca68
--- /dev/null
+++ b/README
@@ -0,0 +1,14 @@
+This is the update server. By default, it will output files to:
+/var/www/html/assets
+
+Simply use comp.py and it will convert assets and pretty much handle everything
+for you. Make sure that raw/ folder is consistent with the same rules which builtin
+assets follow regarding paths.
+
+This is a development tool for optimization and not required for your server.
+It **only** works in Debian Buster and other systems similar to this one, like
+Ubuntu 18.04.
+You can use, eg. GitLab Pages to serve the files and make a 301 on main server, or
+simply not use the tool at all.
+
+The choice is yours.
diff --git a/comp.py b/comp.py
new file mode 100755
index 0000000..97ec03a
--- /dev/null
+++ b/comp.py
@@ -0,0 +1,68 @@
+#!/usr/bin/python2.7
+########################################################################################
+# This file is part of Spheres.
+# Copyright (C) 2019 Jesusalva
+
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+########################################################################################
+# This builds live/ folder for Update Server
+import subprocess, json, sys, os, traceback
+PATH="/var/www/html/assets"
+
+# Delete previous deployment
+subprocess.call("rm --recursive %s/*" % PATH, shell=True)
+f=open("resources.json", "w")
+
+rc=[]
+
+# Go through every file in raw and give them a hash
+for path, subdir, files in os.walk("raw/"):
+ for n in files:
+ fn=os.path.join(path, n)
+
+ # Ignored files
+ if fn.endswith("~"):
+ continue
+
+ # Copy and update resource table
+ print(fn)
+ try:
+ NAME=fn.replace("raw/", "").replace("/", "_")
+ EXT=NAME.split(".")[-1:][0]
+ NAME=NAME.split(".")[:-1][0]
+ ## TODO code
+ if EXT in ["png", "jpg", "jpeg"]:
+ subprocess.call("convert %s %s/%s" % (fn, PATH, NAME), shell=True)
+ EXT="webp"
+ else:
+ subprocess.call("cp %s %s/%s.%s" % (fn, PATH, NAME, EXT), shell=True)
+ rc.append([NAME, EXT])
+ except:
+ traceback.print_exc()
+ pass
+
+# Save new summary
+json.dump(rc, f)
+f.close()
+
+# Create blank index page to disable dir listing
+subprocess.call("touch %s/index.html" % PATH, shell=True)
+
+# Correct permissions
+subprocess.call("chown -R www-data:www-data %s/*" % PATH, shell=True)
+subprocess.call("chmod --recursive o-rwx %s/*" % PATH, shell=True)
+
+# TODO: zip everything and provide an all-in-one download?
+
diff --git a/raw/ATTRIBUTION.md b/raw/ATTRIBUTION.md
new file mode 100644
index 0000000..1cd4b72
--- /dev/null
+++ b/raw/ATTRIBUTION.md
@@ -0,0 +1,50 @@
+For DMCA complaints please email dmca@tmw2.org and we will try to correct it
+within 30 (thirty) days.
+
+This special license file covers assets only, for code, you must refer to their
+headers and to the COPYING file.
+
+Notes: Works submitted by Jesusalva and under CC0, may also be used as if they
+were under the Apache license without the need of prior consent.
+
+----
+
+GPLv2: Licensed under GNU General Public License version2 or later.
+http://www.gnu.org/licenses/gpl-2.0.html
+See also the GPL file.
+
+GPLv3: Licensed under GNU General Public License version3 or later.
+http://www.gnu.org/licenses/gpl-3.0.html
+See also the COPYING
+
+CC BY-SA 4.0: Licensed under Creative Commons Attribution-ShareAlike 4.0 Unported.
+http://creativecommons.org/licenses/by-sa/4.0/
+See also the CC BY-SA 4.0 file.
+
+CC0 : Licensed under Creative Commons Zero
+http://creativecommons.org/licenses/cc0
+Also known as “Public Domain Dedication”
+
+MIT : Licensed under the MIT License.
+https://opensource.org/licenses/MIT
+See also MIT file.
+
+This copyright notice must be kept intact for use, according to CC BY-SA
+compatibility terms.
+Where relevant, you must also include a link to https://tmw2.org in your credit.
+
+---------------------------------------------------------------------------------
+# Folder
+ path/to/the/licensed/work.something (Author) (License) (Notes/Contributors/Authors/Co-Authors/Sources/etc.)
+
+# BG
+ bg/battle2.jpg (Écrivain) (CC0) (OpenGameArt)
+ bg/castle.jpg (yd) (CC0) (OpenGameArt)
+ bg/tavern.jpg (?) (CC0) (Bridge to Hrad Valdštejn - edit by Jesusalva)
+
+
+
+
+
+
+
diff --git a/raw/bg/battle2.jpg b/raw/bg/battle2.jpg
new file mode 100644
index 0000000..9c6cb8d
--- /dev/null
+++ b/raw/bg/battle2.jpg
Binary files differ
diff --git a/raw/bg/castle.jpg b/raw/bg/castle.jpg
new file mode 100644
index 0000000..5298e38
--- /dev/null
+++ b/raw/bg/castle.jpg
Binary files differ
diff --git a/raw/bg/tavern.jpg b/raw/bg/tavern.jpg
new file mode 100644
index 0000000..a520eb5
--- /dev/null
+++ b/raw/bg/tavern.jpg
Binary files differ