diff --git a/plugins/varnish/index.html b/plugins/varnish/index.html index 283ef2387..cc3cea069 100755 --- a/plugins/varnish/index.html +++ b/plugins/varnish/index.html @@ -13,5 +13,8 @@ \ No newline at end of file diff --git a/plugins/varnish/index.py b/plugins/varnish/index.py index 6313471a8..096342e7c 100755 --- a/plugins/varnish/index.py +++ b/plugins/varnish/index.py @@ -133,6 +133,27 @@ def runInfo(): return mw.getJson(result) +def configTpl(): + path = getPluginDir() + '/tpl' + pathFile = os.listdir(path) + tmp = [] + for one in pathFile: + file = path + '/' + one + tmp.append(file) + return mw.getJson(tmp) + + +def readConfigTpl(): + args = getArgs() + data = checkArgs(args, ['file']) + if not data[0]: + return data[1] + + content = mw.readFile(args['file']) + content = contentReplace(content) + return mw.returnJson(True, 'ok', content) + + def initdStatus(): if not app_debug: if mw.isAppleSystem(): @@ -192,5 +213,9 @@ if __name__ == "__main__": print(getConf()) elif func == 'run_log': print(runLog()) + elif func == 'config_tpl': + print(configTpl()) + elif func == 'read_config_tpl': + print(readConfigTpl()) else: print('error') diff --git a/plugins/varnish/js/varnish.js b/plugins/varnish/js/varnish.js new file mode 100644 index 000000000..b582d21a6 --- /dev/null +++ b/plugins/varnish/js/varnish.js @@ -0,0 +1,9 @@ + + +function pRead(){ + var readme = ''; + + $('.soft-man-con').html(readme); +} \ No newline at end of file diff --git a/plugins/varnish/tpl/default.vcl b/plugins/varnish/tpl/default.vcl new file mode 100755 index 000000000..8302c260f --- /dev/null +++ b/plugins/varnish/tpl/default.vcl @@ -0,0 +1,40 @@ +# +# This is an example VCL file for Varnish. +# +# It does not do anything by default, delegating control to the +# builtin VCL. The builtin VCL is called when there is no explicit +# return statement. +# +# See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/ +# and https://www.varnish-cache.org/trac/wiki/VCLExamples for more examples. + +# Marker to tell the VCL compiler that this VCL has been adapted to the +# new 4.0 format. +vcl 4.0; + +# Default backend definition. Set this to point to your content server. +backend default { + .host = "127.0.0.1"; + .port = "8080"; +} + +sub vcl_recv { + # Happens before we check if we have this in cache already. + # + # Typically you clean up the request here, removing cookies you don't need, + # rewriting the request, etc. +} + +sub vcl_backend_response { + # Happens after we have read the response headers from the backend. + # + # Here you clean the response headers, removing silly Set-Cookie headers + # and other mistakes your backend does. +} + +sub vcl_deliver { + # Happens when we have all the pieces we need, and are about to send the + # response to the client. + # + # You can do accounting or modifying the final object here. +}