🔥 删掉短网址功能

This commit is contained in:
Liang Ding 2019-05-17 13:18:33 +08:00
parent f764d61323
commit 8341881400
No known key found for this signature in database
GPG Key ID: 136F30F901A2231D
8 changed files with 9 additions and 72 deletions

View File

@ -165,7 +165,6 @@
"restore_outline": "Restore Outline",
"share": "Share",
"url": "URL",
"short_url": "Short URL",
"embeded": "Embeded",
"terms": "Terms",
"download": "Download",

View File

@ -165,7 +165,6 @@
"restore_outline": "アウトラインを復元",
"share": "シェア",
"url": "リンク",
"short_url": "ショートリンク",
"embeded": "埋め込む",
"terms": "利用規約",
"download": "ダウンロード",

View File

@ -165,7 +165,6 @@
"restore_outline": "주제복구",
"share": "공유",
"url": "하이퍼링크",
"short_url": "짧은 링크",
"embeded": "삽입",
"terms": "사용계약",
"download": "다운로드",

View File

@ -165,7 +165,6 @@
"restore_outline": "恢复大纲",
"share": "分享",
"url": "链接",
"short_url": "短链接",
"embeded": "嵌入",
"terms": "使用条款",
"download": "下载",

View File

@ -165,7 +165,6 @@
"restore_outline": "恢復大綱",
"share": "分享",
"url": "連結",
"short_url": "短網址",
"embeded": "嵌入",
"terms": "使用條款",
"download": "下載",

View File

@ -154,7 +154,6 @@ func main() {
http.HandleFunc("/playground/", handlerWrapper(playground.IndexHandler))
http.HandleFunc("/playground/ws", handlerWrapper(playground.WSHandler))
http.HandleFunc("/playground/save", handlerWrapper(playground.SaveHandler))
http.HandleFunc("/playground/short-url", handlerWrapper(playground.ShortURLHandler))
http.HandleFunc("/playground/build", handlerWrapper(playground.BuildHandler))
http.HandleFunc("/playground/run", handlerWrapper(playground.RunHandler))
http.HandleFunc("/playground/stop", handlerWrapper(playground.StopHandler))

View File

@ -94,45 +94,3 @@ func SaveHandler(w http.ResponseWriter, r *http.Request) {
return
}
}
// ShortURLHandler handles request of short URL.
func ShortURLHandler(w http.ResponseWriter, r *http.Request) {
result := util.NewResult()
defer util.RetResult(w, r, result)
session, _ := session.HTTPSession.Get(r, session.CookieName)
if session.IsNew {
http.Error(w, "Forbidden", http.StatusForbidden)
return
}
var args map[string]interface{}
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
logger.Error(err)
result.Succ = false
return
}
result.Data = args["url"].(string)
// 百度短网址服务需要认证才可以使用
//resp, _ := http.Post("http://dwz.cn/create.php", "application/x-www-form-urlencoded",
// strings.NewReader("url="+url))
//
//var response map[string]interface{}
//if err := json.NewDecoder(resp.Body).Decode(&response); err != nil {
// logger.Error(err)
// result.Succ = false
//
// return
//}
//
//shortURL := url
//if 0 == response["status"].(float64) {
// shortURL = response["tinyurl"].(string)
//}
//
//result.Data = shortURL
}

View File

@ -373,31 +373,16 @@ var playground = {
var request = newWideRequest();
request.url = url;
$.ajax({
type: 'POST',
url: '/playground/short-url',
data: JSON.stringify(request),
dataType: "json",
success: function (result) {
if (!result.succ) {
console.log(result);
return;
}
var html = '<div class="fn-clear"><label>' + config.label.url
+ config.label.colon + '</label><a href="'
+ url + '" target="_blank">' + url + "</a><br/>";
html += '<label>' + config.label.embeded + config.label.colon
+ '</label><br/><textarea rows="5" style="width:100%" readonly><iframe style="border:1px solid" src="'
+ url + '" width="99%" height="600"></iframe></textarea>';
html += '</div>';
var html = '<div class="fn-clear"><label>' + config.label.url
+ config.label.colon + '</label><a href="'
+ url + '" target="_blank">' + url + "</a><br/>";
html += '<label>' + config.label.short_url + config.label.colon
+ '</label><a href="' + result.data + '" target="_blank">'
+ result.data + '</a><br/>';
html += '<label>' + config.label.embeded + config.label.colon
+ '</label><br/><textarea rows="5" style="width:100%" readonly><iframe style="border:1px solid" src="'
+ url + '" width="99%" height="600"></iframe></textarea>';
html += '</div>';
$("#dialogShare").html(html);
$("#dialogShare").dialog("open");
}});
$("#dialogShare").html(html);
$("#dialogShare").dialog("open");
}
});
},