pull/109/head
midoks 3 years ago
parent 0ba2a71e3c
commit 6a90b3b3ef
  1. 3
      plugins/varnish/index.html
  2. 25
      plugins/varnish/index.py
  3. 9
      plugins/varnish/js/varnish.js
  4. 40
      plugins/varnish/tpl/default.vcl

@ -13,5 +13,8 @@
</div>
</div>
<script type="text/javascript">
$.getScript( "/plugins/file?name=sys-opt&f=js/varnish.js",
function() {
pluginService('varnish');
});
</script>

@ -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')

@ -0,0 +1,9 @@
function pRead(){
var readme = '<ul class="help-info-text c7">';
readme += '<li>修改后,点击重启按钮</li>';
readme += '</ul>';
$('.soft-man-con').html(readme);
}

@ -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.
}
Loading…
Cancel
Save