diff --git a/file/decompress.go b/file/decompress.go deleted file mode 100644 index e112a88..0000000 --- a/file/decompress.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2014-present, b3log.org -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package file - -import ( - "encoding/json" - "net/http" - "path/filepath" - - "github.com/b3log/wide/util" -) - -// DecompressHandler handles request of decompressing zip/tar.gz. -func DecompressHandler(w http.ResponseWriter, r *http.Request) { - result := util.NewResult() - defer util.RetResult(w, r, result) - - var args map[string]interface{} - if err := json.NewDecoder(r.Body).Decode(&args); err != nil { - logger.Error(err) - result.Succ = false - - return - } - - path := args["path"].(string) - // base := filepath.Base(path) - dir := filepath.Dir(path) - - if !util.File.IsExist(path) { - result.Succ = false - result.Msg = "Can't find file [" + path + "] to descompress" - - return - } - - err := util.Zip.Unzip(path, dir) - if nil != err { - logger.Error(err) - result.Succ = false - - return - } - -} diff --git a/i18n/en_US.json b/i18n/en_US.json index 056934b..4d14856 100644 --- a/i18n/en_US.json +++ b/i18n/en_US.json @@ -118,7 +118,6 @@ "team": "Team", "sing_up_error": "Sign Up Error", "user_name_ruler": "Username only by az, AZ, 0-9, _ consisting of a length of 16", - "invalid_email": "Invalid Email", "password_no_match": "Password doesn't match the confirmation", "discard": "Discard", "close": "Close", @@ -155,9 +154,7 @@ "source": "Source", "toggle_comment": "Toggle Comment", "find_in_files": "Find in Files", - "email": "Email", "no_empty": "Can not Empty!", - "change_avatar": "Avatar modify go", "open": "Open", "search_no_match": "No matching files were found.", "outline": "Outline", diff --git a/i18n/ja_JP.json b/i18n/ja_JP.json index 862858d..6900939 100644 --- a/i18n/ja_JP.json +++ b/i18n/ja_JP.json @@ -118,7 +118,6 @@ "team": "チーム", "sing_up_error": "登録に失敗しました", "user_name_ruler": "16の長さからなる_ AZ、AZ、0-9、によってユーザ名のみ", - "invalid_email": "無効な電子メール", "password_no_match": "一貫性のないパスワード入力", "discard": "あきらめる", "close": "クローズ", @@ -155,9 +154,7 @@ "source": "ソース", "toggle_comment": "トグルコメント", "find_in_files": "ファイルから検索", - "email": "Eメール", "no_empty": "空ではありません", - "change_avatar": "アバターの変更は行く", "open": "オープン", "search_no_match": "一致するファイルが見つかりませんでした。", "outline": "アウトライン", diff --git a/i18n/ko_KR.json b/i18n/ko_KR.json index d2d433c..8664074 100644 --- a/i18n/ko_KR.json +++ b/i18n/ko_KR.json @@ -118,7 +118,6 @@ "team": "단체", "sing_up_error": "가입실패", "user_name_ruler": "아이디는 16글자 이하이며 a-z, A-Z, 0-9, _ 만 가능합니다,", - "invalid_email": "유효하지 않은 email주소", "password_no_match": "비밀번호 오류", "discard": "취소", "close": "닫기", @@ -155,9 +154,7 @@ "source": "소스", "toggle_comment": "주석", "find_in_files": "문서에서 찾기", - "email": "이메일", "no_empty": "값을 입력해 주세요.", - "change_avatar": "아이콘변경은 여기로.", "open": "열기", "search_no_match": "해당 문서를 찾지 못하였습니다.", "outline": "주제", diff --git a/i18n/zh_CN.json b/i18n/zh_CN.json index 01deaa1..5a89ae3 100644 --- a/i18n/zh_CN.json +++ b/i18n/zh_CN.json @@ -118,7 +118,6 @@ "team": "团队", "sing_up_error": "注册失败", "user_name_ruler": "用户名只能由 a-z, A-Z, 0-9, _ 组成,长度为16", - "invalid_email": "无效的电子邮件", "password_no_match": "密码输入不一致", "discard": "放弃", "close": "关闭", @@ -155,9 +154,7 @@ "source": "源码", "toggle_comment": "注释", "find_in_files": "在文件中查找", - "email": "电子邮件", "no_empty": "不能为空", - "change_avatar": "头像修改请到", "open": "打开", "search_no_match": "没有发现匹配的文件。", "outline": "大纲", diff --git a/i18n/zh_TW.json b/i18n/zh_TW.json index 7bccca7..7d24c28 100644 --- a/i18n/zh_TW.json +++ b/i18n/zh_TW.json @@ -118,7 +118,6 @@ "team": "團隊", "sing_up_error": "註冊失敗", "user_name_ruler": "帳號只能由 az, AZ, 0-9, _ 組成,長度為16", - "invalid_email": "無效的電子郵件", "password_no_match": "密碼輸入不一致", "discard": "捨棄", "close": "關閉", @@ -155,9 +154,7 @@ "source": "原始碼", "toggle_comment": "註解", "find_in_files": "在文件中尋找", - "email": "電子郵件", "no_empty": "不能為空", - "change_avatar": "修改頭像請到", "open": "開啟", "search_no_match": "沒有發現匹配的文件。", "outline": "大綱", diff --git a/main.go b/main.go index 9a26963..213f086 100644 --- a/main.go +++ b/main.go @@ -99,7 +99,7 @@ func main() { serveSingle("/favicon.ico", "./static/images/favicon.png") // oauth - http.HandleFunc("/oauth/github", session.RedirectGitHubHandler) + http.HandleFunc("/oauth/github/redirect", session.RedirectGitHubHandler) http.HandleFunc("/oauth/github/callback", session.GithubCallbackHandler) // session @@ -133,10 +133,9 @@ func main() { // outline http.HandleFunc("/outline", handlerWrapper(file.GetOutlineHandler)) - // file export/import + // file export http.HandleFunc("/file/zip/new", handlerWrapper(file.CreateZipHandler)) http.HandleFunc("/file/zip", handlerWrapper(file.GetZipHandler)) - http.HandleFunc("/file/decompress", handlerWrapper(file.DecompressHandler)) // editor http.HandleFunc("/editor/ws", handlerWrapper(editor.WSHandler)) diff --git a/session/oauthctl.go b/session/oauthctl.go index 37997ba..684c5b6 100644 --- a/session/oauthctl.go +++ b/session/oauthctl.go @@ -59,10 +59,6 @@ func RedirectGitHubHandler(w http.ResponseWriter, r *http.Request) { if "" == referer || !strings.Contains(referer, "://") { referer = conf.Wide.Server + referer } - if strings.HasSuffix(referer, "/") { - referer = referer[:len(referer)-1] - } - referer += "__1" state := util.Rand.String(16) + referer states[state] = state path := loginAuthURL + "?client_id=" + clientId + "&state=" + state + "&scope=public_repo,read:user,user:follow" diff --git a/static/js/menu.js b/static/js/menu.js index a40e5d0..3472fdd 100644 --- a/static/js/menu.js +++ b/static/js/menu.js @@ -448,7 +448,6 @@ var menu = { "GoBuildArgsForDarwin": $GoBuildArgsForDarwin.val(), "workspace": $workspace.val(), "password": $password.val(), - "email": $email.val(), "locale": $locale.val(), "theme": $theme.val(), "editorFontFamily": $editorFontFamily.val(), diff --git a/views/preference.html b/views/preference.html index 5a140ff..9cd875e 100644 --- a/views/preference.html +++ b/views/preference.html @@ -101,24 +101,13 @@ {{end}} - -