mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2025-11-01 10:56:31 +08:00
whenever embedding something with a locale setup, it would crash while trying to download the translation. This was due to some missunderstanding of how fetch work while in an iframe and all the reports would get miss because of that same issue as it was sent not to the origin server but the website embedding the frame
16 lines
657 B
JavaScript
16 lines
657 B
JavaScript
import { toHref } from "../lib/skeleton/router.js";
|
|
import ajax from "../lib/ajax.js";
|
|
|
|
export function report(msg, err, link, lineNo, columnNo) {
|
|
if (window.navigator.onLine === false) return Promise.resolve();
|
|
let url = toHref("/report?");
|
|
url += "url=" + encodeURIComponent(location.href) + "&";
|
|
url += "msg=" + encodeURIComponent(msg) + "&";
|
|
url += "from=" + encodeURIComponent(link) + "&";
|
|
url += "from.lineNo=" + lineNo + "&";
|
|
url += "from.columnNo=" + columnNo;
|
|
if (err instanceof Error) url += "error=" + encodeURIComponent(err.message) + "&";
|
|
|
|
return ajax({ url, method: "post" }).toPromise().catch(() => {});
|
|
}
|