-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
732 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,7 @@ | |
} | ||
|
||
.postPublish{ | ||
|
||
margin-bottom: 10px; | ||
} | ||
|
||
.postPublish a{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const GET_USERS_BLOGS = "blogger.getUsersBlogs" | ||
const NEW_POST = "metaWeblog.newPost" | ||
const EDIT_POST = "metaWeblog.editPost" | ||
const DELETE_POST = "blogger.deletePost" | ||
const GET_RECENT_POSTS = "metaWeblog.getRecentPosts" | ||
const GET_POST = "metaWeblog.getPost" | ||
|
||
export const METAWEBLOG_METHOD_CONSTANTS = { | ||
GET_USERS_BLOGS, | ||
NEW_POST, | ||
EDIT_POST, | ||
DELETE_POST, | ||
GET_RECENT_POSTS, | ||
GET_POST | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const POST_STATUS_PUBLISH = "publish" | ||
const POST_TYPE_DRAFT = "draft" | ||
const POST_TYPE_INHERIT = "inherit" | ||
|
||
export const POST_STATUS_CONSTANTS = { | ||
POST_STATUS_PUBLISH, | ||
POST_TYPE_DRAFT, | ||
POST_TYPE_INHERIT | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
```json | ||
{ | ||
"dependencies": { | ||
"metaweblog-api": "^1.2.0" | ||
"xmlrpc": "^1.3.2" | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import logUtil from "../logUtil"; | ||
|
||
const Serializer = require('xmlrpc/lib/serializer') | ||
// const xmlParser = require('xml2json'); | ||
const {XMLParser} = require('fast-xml-parser'); | ||
const options = { | ||
ignoreAttributes : false | ||
}; | ||
const xmlParser = new XMLParser(options); | ||
|
||
/** | ||
* 自定义xmlrpc的请求与解析,解决apache xmlrpc的扩展问题 | ||
* @param apiUrl | ||
* @param reqMethod | ||
* @param reqParams | ||
*/ | ||
export async function fetchCustom(apiUrl: string, reqMethod: string, reqParams: Array<string>) { | ||
let ret | ||
|
||
try { | ||
const methodBodyXml = Serializer.serializeMethodCall(reqMethod, reqParams, "utf8") | ||
|
||
const response = await fetch(apiUrl, { | ||
method: "POST", | ||
headers: { | ||
"content-type": "text/xml" | ||
}, | ||
body: methodBodyXml | ||
}) | ||
const resXml = await response.text() | ||
logUtil.logInfo("resXml=>", resXml) | ||
|
||
const parseResult: any = xmlParser.parse(resXml) | ||
logUtil.logInfo("parseResult=>", parseResult) | ||
|
||
const resJson = parseResult.methodResponse || {} | ||
logUtil.logInfo("resJson=>", JSON.stringify(resJson)) | ||
|
||
return resJson | ||
} catch (e: any) { | ||
throw new Error(e) | ||
} | ||
|
||
return ret | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.