move import post handler under /api
handler for post request to import is now under /api/me/import form target updated also allow all plaintext files in form
This commit is contained in:
parent
0ca198c715
commit
6c5d89ac86
|
@ -95,7 +95,6 @@ func InitRoutes(apper Apper, r *mux.Router) *mux.Router {
|
||||||
me.HandleFunc("/export", handler.User(viewExportOptions)).Methods("GET")
|
me.HandleFunc("/export", handler.User(viewExportOptions)).Methods("GET")
|
||||||
me.HandleFunc("/export.json", handler.Download(viewExportFull, UserLevelUser)).Methods("GET")
|
me.HandleFunc("/export.json", handler.Download(viewExportFull, UserLevelUser)).Methods("GET")
|
||||||
me.HandleFunc("/import", handler.User(viewImport)).Methods("GET")
|
me.HandleFunc("/import", handler.User(viewImport)).Methods("GET")
|
||||||
me.HandleFunc("/import", handler.User(handleImport)).Methods("POST")
|
|
||||||
me.HandleFunc("/settings", handler.User(viewSettings)).Methods("GET")
|
me.HandleFunc("/settings", handler.User(viewSettings)).Methods("GET")
|
||||||
me.HandleFunc("/invites", handler.User(handleViewUserInvites)).Methods("GET")
|
me.HandleFunc("/invites", handler.User(handleViewUserInvites)).Methods("GET")
|
||||||
me.HandleFunc("/logout", handler.Web(viewLogout, UserLevelNone)).Methods("GET")
|
me.HandleFunc("/logout", handler.Web(viewLogout, UserLevelNone)).Methods("GET")
|
||||||
|
@ -108,6 +107,7 @@ func InitRoutes(apper Apper, r *mux.Router) *mux.Router {
|
||||||
apiMe.HandleFunc("/password", handler.All(updatePassphrase)).Methods("POST")
|
apiMe.HandleFunc("/password", handler.All(updatePassphrase)).Methods("POST")
|
||||||
apiMe.HandleFunc("/self", handler.All(updateSettings)).Methods("POST")
|
apiMe.HandleFunc("/self", handler.All(updateSettings)).Methods("POST")
|
||||||
apiMe.HandleFunc("/invites", handler.User(handleCreateUserInvite)).Methods("POST")
|
apiMe.HandleFunc("/invites", handler.User(handleCreateUserInvite)).Methods("POST")
|
||||||
|
apiMe.HandleFunc("/import", handler.User(handleImport)).Methods("POST")
|
||||||
|
|
||||||
// Sign up validation
|
// Sign up validation
|
||||||
write.HandleFunc("/api/alias", handler.All(handleUsernameCheck)).Methods("POST")
|
write.HandleFunc("/api/alias", handler.All(handleUsernameCheck)).Methods("POST")
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
<h2 id="posts-header">Import</h2>
|
<h2 id="posts-header">Import</h2>
|
||||||
<p>Upload text or markdown files to import as posts.</p>
|
<p>Upload text or markdown files to import as posts.</p>
|
||||||
<div class="formContainer">
|
<div class="formContainer">
|
||||||
<form id="importPosts" class="import" enctype="multipart/form-data" action="/me/import" method="POST">
|
<form id="importPosts" class="import" enctype="multipart/form-data" action="/api/me/import" method="POST">
|
||||||
<label for="file" hidden>Browse files to upload</label>
|
<label for="file" hidden>Browse files to upload</label>
|
||||||
<input class="fileInput" name="files" type="file" multiple accept=".txt,.md"/>
|
<input class="fileInput" name="files" type="file" multiple accept="text/plain"/>
|
||||||
<br />
|
<br />
|
||||||
<label for="collection">Select a blog to import the posts under.</label>
|
<label for="collection">Select a blog to import the posts under.</label>
|
||||||
<select name="collection">
|
<select name="collection">
|
||||||
|
|
Loading…
Reference in New Issue