diff --git a/SuperScriptViewer/ServerCore.py b/SuperScriptViewer/ServerCore.py index c183166..37953af 100644 --- a/SuperScriptViewer/ServerCore.py +++ b/SuperScriptViewer/ServerCore.py @@ -4,6 +4,7 @@ from flask import render_template from flask import url_for from flask import request from flask import abort +from flask import redirect from functools import reduce import sqlite3 @@ -12,6 +13,7 @@ import ServerStruct as ss app = Flask(__name__) +# =============================================database def get_db(): db = getattr(g, '_database', None) if db is None: @@ -24,6 +26,7 @@ def close_connection(exception): if db is not None: db.close() +# =============================================template func @app.template_global(name = 'pinDecoder') def block_pin_decoder(target): return json.loads(target) @@ -33,7 +36,20 @@ def block_pin_decoder2(target): vab = json.loads(target) return [vab['name'], vab['type']] +# =============================================route @app.route('/', methods=['GET']) +def nospecHandle(): + return redirect(url_for('indexHandle')) + +@app.route('/help', methods=['GET']) +def helpHandle(): + return render_template("help.html") + +@app.route('/about', methods=['GET']) +def aboutHandle(): + return render_template("about.html") + +@app.route('/index', methods=['GET']) def indexHandle(): cur = get_db().cursor() cur.execute("SELECT [graph], [graph_name], [belong_to] FROM graph WHERE [index] != -1 ORDER BY [belong_to], [index] ASC;") @@ -46,11 +62,8 @@ def indexHandle(): return render_template('index.html', scripts = data) -@app.route('/', methods=['GET']) -def scriptHandle(scriptPath): - # fuck favition.ico - if '.' in scriptPath: - abort(404) +@app.route('/viewer/', methods=['GET']) +def viewerHandle(scriptPath): # comput hamburger pathSlice = scriptPath.split('/') @@ -96,8 +109,8 @@ def scriptHandle(scriptPath): cells = dbCells, links = dbLinks) -@app.route('/', methods=['POST']) -def infoMoveHandle(scriptPath): +@app.route('/viewer/', methods=['POST']) +def actionHandle(scriptPath): cache = request.form['operation'] if cache == "info": return infoHandle(request.form['target']) diff --git a/SuperScriptViewer/static/site.js b/SuperScriptViewer/static/site.js index 61840c1..c201b66 100644 --- a/SuperScriptViewer/static/site.js +++ b/SuperScriptViewer/static/site.js @@ -1,11 +1,59 @@ -previousHighlight = ""; +//=======================================settings +currentSettings = { + "plink": true, + "properties": true, + "highlight": true, + "keyboard": true, + "move": true +}; +$(document).ready(function () { + //read settings and apply it + for (var key in currentSettings) { + currentSettings[key] = localstorageAssist_Get("ssm-settings-" + key, "true") == "true"; + if (currentSettings[key]) $("#sidepanel-display-" + key).prop("checked", true); + else $("#sidepanel-display-" + key).removeProp("checked"); + } + //additional settings + if (!currentSettings["plink"]) { + $(".link-elink").hide(); + $(".link-plink").hide(); + } +}); +function settingChange(target) { + newValue = $("#sidepanel-display-" + target).prop("checked"); + currentSettings[target] = newValue; + localstorageAssist_Set("ssm-settings-" + target, newValue); + if (target == "plink") { + if (currentSettings["plink"]) { + $(".link-elink").show(); + $(".link-plink").show(); + } else { + $(".link-elink").hide(); + $(".link-plink").hide(); + } + } +} +function localstorageAssist_Get(index, defaultValue) { + var cache = localStorage.getItem(index); + if (cache == null) { + localstorageAssist_Set(index, defaultValue); + return defaultValue; + } else return cache; +} +function localstorageAssist_Set(index, value) { + localStorage.setItem(index, value); +} + + +//=======================================internal event +previousHighlight = ""; function highlightLink(target) { realTarget = ".target" + target if (previousHighlight != "") { //need restore - $(previousHighlight).each(function() { + $(previousHighlight).each(function () { if ($(this).hasClass("link-blink")) { $(this).attr("stroke", "black") } @@ -26,7 +74,7 @@ function highlightLink(target) { previousHighlight = ""; } else { //apply new highlight - $(realTarget).each(function() { + $(realTarget).each(function () { if ($(this).hasClass("link-blink")) { $(this).attr("stroke", "yellow") } @@ -54,14 +102,14 @@ function queryInfo(obj) { operation: "info", target: obj }, - function(data, status) { + function (data, status) { //set id $("#sidepanel-properties-id").text(obj); //set data $("#sidepanel-properties-container").empty() for (var key in data) { - $("#sidepanel-properties-container").append("

