| 1148 | @flag.admin |
| 1149 | @flag.no_multiuser |
| 1150 | def actionServerShowdirectory(self, to, directory="backup", inner_path=""): |
| 1151 | if self.request.env["REMOTE_ADDR"] != "127.0.0.1": |
| 1152 | return self.response(to, {"error": "Only clients from 127.0.0.1 allowed to run this command"}) |
| 1153 | |
| 1154 | import webbrowser |
| 1155 | if directory == "backup": |
| 1156 | path = os.path.abspath(config.data_dir) |
| 1157 | elif directory == "log": |
| 1158 | path = os.path.abspath(config.log_dir) |
| 1159 | elif directory == "site": |
| 1160 | path = os.path.abspath(self.site.storage.getPath(helper.getDirname(inner_path))) |
| 1161 | |
| 1162 | if os.path.isdir(path): |
| 1163 | self.log.debug("Opening: %s" % path) |
| 1164 | webbrowser.open('file://' + path) |
| 1165 | return self.response(to, "ok") |
| 1166 | else: |
| 1167 | return self.response(to, {"error": "Not a directory"}) |
| 1168 | |
| 1169 | @flag.admin |
| 1170 | @flag.no_multiuser |