diff --git a/README.md b/README.md index 22b448bb..d48486e7 100644 --- a/README.md +++ b/README.md @@ -1270,7 +1270,7 @@ authenticate using header `Cookie: cppwd=foo` or url param `&pw=foo` | GET | `?ups` | show recent uploads from your IP | | GET | `?ups&filter=f` | ...where URL contains `f` | | GET | `?mime=foo` | specify return mimetype `foo` | -| GET | `?raw` | get markdown file at URL as plaintext | +| GET | `?v` | render markdown file at URL | | GET | `?txt` | get file at URL as plaintext | | GET | `?txt=iso-8859-1` | ...with specific charset | | GET | `?th` | get image/video at URL as thumbnail | diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 4225d2a9..93286aae 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -374,7 +374,6 @@ class HttpCli(object): self.out_headerlist.append(("Set-Cookie", self.get_pwd_cookie(self.pw)[0])) if self.is_rclone: - uparam["raw"] = "" uparam["dots"] = "" uparam["b"] = "" cookies["b"] = "" @@ -2968,7 +2967,7 @@ class HttpCli(object): self.log("wrong filekey, want {}, got {}".format(correct, got)) return self.tx_404() - if abspath.endswith(".md") and "raw" not in self.uparam: + if abspath.endswith(".md") and "v" in self.uparam: return self.tx_md(abspath) return self.tx_file(abspath) diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 8a0b12cf..346ad9c9 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -3446,7 +3446,7 @@ var showfile = (function () { xhr.fname = uricom_dec(url.split('/').pop()); xhr.no_push = no_push; xhr.ts = Date.now(); - xhr.open('GET', url.split('?')[0] + '?raw', true); + xhr.open('GET', url.split('?')[0], true); xhr.onprogress = loading; xhr.onload = xhr.onerror = load_cb; xhr.send(); @@ -5181,8 +5181,11 @@ var treectl = (function () { id += 'a'; seen[id] = 1; - if (lang) + if (lang) { showfile.files.push({ 'id': id, 'name': fname }); + if (lang == 'md') + tn.href += tn.href.indexOf('?') < 0 ? '?v' : '&v'; + } if (tn.lead == '-') tn.lead = 'edit (basic) edit (fancy) - view raw + view raw {%- endif %}
diff --git a/copyparty/web/md2.js b/copyparty/web/md2.js index abc26c77..61ca94eb 100644 --- a/copyparty/web/md2.js +++ b/copyparty/web/md2.js @@ -253,7 +253,7 @@ function Modpoll() { } console.log('modpoll...'); - var url = (document.location + '').split('?')[0] + '?raw&_=' + Date.now(); + var url = (document.location + '').split('?')[0] + '?_=' + Date.now(); var xhr = new XHR(); xhr.open('GET', url, true); xhr.responseType = 'text'; @@ -389,7 +389,7 @@ function save_cb() { function run_savechk(lastmod, txt, btn, ntry) { // download the saved doc from the server and compare - var url = (document.location + '').split('?')[0] + '?raw&_=' + Date.now(); + var url = (document.location + '').split('?')[0] + '?_=' + Date.now(); var xhr = new XHR(); xhr.open('GET', url, true); xhr.responseType = 'text'; diff --git a/copyparty/web/mde.js b/copyparty/web/mde.js index c72cf985..7d882f20 100644 --- a/copyparty/web/mde.js +++ b/copyparty/web/mde.js @@ -166,7 +166,7 @@ function save_cb() { //alert('save OK -- wrote ' + r.size + ' bytes.\n\nsha512: ' + r.sha512); // download the saved doc from the server and compare - var url = (document.location + '').split('?')[0] + '?raw'; + var url = (document.location + '').split('?')[0] + '?_=' + Date.now(); var xhr = new XHR(); xhr.open('GET', url, true); xhr.responseType = 'text'; diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index b6a4a701..2977b425 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -2092,7 +2092,7 @@ function up2k_init(subtle) { try { orz(e); } catch (ex) { vis_exh(ex + '', 'up2k.js', '', '', ex); } }; - xhr.open('HEAD', t.purl + uricom_enc(t.name) + '?raw', true); + xhr.open('HEAD', t.purl + uricom_enc(t.name), true); xhr.send(); }