public override IEnumerator Upload(byte[] data, bool openLink, bool copyLink, string rawData) { string url = "https://hastebin.com/documents"; WWW www = new WWW(url, data); yield return(www); if (www.error == null) { // example result // {"key":"oxekofidik"} string key = www.text; key = key.Substring(0, key.Length - 2); key = key.Substring(key.LastIndexOf("\"") + 1); string rawUrl = "https://hastebin.com/raw/" + key; Debug.Log("[LogfileHotkey] Hastebin: paste now available at " + rawUrl); string analysisUrl = LogUploadUtils.LogAnalyzerFor(rawUrl); if (openLink) { LogUploadUtils.OpenLink(analysisUrl); } if (copyLink) { LogUploadUtils.CopyLink(analysisUrl); } } else { Debug.Log("[LogfileHotkey] Error uploading to Hastebin: " + www.error); LogfileUploader.Instance.Notifier.Error("Error: Couldn't Upload to Hastebin", www.error); } yield break; }
public override IEnumerator Upload(byte[] data, bool openLink, bool copyLink, string stringData) { string url = "https://ktane.timwi.de/upload-log"; var formData = new List <IMultipartFormSection> { new MultipartFormFileSection("log", stringData, null, "output_log.txt"), new MultipartFormDataSection("noredirect", "1", Encoding.UTF8, "text/plain") }; UnityWebRequest www = UnityWebRequest.Post(url, formData); yield return(www.Send()); if (www.isNetworkError || www.isHttpError) { Debug.Log("[LogfileHotkey] Error uploading to Repository of Manual Pages: " + www.error + " (" + www.responseCode + ")"); LogfileUploader.Instance.Notifier.Error("Error: Couldn't Upload to Repository of Manual Pages", www.error + " (" + www.responseCode + ")"); LogfileUploader.Instance.uploadError = true; } else { string rawUrl = www.downloadHandler.text; Debug.Log("[LogfileHotkey] Repository of Manual Pages: log now available at " + rawUrl); if (openLink) { LogUploadUtils.OpenLink(rawUrl); } if (copyLink) { LogUploadUtils.CopyLink(rawUrl); } } yield break; }