Skip to content

Commit

Permalink
fix: update request config
Browse files Browse the repository at this point in the history
  • Loading branch information
oeyoews committed Oct 24, 2024
1 parent a3e830b commit 174d413
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"publisher": "oeyoews",
"name": "usewiki2",
"displayName": "usewiki2",
"version": "1.2.1",
"version": "1.3.0",
"private": true,
"packageManager": "[email protected]",
"description": "",
Expand Down Expand Up @@ -57,11 +57,11 @@
"default": 8080,
"description": "端口 (请确定你已经启动了太微)"
},
"enableHttps": {
"usewiki2.enableHttps": {
"order": 2,
"type": "boolean",
"default": false,
"markdownDescription": "Enable or disable HTTPS"
"markdownDescription": "Enable or Disable HTTPS(untest for https)"
},
"usewiki2.type": {
"order": 3,
Expand Down
6 changes: 5 additions & 1 deletion src/featchData.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import http from 'node:http';
import https from 'node:https';
import * as vscode from 'vscode';
import { enableHttps, config, getIp, getPort } from './config';
import { notify } from './notify';

export default function fetchData(): Promise<ITiddlyWikiStatus> {
// notify(`正在获取数据${getPort()}`, 'info');
const protocal = enableHttps() ? 'https' : 'http';
const twurl = `${protocal}://${getIp()}:${getPort()}/status`;
// notify(`正在获取数据${twurl}`, 'info');
const protocalMethos = enableHttps() ? https : http;

return new Promise((resolve, reject) => {
http
protocalMethos
.get(twurl, (response) => {
let data: any = null;
response.on('data', (chunk) => {
Expand Down

0 comments on commit 174d413

Please sign in to comment.