Skip to content

Commit

Permalink
更新PushPlus链接及相关Api(#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
HCLonely committed Sep 3, 2022
1 parent 97929e1 commit 89fcac0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
- [企业微信群机器人](https://developer.work.weixin.qq.com/document/path/91770) -- WorkWeixinBot
- [Telegram Bot](https://core.telegram.org/bots/api#sendmessage) -- TelegramBot
- [PushDeer](http://pushdeer.com) -- PushDeer
- [PushPlus](https://pushplus.hxtrip.com/index) -- PushPlus
- [PushPlus](http://www.pushplus.plus/) -- PushPlus
- [Server 酱](https://sct.ftqq.com) -- ServerChanTurbo
- [Showdoc Push](https://push.showdoc.com.cn/#/) -- Showdoc
- [息知](https://xz.qqoq.net/#/index) -- Xizhi
Expand Down
17 changes: 5 additions & 12 deletions dist/PushPlus.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ var axios = require('axios');

var tool = require('./tool');

var showdown = require('showdown');

function _interopDefaultLegacy(e) {
return e && typeof e === 'object' && 'default' in e ? e : {
'default': e
Expand All @@ -20,8 +18,6 @@ function _interopDefaultLegacy(e) {

var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);

var showdown__default = /*#__PURE__*/_interopDefaultLegacy(showdown);

class PushPlus {
constructor({
token,
Expand All @@ -30,7 +26,7 @@ class PushPlus {
}) {
_defineProperty(this, "_KEY", void 0);

_defineProperty(this, "baseURL", 'https://pushplus.hxtrip.com/send/');
_defineProperty(this, "baseURL", 'http://www.pushplus.plus/send');

_defineProperty(this, "httpsAgent", void 0);

Expand Down Expand Up @@ -73,23 +69,20 @@ class PushPlus {
}

if (['html', 'markdown'].includes(sendOptions.type || '')) {
pushPlusOptions.template = 'html';
}

if (sendOptions.type === 'markdown') {
// @ts-ignore
pushPlusOptions.content = new showdown__default["default"]().Converter().makeHtml(sendOptions.message);
pushPlusOptions.template = sendOptions.type;
}
}

pushPlusOptions.token = this._KEY;

if (sendOptions.extraOptions) {
pushPlusOptions = { ...pushPlusOptions,
...sendOptions.extraOptions
};
}

const axiosOptions = {
url: `${this.baseURL}${this._KEY}`,
url: `${this.baseURL}`,
method: 'POST',
headers: {
'Content-type': 'application/json'
Expand Down
2 changes: 1 addition & 1 deletion dist/types/PushPlus.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface PushPlusConfig {
}
declare class PushPlus {
protected _KEY: string;
readonly baseURL = "https://pushplus.hxtrip.com/send/";
readonly baseURL = "http://www.pushplus.plus/send";
httpsAgent?: AxiosRequestConfig['httpsAgent'];
constructor({ token, key, proxy }: PushPlusConfig);
send(sendOptions: sendOptions): Promise<result>;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "all-pusher-api",
"version": "1.0.7",
"version": "1.0.8",
"description": "统一化推送服务API.",
"main": "dist/index.js",
"scripts": {
Expand Down
12 changes: 4 additions & 8 deletions src/PushPlus.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import axios, { AxiosRequestConfig } from 'axios';
import { proxy2httpsAgent, proxy, result, sendOptions } from './tool';
import showdown from 'showdown';

interface PushPlusConfig {
token?: string
Expand All @@ -19,7 +18,7 @@ interface PushPlusOptions {

class PushPlus {
protected _KEY: string;
readonly baseURL = 'https://pushplus.hxtrip.com/send/';
readonly baseURL = 'http://www.pushplus.plus/send';
httpsAgent?: AxiosRequestConfig['httpsAgent'];

constructor({ token, key, proxy }: PushPlusConfig) {
Expand Down Expand Up @@ -55,13 +54,10 @@ class PushPlus {
pushPlusOptions.title = sendOptions.title;
}
if (['html', 'markdown'].includes(sendOptions.type || '')) {
pushPlusOptions.template = 'html';
}
if (sendOptions.type === 'markdown') {
// @ts-ignore
pushPlusOptions.content = new showdown().Converter().makeHtml(sendOptions.message);
pushPlusOptions.template = sendOptions.type;
}
}
pushPlusOptions.token = this._KEY;
if (sendOptions.extraOptions) {
pushPlusOptions = {
...pushPlusOptions,
Expand All @@ -70,7 +66,7 @@ class PushPlus {
}

const axiosOptions: AxiosRequestConfig = {
url: `${this.baseURL}${this._KEY}`,
url: `${this.baseURL}`,
method: 'POST',
headers: {
'Content-type': 'application/json'
Expand Down

0 comments on commit 89fcac0

Please sign in to comment.