Merge branch 'master' into master

pull/1213/head
Karel Krýda 3 years ago committed by GitHub
commit 2b14bdae62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -11,12 +11,14 @@ on:
jobs: jobs:
auto-test: auto-test:
needs: [ check-linters ]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy: strategy:
matrix: matrix:
os: [macos-latest, ubuntu-latest, windows-latest] os: [macos-latest, ubuntu-latest, windows-latest]
node: [14, 16, 17] node: [ 14, 16, 17, 18 ]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps: steps:
@ -28,7 +30,7 @@ jobs:
with: with:
node-version: ${{ matrix.node }} node-version: ${{ matrix.node }}
cache: 'npm' cache: 'npm'
- run: npm run install-legacy - run: npm install
- run: npm run build - run: npm run build
- run: npm test - run: npm test
env: env:
@ -44,7 +46,7 @@ jobs:
- name: Use Node.js LTS - name: Use Node.js LTS
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 16 node-version: 14
cache: 'npm' cache: 'npm'
- run: npm run install-legacy - run: npm install
- run: npm run lint - run: npm run lint

@ -10,8 +10,8 @@
"node": "14.* || >=16.*" "node": "14.* || >=16.*"
}, },
"scripts": { "scripts": {
"install-legacy": "npm install --legacy-peer-deps", "install-legacy": "npm install",
"update-legacy": "npm update --legacy-peer-deps", "update-legacy": "npm update",
"lint:js": "eslint --ext \".js,.vue\" --ignore-path .gitignore .", "lint:js": "eslint --ext \".js,.vue\" --ignore-path .gitignore .",
"lint-fix:js": "eslint --ext \".js,.vue\" --fix --ignore-path .gitignore .", "lint-fix:js": "eslint --ext \".js,.vue\" --fix --ignore-path .gitignore .",
"lint:style": "stylelint \"**/*.{vue,css,scss}\" --ignore-path .gitignore", "lint:style": "stylelint \"**/*.{vue,css,scss}\" --ignore-path .gitignore",

@ -93,8 +93,23 @@ class AliyunSMS extends NotificationProvider {
param2[key] = param[key]; param2[key] = param[key];
} }
// Escape more characters than encodeURIComponent does.
// For generating Aliyun signature, all characters except A-Za-z0-9~-._ are encoded.
// See https://help.aliyun.com/document_detail/315526.html
// This encoding methods as known as RFC 3986 (https://tools.ietf.org/html/rfc3986)
let moreEscapesTable = function (m) {
return {
"!": "%21",
"*": "%2A",
"'": "%27",
"(": "%28",
")": "%29"
}[m];
};
for (let key in param2) { for (let key in param2) {
data.push(`${encodeURIComponent(key)}=${encodeURIComponent(param2[key])}`); let value = encodeURIComponent(param2[key]).replace(/[!*'()]/g, moreEscapesTable);
data.push(`${encodeURIComponent(key)}=${value}`);
} }
let StringToSign = `POST&${encodeURIComponent("/")}&${encodeURIComponent(data.join("&"))}`; let StringToSign = `POST&${encodeURIComponent("/")}&${encodeURIComponent(data.join("&"))}`;

@ -24,7 +24,7 @@ import timezone from "dayjs/plugin/timezone";
import utc from "dayjs/plugin/utc"; import utc from "dayjs/plugin/utc";
import { LineChart } from "vue-chart-3"; import { LineChart } from "vue-chart-3";
import { useToast } from "vue-toastification"; import { useToast } from "vue-toastification";
import { DOWN, PENDING, MAINTENANCE } from "../util.ts"; import { DOWN, PENDING, MAINTENANCE, log } from "../util.ts";
dayjs.extend(utc); dayjs.extend(utc);
dayjs.extend(timezone); dayjs.extend(timezone);
@ -219,8 +219,9 @@ export default {
watch: { watch: {
// Update chart data when the selected chart period changes // Update chart data when the selected chart period changes
chartPeriodHrs: function (newPeriod) { chartPeriodHrs: function (newPeriod) {
if (newPeriod === "0") {
newPeriod = null; // eslint-disable-next-line eqeqeq
if (newPeriod == "0") {
this.heartbeatList = null; this.heartbeatList = null;
this.$root.storage().removeItem(`chart-period-${this.monitorId}`); this.$root.storage().removeItem(`chart-period-${this.monitorId}`);
} else { } else {
@ -243,7 +244,11 @@ export default {
// And mirror latest change to this.heartbeatList // And mirror latest change to this.heartbeatList
this.$watch(() => this.$root.heartbeatList[this.monitorId], this.$watch(() => this.$root.heartbeatList[this.monitorId],
(heartbeatList) => { (heartbeatList) => {
if (this.chartPeriodHrs !== 0) {
log.debug("ping_chart", `this.chartPeriodHrs type ${typeof this.chartPeriodHrs}, value: ${this.chartPeriodHrs}`);
// eslint-disable-next-line eqeqeq
if (this.chartPeriodHrs != "0") {
const newBeat = heartbeatList.at(-1); const newBeat = heartbeatList.at(-1);
if (newBeat && dayjs.utc(newBeat.time) > dayjs.utc(this.heartbeatList.at(-1)?.time)) { if (newBeat && dayjs.utc(newBeat.time) > dayjs.utc(this.heartbeatList.at(-1)?.time)) {
this.heartbeatList.push(heartbeatList.at(-1)); this.heartbeatList.push(heartbeatList.at(-1));

@ -71,7 +71,7 @@
</header> </header>
<main> <main>
<router-view v-if="$root.loggedIn || forceShowContent" /> <router-view v-if="$root.loggedIn" />
<Login v-if="! $root.loggedIn && $root.allowLoginDialog" /> <Login v-if="! $root.loggedIn && $root.allowLoginDialog" />
</main> </main>

@ -421,7 +421,7 @@ export default {
}, },
pushURL() { pushURL() {
return this.$root.baseURL + "/api/push/" + this.monitor.pushToken + "?status=true&msg=OK&ping="; return this.$root.baseURL + "/api/push/" + this.monitor.pushToken + "?status=up&msg=OK&ping=";
}, },
bodyPlaceholder() { bodyPlaceholder() {

@ -104,7 +104,7 @@ class Logger {
} }
else if (level === "DEBUG") { else if (level === "DEBUG") {
if (exports.isDev) { if (exports.isDev) {
console.debug(formattedMessage); console.log(formattedMessage);
} }
} }
else { else {

@ -115,7 +115,7 @@ class Logger {
console.error(formattedMessage); console.error(formattedMessage);
} else if (level === "DEBUG") { } else if (level === "DEBUG") {
if (isDev) { if (isDev) {
console.debug(formattedMessage); console.log(formattedMessage);
} }
} else { } else {
console.log(formattedMessage); console.log(formattedMessage);

Loading…
Cancel
Save