Ejemplo n.º 1
0
 def POST(self):
     get = web.input(backupfile={}, data=[])
     if not public.checkToken(get):
         return public.returnJson(False, '无效的Token!')
     if not self.CheckPlugin(get.name):
         return public.returnJson(False, '您没有权限访问当前插件!')
     return self.funObj()
Ejemplo n.º 2
0
    def GET(self):
        get = web.input()
        if not public.checkToken(get): get.filename = str(time.time())
        try:
            get.filename = '/www/server/panel/plugin/psync/backup/' + get.filename.encode(
                'utf-8')
            import os
            fp = open(get.filename, 'rb')
            size = os.path.getsize(get.filename)
            filename = os.path.basename(get.filename)

            #输出文件头
            web.header("Content-Disposition",
                       "attachment; filename=" + filename)
            web.header("Content-Length", size)
            web.header('Content-Type', 'application/octet-stream')
            buff = 4096
            while True:
                fBody = fp.read(buff)
                if fBody:
                    yield fBody
                else:
                    return
        except Exception, e:
            yield 'Error'
Ejemplo n.º 3
0
 def GET(self):
     get = web.input()
     if not public.checkToken(get):
         return public.returnJson(False, '无效的Token!')
     if not self.CheckPlugin(get.name):
         return public.returnJson(False, '您没有权限访问当前插件!')
     return self.funObj()
Ejemplo n.º 4
0
def panel_downloadApi():
    get = get_input()
    if not public.checkToken(get): get.filename = str(time.time())
    filename = 'plugin/psync/backup/' + get.filename.encode('utf-8')
    mimetype = 'application/octet-stream'
    return send_file(filename,
                     mimetype=mimetype,
                     as_attachment=True,
                     attachment_filename=os.path.basename(filename))
Ejemplo n.º 5
0
def panel_pluginApi():
    get = get_input()
    if not public.checkToken(get): return public.returnJson(False,'INIT_TOKEN_ERR');
    infoFile = 'plugin/' + get.name + '/info.json';
    if not os.path.exists(infoFile): return False;
    import json
    info = json.loads(public.readFile(infoFile));
    if not info['api']:  return public.returnJson(False,'INIT_PLU_ACC_ERR');

    import panelPlugin
    pluginObject = panelPlugin.panelPlugin()
    
    defs = ('install','unInstall','getPluginList','getPluginInfo','getPluginStatus','setPluginStatus','a','getCloudPlugin','getConfigHtml','savePluginSort')
    return publicObject(pluginObject,defs);
Ejemplo n.º 6
0
 def GET(self):
     get = web.input()
     if not public.checkToken(get): get.filename = str(time.time());
     try:
         get.filename = '/www/server/panel/plugin/psync/backup/' + get.filename.encode('utf-8');
         import os
         fp = open(get.filename,'rb')
         size = os.path.getsize(get.filename)
         filename = os.path.basename(get.filename)
         
         #输出文件头
         web.header("Content-Disposition", "attachment; filename=" + filename);
         web.header("Content-Length", size);
         web.header('Content-Type','application/octet-stream')
         buff = 4096
         while True:
             fBody = fp.read(buff)
             if fBody:
                 yield fBody
             else:
                 return
     except Exception, e:
         yield 'Error'
Ejemplo n.º 7
0
 def POST(self):
     get = web.input(backupfile={},data=[]);
     if not public.checkToken(get): return public.returnJson(False,'无效的Token!');
     if not self.CheckPlugin(get.name): return public.returnJson(False,'您没有权限访问当前插件!');
     return self.funObj();
Ejemplo n.º 8
0
 def GET(self):
     get = web.input();
     if not public.checkToken(get): return public.returnJson(False,'无效的Token!');
     if not self.CheckPlugin(get.name): return public.returnJson(False,'您没有权限访问当前插件!');
     return self.funObj();