This commit is contained in:
parent
4b6f6af949
commit
ad6df5b1b4
|
@ -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
|
||||
}
|
||||
|
||||
}
|
|
@ -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",
|
||||
|
|
|
@ -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": "アウトライン",
|
||||
|
|
|
@ -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": "주제",
|
||||
|
|
|
@ -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": "大纲",
|
||||
|
|
|
@ -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": "大綱",
|
||||
|
|
5
main.go
5
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))
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -101,24 +101,13 @@
|
|||
{{end}}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
{{.i18n.email}}{{.i18n.colon}}
|
||||
<input data-value="{{.user.Email}}" value="{{.user.Email}}" name="email"/>
|
||||
</label>
|
||||
<input data-value="{{.user.Locale}}" value="{{.user.Locale}}" name="locale" hidden="hidden" />
|
||||
<label>
|
||||
{{.i18n.workspace}}{{.i18n.colon}}
|
||||
<input data-value="{{.user.Workspace}}" value="{{.user.Workspace}}" name="workspace" readonly="readonly" />
|
||||
</label>
|
||||
<label>
|
||||
{{.i18n.password}}{{.i18n.colon}}
|
||||
<input data-value="{{.user.Password}}" value="{{.user.Password}}" name="password" type="password"/>
|
||||
</label>
|
||||
<label class="fn-clear">
|
||||
<img onerror="this.src='/static/images/user-thumbnail.png'"
|
||||
src="https://secure.gravatar.com/avatar/{{.user.Gravatar}}?s=48&d=https://hacpai.com/images/user-thumbnail.png"
|
||||
title="{{.user.Name}}" class='gravatar'/>
|
||||
<a href="http://gravatar.com/" target="_blank">{{.i18n.change_avatar}} Gravatar.com</a>
|
||||
<img onerror="this.src='/static/images/user-thumbnail.png'" src="{{.user.Gravatar}}" title="{{.user.Name}}" class='gravatar'/>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue