oipage 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,172 +1,172 @@
1
- <!DOCTYPE html>
2
- <html lang="zh-cn">
3
-
4
- <head>
5
- <meta charset="UTF-8">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
8
- <title>404 Not Found</title>
9
- <style>
10
- body {
11
- margin: 0px;
12
- background-color: #ffffff;
13
- display: flex;
14
- flex-wrap: wrap;
15
- padding: 100px;
16
- }
17
-
18
- a {
19
- text-decoration: none;
20
- color: #284259;
21
- }
22
-
23
- a:hover {
24
- text-decoration: underline;
25
- }
26
-
27
- .fork {
28
- width: 160px;
29
- line-height: 30px;
30
- position: fixed;
31
- background-color: #607D8B;
32
- text-align: center;
33
- color: white;
34
- outline: 2px dashed #607D8B;
35
- width: 200px;
36
- transform: rotate(45deg);
37
- right: -45px;
38
- top: 45px;
39
- z-index: 1;
40
- }
41
-
42
- .current {
43
- box-sizing: border-box;
44
- position: fixed;
45
- left: 0;
46
- top: 0;
47
- line-height: 50px;
48
- padding-left: 20px;
49
- font-size: 14px;
50
- color: #000000;
51
- font-style: italic;
52
- }
53
-
54
- .filelist {
55
- box-sizing: border-box;
56
- position: fixed;
57
- left: 20px;
58
- top: 50px;
59
- outline: 1px solid #9E9E9E;
60
- width: calc(100vw - 40px);
61
- height: calc(100vh - 70px);
62
- overflow: auto;
63
- padding: 20px;
64
- border-radius: 5px;
65
- background-color: #fcfcfc;
66
- }
67
-
68
- .filelist>table {
69
- width: 100%;
70
- text-align: left;
71
- }
72
-
73
- .filelist>table tr>th {
74
- white-space: nowrap;
75
- padding: 0 10px;
76
- }
77
-
78
- .filelist>table>thead>tr>th {
79
- color: #284259;
80
- font-size: 13px;
81
- line-height: 40px;
82
- }
83
-
84
- .filelist>table>tbody>tr {
85
- border: 1px solid #cdcdcd00;
86
- }
87
-
88
- .filelist>table>tbody>tr>th {
89
- text-decoration: none;
90
- font-size: 12px;
91
- color: #3c3c3c;
92
- word-break: break-all;
93
- font-weight: 400;
94
- line-height: 30px;
95
- }
96
-
97
- .filelist>table>tbody>tr>th>.btn {
98
- color: white;
99
- background-color: #2196F3;
100
- padding: 2px 5px;
101
- border-radius: 5px;
102
- }
103
-
104
- .filelist>table>tbody>tr>th.name {
105
- background-repeat: no-repeat;
106
- background-position: left center;
107
- background-size: auto 90%;
108
- padding-left: 30px;
109
- color: #000000;
110
- }
111
-
112
- .filelist>table>tbody>tr>th.name>span {
113
- white-space: nowrap;
114
- }
115
-
116
- .filelist>table>tbody>tr.file>th.name {
117
- background-image: url('${img_file}');
118
- }
119
-
120
- .filelist>table>tbody>tr.folder>th.name {
121
- background-image: url('${img_folder}');
122
- }
123
- </style>
124
- </head>
125
-
126
- <body>
127
- <a href="https://github.com/oi-contrib/OIPage" target="_blank" class="fork">
128
- Fork me on Github
129
- </a>
130
- <div class="current">
131
- 当前位置:${current}
132
- </div>
133
- <div class="filelist">
134
- <table>
135
- <thead>
136
- <tr>
137
- <th>
138
- 名称
139
- </th>
140
- <th>
141
- 修改日期
142
- </th>
143
- <th>
144
- 类型
145
- </th>
146
- <th>
147
- 大小
148
- </th>
149
- <th>
150
- 操作
151
- </th>
152
- </tr>
153
- </thead>
154
- <tbody>
155
- <tr class="folder">
156
- <th class="name"><a href='../'>..</a></th>
157
- <th>-</th>
158
- <th>
159
- 文件夹
160
- </th>
161
- <th>-</th>
162
- <th>
163
- <a href='../' class="btn">打开</a>
164
- </th>
165
- </tr>
166
- ${template}
167
- </tbody>
168
- </table>
169
- </div>
170
- </body>
171
-
1
+ <!DOCTYPE html>
2
+ <html lang="zh-cn">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
8
+ <title>404 Not Found</title>
9
+ <style>
10
+ body {
11
+ margin: 0px;
12
+ background-color: #ffffff;
13
+ display: flex;
14
+ flex-wrap: wrap;
15
+ padding: 100px;
16
+ }
17
+
18
+ a {
19
+ text-decoration: none;
20
+ color: #284259;
21
+ }
22
+
23
+ a:hover {
24
+ text-decoration: underline;
25
+ }
26
+
27
+ .fork {
28
+ width: 160px;
29
+ line-height: 30px;
30
+ position: fixed;
31
+ background-color: #607D8B;
32
+ text-align: center;
33
+ color: white;
34
+ outline: 2px dashed #607D8B;
35
+ width: 200px;
36
+ transform: rotate(45deg);
37
+ right: -45px;
38
+ top: 45px;
39
+ z-index: 1;
40
+ }
41
+
42
+ .current {
43
+ box-sizing: border-box;
44
+ position: fixed;
45
+ left: 0;
46
+ top: 0;
47
+ line-height: 50px;
48
+ padding-left: 20px;
49
+ font-size: 14px;
50
+ color: #000000;
51
+ font-style: italic;
52
+ }
53
+
54
+ .filelist {
55
+ box-sizing: border-box;
56
+ position: fixed;
57
+ left: 20px;
58
+ top: 50px;
59
+ outline: 1px solid #9E9E9E;
60
+ width: calc(100vw - 40px);
61
+ height: calc(100vh - 70px);
62
+ overflow: auto;
63
+ padding: 20px;
64
+ border-radius: 5px;
65
+ background-color: #fcfcfc;
66
+ }
67
+
68
+ .filelist>table {
69
+ width: 100%;
70
+ text-align: left;
71
+ }
72
+
73
+ .filelist>table tr>th {
74
+ white-space: nowrap;
75
+ padding: 0 10px;
76
+ }
77
+
78
+ .filelist>table>thead>tr>th {
79
+ color: #284259;
80
+ font-size: 13px;
81
+ line-height: 40px;
82
+ }
83
+
84
+ .filelist>table>tbody>tr {
85
+ border: 1px solid #cdcdcd00;
86
+ }
87
+
88
+ .filelist>table>tbody>tr>th {
89
+ text-decoration: none;
90
+ font-size: 12px;
91
+ color: #3c3c3c;
92
+ word-break: break-all;
93
+ font-weight: 400;
94
+ line-height: 30px;
95
+ }
96
+
97
+ .filelist>table>tbody>tr>th>.btn {
98
+ color: white;
99
+ background-color: #2196F3;
100
+ padding: 2px 5px;
101
+ border-radius: 5px;
102
+ }
103
+
104
+ .filelist>table>tbody>tr>th.name {
105
+ background-repeat: no-repeat;
106
+ background-position: left center;
107
+ background-size: auto 90%;
108
+ padding-left: 30px;
109
+ color: #000000;
110
+ }
111
+
112
+ .filelist>table>tbody>tr>th.name>span {
113
+ white-space: nowrap;
114
+ }
115
+
116
+ .filelist>table>tbody>tr.file>th.name {
117
+ background-image: url('${img_file}');
118
+ }
119
+
120
+ .filelist>table>tbody>tr.folder>th.name {
121
+ background-image: url('${img_folder}');
122
+ }
123
+ </style>
124
+ </head>
125
+
126
+ <body>
127
+ <a href="https://github.com/oi-contrib/OIPage" target="_blank" class="fork">
128
+ Fork me on Github
129
+ </a>
130
+ <div class="current">
131
+ 当前位置:${current}
132
+ </div>
133
+ <div class="filelist">
134
+ <table>
135
+ <thead>
136
+ <tr>
137
+ <th>
138
+ 名称
139
+ </th>
140
+ <th>
141
+ 修改日期
142
+ </th>
143
+ <th>
144
+ 类型
145
+ </th>
146
+ <th>
147
+ 大小
148
+ </th>
149
+ <th>
150
+ 操作
151
+ </th>
152
+ </tr>
153
+ </thead>
154
+ <tbody>
155
+ <tr class="folder">
156
+ <th class="name"><a href='../'>..</a></th>
157
+ <th>-</th>
158
+ <th>
159
+ 文件夹
160
+ </th>
161
+ <th>-</th>
162
+ <th>
163
+ <a href='../' class="btn">打开</a>
164
+ </th>
165
+ </tr>
166
+ ${template}
167
+ </tbody>
168
+ </table>
169
+ </div>
170
+ </body>
171
+
172
172
  </html>