" + key + ":

" + data[key] +"

") + $("#sidepanel-properties-container").append("

" + key + ":

" + data[key] + "

") } }); } @@ -72,26 +120,26 @@ function sidePanelSwitcher(target) { $("#sidepanel-properties").hide(); $("#sidepanel-display").hide(); $("#sidepanel-tools").hide(); - $(".tabitem").each(function() { + $(".tabitem").each(function () { $(this).removeClass("tabitem-activated").addClass("tabitem-deactivated"); }); switch (target) { case 0: $("#sidepanel-properties").show(); - $(".tabitem1").each(function() { + $(".tabitem1").each(function () { $(this).removeClass("tabitem-deactivated").addClass("tabitem-activated"); }); break; case 1: $("#sidepanel-display").show(); - $(".tabitem2").each(function() { + $(".tabitem2").each(function () { $(this).removeClass("tabitem-deactivated").addClass("tabitem-activated"); }); break; case 2: $("#sidepanel-tools").show(); - $(".tabitem3").each(function() { + $(".tabitem3").each(function () { $(this).removeClass("tabitem-deactivated").addClass("tabitem-activated"); }); break; diff --git a/SuperScriptViewer/templates/about.html b/SuperScriptViewer/templates/about.html new file mode 100644 index 0000000..c73a03d --- /dev/null +++ b/SuperScriptViewer/templates/about.html @@ -0,0 +1,21 @@ + + + + + + About Super Script Materializer + + + +

Super Script Materializer

+

There are no secret script behind Virtools. Super Script Materializer will destroy all locks and show you the real code.
+But Super Script Materializer only show you code. It couldn't analyse the result and touch author's heart and intention. This is your work.
+This also is the meaning of this app's icon.

+
+

SuperScriptMaterializer. All codes are under GPLv3.
+Web interface is powered by Flask.
+Ancestor projects: BearKidsTeam/VirtoolsScriptDeobfuscation and BearKidsTeam/Script-Materializer.
+Thank chirs241097 and 2jjy.

+ + + \ No newline at end of file diff --git a/SuperScriptViewer/templates/index.html b/SuperScriptViewer/templates/index.html index b190f74..92ecbc5 100644 --- a/SuperScriptViewer/templates/index.html +++ b/SuperScriptViewer/templates/index.html @@ -15,16 +15,18 @@

{{ key|e }}

    {% for i in value %} -
  1. {{ i.name }}
  2. +
  3. {{ i.name }}
  4. {% endfor %}
{% endfor %}

-

Generated by SuperScriptMaterializer. All codes are under GPLv3.
-Powered by Flask.
-Ancestor projects: BearKidsTeam/VirtoolsScriptDeobfuscation and BearKidsTeam/Script-Materializer.
-Thank chirs241097 and 2jjy.

+

Generated by SuperScriptMaterializer

+
+

Help

+

|

+

About

+
\ No newline at end of file diff --git a/SuperScriptViewer/templates/viewer.html b/SuperScriptViewer/templates/viewer.html index 9f4a43e..4f9152e 100644 --- a/SuperScriptViewer/templates/viewer.html +++ b/SuperScriptViewer/templates/viewer.html @@ -13,11 +13,11 @@
-

Script Hierarchy

+

Script Hierarchy

{% for i in hamburgerHistory %}

>>

-

{{ i.name|e }}

+

{{ i.name|e }}

{% endfor %}

>>

@@ -47,7 +47,7 @@ {% endfor %} {% if i[13] != -1 %} -

{{ i[2]|e }}

+

{{ i[2]|e }}

{% else %}

{{ i[2]|e }}

{% endif %} @@ -94,12 +94,13 @@ @@ -109,8 +110,8 @@

Misc:
-
- +
+