@@ -1,43 +1,43 @@
1
- const { networkInterfaces } = require("os");
2
-
3
- // 网络信息
4
- module.exports = function () {
5
-
6
- let infomation = {
7
- IPv4: [],
8
- IPv6: []
9
- };
10
-
11
- let networks = networkInterfaces();
12
-
13
- let IPv4Had = {}, IPv6Had = {};
14
-
15
- for (let typeName in networks) {
16
- let network = networks[typeName]
17
- for (let index = 0; index < network.length; index++) {
18
- if (network[index].mac != "00:00:00:00:00:00") {
19
- if (network[index].family == 'IPv4' && network[index].address != '127.0.0.1') {
20
- if (!IPv4Had[network[index].mac]) {
21
- infomation.IPv4.push({
22
- address: network[index].address,
23
- mac: network[index].mac
24
- });
25
-
26
- IPv4Had[network[index].mac] = true;
27
- }
28
- } else if (network[index].family == 'IPv6' && network[index].address != '::1') {
29
- if (!IPv6Had[network[index].mac]) {
30
- infomation.IPv6.push({
31
- address: network[index].address,
32
- mac: network[index].mac
33
- });
34
-
35
- IPv6Had[network[index].mac] = true;
36
- }
37
- }
38
- }
39
- }
40
- }
41
-
42
- return infomation;
1
+ const { networkInterfaces } = require("os");
2
+
3
+ // 网络信息
4
+ module.exports = function () {
5
+
6
+ let infomation = {
7
+ IPv4: [],
8
+ IPv6: []
9
+ };
10
+
11
+ let networks = networkInterfaces();
12
+
13
+ let IPv4Had = {}, IPv6Had = {};
14
+
15
+ for (let typeName in networks) {
16
+ let network = networks[typeName]
17
+ for (let index = 0; index < network.length; index++) {
18
+ if (network[index].mac != "00:00:00:00:00:00") {
19
+ if (network[index].family == 'IPv4' && network[index].address != '127.0.0.1') {
20
+ if (!IPv4Had[network[index].mac]) {
21
+ infomation.IPv4.push({
22
+ address: network[index].address,
23
+ mac: network[index].mac
24
+ });
25
+
26
+ IPv4Had[network[index].mac] = true;
27
+ }
28
+ } else if (network[index].family == 'IPv6' && network[index].address != '::1') {
29
+ if (!IPv6Had[network[index].mac]) {
30
+ infomation.IPv6.push({
31
+ address: network[index].address,
32
+ mac: network[index].mac
33
+ });
34
+
35
+ IPv6Had[network[index].mac] = true;
36
+ }
37
+ }
38
+ }
39
+ }
40
+ }
41
+
42
+ return infomation;
43
43
  };
@@ -1,84 +1,84 @@
1
- const { readdirSync, lstatSync, readFileSync, statSync } = require("fs");
2
- const { join } = require("path");
3
- const { formatByte, formatTime } = require("./format");
4
- const mineTypes = require("../data/mineTypes.json");
5
-
6
- const img_folder = "data:image/png;base64," + readFileSync(join(__dirname, "../images/folder.png")).toString('base64');
7
- const img_file = "data:image/png;base64," + readFileSync(join(__dirname, "../images/file.png")).toString('base64');
8
-
9
- const template_404 = readFileSync(join(__dirname, "../template/404.html"), {
10
- encoding: "utf8"
11
- })
12
- .replace("${img_folder}", img_folder)
13
- .replace("${img_file}", img_file);
14
-
15
- module.exports = function (filePath, url) {
16
-
17
- let subItems = [];
18
-
19
- try {
20
- subItems = readdirSync(filePath);
21
- console.log("<i> \x1b[1m\x1b[32m[OIPage-dev-server] Read Folder: " + url + '\x1b[0m ' + new Date().toLocaleString());
22
- } catch (e) {
23
- console.log("<i> \x1b[1m\x1b[32m[OIPage-dev-server] Read " + (/\/$/.test(url) ? "Folder" : "File") + ": \x1b[35m" + url + ' 404 Not Found\x1b[0m ' + new Date().toLocaleString());
24
- try {
25
- if (!/\/$/.test(url) || url === "/") {
26
- filePath = join(filePath, "../");
27
- subItems = readdirSync(filePath);
28
- }
29
- } catch (e) { }
30
- }
31
-
32
- let template = "";
33
- for (let i in subItems) {
34
- let isDirectory = lstatSync(join(filePath, subItems[i])).isDirectory();
35
- let statObj = statSync(join(filePath, subItems[i]));
36
-
37
- // 文件夹
38
- if (isDirectory) {
39
- template += `<tr class="folder">
40
- <th class="name">
41
- <a href='./${subItems[i]}/'>${subItems[i]}</a>
42
- </th>
43
- <th>
44
- ${formatTime(statObj.mtime)}
45
- </th>
46
- <th>
47
- 文件夹
48
- </th>
49
- <th>
50
- -
51
- </th>
52
- <th>
53
- <a href='./${subItems[i]}/' class="btn">打开</a>
54
- </th>
55
- </tr>`;
56
- }
57
-
58
- // 文件
59
- else {
60
- let dotName = /\./.test(subItems[i]) ? subItems[i].match(/\.([^.]+)$/)[1] : "";
61
-
62
- template += `<tr class="file">
63
- <th class="name">
64
- <a href='./${subItems[i]}'>${subItems[i]}</a>
65
- </th>
66
- <th>
67
- ${formatTime(statObj.mtime)}
68
- </th>
69
- <th>
70
- ${mineTypes[dotName] || "text/plain"}
71
- </th>
72
- <th>
73
- ${formatByte(statObj.size)}
74
- </th>
75
- <th>
76
- <a href='./${subItems[i]}' class="btn">访问</a>
77
- <a href='./${subItems[i]}?download' class="btn" download='${subItems[i]}'>下载</a>
78
- </th>
79
- </tr>`;
80
- }
81
- }
82
-
83
- return template_404.replace("${current}", filePath).replace("${template}", template);
1
+ const { readdirSync, lstatSync, readFileSync, statSync } = require("fs");
2
+ const { join } = require("path");
3
+ const { formatByte, formatTime } = require("./format");
4
+ const mineTypes = require("../data/mineTypes.json");
5
+
6
+ const img_folder = "data:image/png;base64," + readFileSync(join(__dirname, "../images/folder.png")).toString('base64');
7
+ const img_file = "data:image/png;base64," + readFileSync(join(__dirname, "../images/file.png")).toString('base64');
8
+
9
+ const template_404 = readFileSync(join(__dirname, "../template/404.html"), {
10
+ encoding: "utf8"
11
+ })
12
+ .replace("${img_folder}", img_folder)
13
+ .replace("${img_file}", img_file);
14
+
15
+ module.exports = function (filePath, url) {
16
+
17
+ let subItems = [];
18
+
19
+ try {
20
+ subItems = readdirSync(filePath);
21
+ console.log("<i> \x1b[1m\x1b[32m[OIPage-dev-server] Read Folder: " + url + '\x1b[0m ' + new Date().toLocaleString());
22
+ } catch (e) {
23
+ console.log("<i> \x1b[1m\x1b[32m[OIPage-dev-server] Read " + (/\/$/.test(url) ? "Folder" : "File") + ": \x1b[35m" + url + ' 404 Not Found\x1b[0m ' + new Date().toLocaleString());
24
+ try {
25
+ if (!/\/$/.test(url) || url === "/") {
26
+ filePath = join(filePath, "../");
27
+ subItems = readdirSync(filePath);
28
+ }
29
+ } catch (e) { }
30
+ }
31
+
32
+ let template = "";
33
+ for (let i in subItems) {
34
+ let isDirectory = lstatSync(join(filePath, subItems[i])).isDirectory();
35
+ let statObj = statSync(join(filePath, subItems[i]));
36
+
37
+ // 文件夹
38
+ if (isDirectory) {
39
+ template += `<tr class="folder">
40
+ <th class="name">
41
+ <a href='./${subItems[i]}/'>${subItems[i]}</a>
42
+ </th>
43
+ <th>
44
+ ${formatTime(statObj.mtime)}
45
+ </th>
46
+ <th>
47
+ 文件夹
48
+ </th>
49
+ <th>
50
+ -
51
+ </th>
52
+ <th>
53
+ <a href='./${subItems[i]}/' class="btn">打开</a>
54
+ </th>
55
+ </tr>`;
56
+ }
57
+
58
+ // 文件
59
+ else {
60
+ let dotName = /\./.test(subItems[i]) ? subItems[i].match(/\.([^.]+)$/)[1] : "";
61
+
62
+ template += `<tr class="file">
63
+ <th class="name">
64
+ <a href='./${subItems[i]}'>${subItems[i]}</a>
65
+ </th>
66
+ <th>
67
+ ${formatTime(statObj.mtime)}
68
+ </th>
69
+ <th>
70
+ ${mineTypes[dotName] || "text/plain"}
71
+ </th>
72
+ <th>
73
+ ${formatByte(statObj.size)}
74
+ </th>
75
+ <th>
76
+ <a href='./${subItems[i]}' class="btn">访问</a>
77
+ <a href='./${subItems[i]}?download' class="btn" download='${subItems[i]}'>下载</a>
78
+ </th>
79
+ </tr>`;
80
+ }
81
+ }
82
+
83
+ return template_404.replace("${current}", filePath).replace("${template}", template);
84
84
  };
@@ -1,20 +1,20 @@
1
- interface animationResult {
2
-
3
- /**
4
- * 一个函数,调用该函数,可以提前结束动画
5
- */
6
- stop(): void
7
- }
8
-
9
- interface animationFun {
10
- (deep: number): void
11
- }
12
-
13
- /**
14
- * 轮询动画
15
- */
16
- export interface animationType {
17
- (doback: animationFun, duration?: number, callback?: animationFun): animationResult
18
- }
19
-
1
+ interface animationResult {
2
+
3
+ /**
4
+ * 一个函数,调用该函数,可以提前结束动画
5
+ */
6
+ stop(): void
7
+ }
8
+
9
+ interface animationFun {
10
+ (deep: number): void
11
+ }
12
+
13
+ /**
14
+ * 轮询动画
15
+ */
16
+ export interface animationType {
17
+ (doback: animationFun, duration?: number, callback?: animationFun): animationResult
18
+ }
19
+
20
20
  export let animation: animationType