@lazycatcloud/lzc-cli 1.1.0
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.
- package/README.md +21 -0
- package/lib/api.js +123 -0
- package/lib/archiver.js +128 -0
- package/lib/builder.js +183 -0
- package/lib/dev.js +300 -0
- package/lib/docker/promise.js +91 -0
- package/lib/docker-compose.js +51 -0
- package/lib/env.js +104 -0
- package/lib/generator.js +115 -0
- package/lib/key.js +112 -0
- package/lib/sdk.js +129 -0
- package/lib/utils.js +349 -0
- package/package.json +53 -0
- package/scripts/cli.js +98 -0
- package/template/_lazycat/_gitignore +1 -0
- package/template/_lazycat/debug/devforward/50x.html +30 -0
- package/template/_lazycat/debug/devforward/Dockerfile +16 -0
- package/template/_lazycat/debug/devforward/docker-compose.override.yml.in +11 -0
- package/template/_lazycat/debug/devforward/entrypoint.sh +10 -0
- package/template/_lazycat/debug/devforward/nginx.conf.template +56 -0
- package/template/_lazycat/debug/devforward/sshd_config +116 -0
- package/template/_lazycat/debug/shell/50x.html +32 -0
- package/template/_lazycat/debug/shell/Dockerfile +16 -0
- package/template/_lazycat/debug/shell/build.sh +15 -0
- package/template/_lazycat/debug/shell/docker-compose.override.yml.in +23 -0
- package/template/_lazycat/debug/shell/entrypoint.sh +10 -0
- package/template/_lazycat/debug/shell/nginx.conf.template +64 -0
- package/template/_lazycat/debug/shell/sshd_config +117 -0
- package/template/_lazycat/docker-compose.yml.in +17 -0
- package/template/_lazycat/icon.svg +1 -0
- package/template/_lazycat/screenshot.png +0 -0
- package/template/golang/.godir +1 -0
- package/template/golang/README.md +13 -0
- package/template/golang/assets/css/bootstrap-responsive.css +1088 -0
- package/template/golang/assets/css/bootstrap-responsive.min.css +9 -0
- package/template/golang/assets/css/bootstrap.css +5893 -0
- package/template/golang/assets/css/bootstrap.min.css +9 -0
- package/template/golang/assets/css/rego.css +45 -0
- package/template/golang/assets/img/glyphicons-halflings-white.png +0 -0
- package/template/golang/assets/img/glyphicons-halflings.png +0 -0
- package/template/golang/assets/js/bootstrap.js +2025 -0
- package/template/golang/assets/js/bootstrap.min.js +6 -0
- package/template/golang/assets/js/rego.js +121 -0
- package/template/golang/go.mod +3 -0
- package/template/golang/index.html +267 -0
- package/template/golang/rego.go +83 -0
- package/template/release/golang/Dockerfile +18 -0
- package/template/release/golang/build.sh +14 -0
- package/template/release/vue/Dockerfile +9 -0
- package/template/release/vue/build.sh +9 -0
- package/template/release/vue/docker-compose.yml.in +8 -0
- package/template/vue/README.md +24 -0
- package/template/vue/_dockerignore +1 -0
- package/template/vue/babel.config.js +5 -0
- package/template/vue/package.json +43 -0
- package/template/vue/public/favicon.ico +0 -0
- package/template/vue/public/index.html +33 -0
- package/template/vue/src/App.vue +39 -0
- package/template/vue/src/lzc.js +110 -0
- package/template/vue/src/main.js +19 -0
- package/template/vue/src/todo.vue +640 -0
- package/template/vue/src/top-bar.vue +100 -0
- package/template/vue/src/webdav.vue +183 -0
- package/template/vue/vue.config.js +5 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="webdav">
|
|
3
|
+
<div class="fm-title">
|
|
4
|
+
<div class="fm-title-path">
|
|
5
|
+
当前路径:
|
|
6
|
+
<span>{{ pwd }}</span>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<div class="fm-content">
|
|
11
|
+
<table>
|
|
12
|
+
<thead>
|
|
13
|
+
<tr>
|
|
14
|
+
<th>MIME类型</th>
|
|
15
|
+
<th>最后更新</th>
|
|
16
|
+
<th>大小</th>
|
|
17
|
+
<th>是否文件夹</th>
|
|
18
|
+
<th>文件名</th>
|
|
19
|
+
</tr>
|
|
20
|
+
</thead>
|
|
21
|
+
<tbody>
|
|
22
|
+
<tr>
|
|
23
|
+
<td></td>
|
|
24
|
+
<td></td>
|
|
25
|
+
<td></td>
|
|
26
|
+
<td></td>
|
|
27
|
+
<td class="fm-arrow" @click="handleLast">↵..</td>
|
|
28
|
+
</tr>
|
|
29
|
+
<tr
|
|
30
|
+
v-for="item in items"
|
|
31
|
+
:key="item.filename"
|
|
32
|
+
:title="`文件路径: ` + item.filename"
|
|
33
|
+
>
|
|
34
|
+
<td>{{ item.mime || "-" }}</td>
|
|
35
|
+
<td>{{ item.lastmod }}</td>
|
|
36
|
+
<td>{{ item.size }}</td>
|
|
37
|
+
<td>{{ item.type === "directory" ? "是" : "否" }}</td>
|
|
38
|
+
<td
|
|
39
|
+
:class="[item.type === 'directory' ? 'is-dir' : 'is-file']"
|
|
40
|
+
@click="handleFile(item)"
|
|
41
|
+
>
|
|
42
|
+
{{ item.basename }}
|
|
43
|
+
</td>
|
|
44
|
+
<td class="fm-delete" @click="handleDelete(item)">✗</td>
|
|
45
|
+
</tr>
|
|
46
|
+
</tbody>
|
|
47
|
+
</table>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<div class="fm-bottom"></div>
|
|
51
|
+
</div>
|
|
52
|
+
</template>
|
|
53
|
+
|
|
54
|
+
<script>
|
|
55
|
+
function pathJoin(path1, path2) {
|
|
56
|
+
let res = path1 + "/" + path2;
|
|
57
|
+
return (
|
|
58
|
+
"/" +
|
|
59
|
+
res
|
|
60
|
+
.split("/")
|
|
61
|
+
.filter((r) => r !== "")
|
|
62
|
+
.join("/")
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default {
|
|
67
|
+
async mounted() {
|
|
68
|
+
this.enterDir(this.pwd);
|
|
69
|
+
},
|
|
70
|
+
data() {
|
|
71
|
+
return {
|
|
72
|
+
pwd: "/",
|
|
73
|
+
items: [],
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
methods: {
|
|
77
|
+
async isDir(path) {
|
|
78
|
+
try {
|
|
79
|
+
let res = await this.$lzc.fs.stat(path);
|
|
80
|
+
return res.type === "directory";
|
|
81
|
+
} catch (e) {
|
|
82
|
+
return Promise.reject(e);
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
toPwd(path) {
|
|
86
|
+
let p;
|
|
87
|
+
if (path.startsWith("/")) {
|
|
88
|
+
p = path;
|
|
89
|
+
} else {
|
|
90
|
+
p = pathJoin(this.pwd, path);
|
|
91
|
+
}
|
|
92
|
+
return p;
|
|
93
|
+
},
|
|
94
|
+
enterDir(path) {
|
|
95
|
+
return this.$lzc.fs
|
|
96
|
+
.getDirectoryContents(path)
|
|
97
|
+
.then((res) => {
|
|
98
|
+
this.items = res;
|
|
99
|
+
this.pwd = path;
|
|
100
|
+
})
|
|
101
|
+
.catch((err) => console.error(err));
|
|
102
|
+
},
|
|
103
|
+
download(path) {
|
|
104
|
+
let res = this.$lzc.fs.getFileDownloadLink(path);
|
|
105
|
+
let basename = path.split("/").reverse()[0];
|
|
106
|
+
let a = document.createElement("a");
|
|
107
|
+
a.href = res;
|
|
108
|
+
a.download = basename;
|
|
109
|
+
a.click();
|
|
110
|
+
},
|
|
111
|
+
handleFile(item) {
|
|
112
|
+
if (item.type === "directory") {
|
|
113
|
+
return this.enterDir(this.toPwd(item.basename));
|
|
114
|
+
} else {
|
|
115
|
+
return this.download(this.toPwd(item.basename));
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
handleLast() {
|
|
119
|
+
let res = this.pwd.split("/").reverse().slice(1);
|
|
120
|
+
this.enterDir("/" + res.reverse().join("/"));
|
|
121
|
+
},
|
|
122
|
+
handleDelete(item) {
|
|
123
|
+
this.$lzc.fs
|
|
124
|
+
.deleteFile(item.filename)
|
|
125
|
+
.then(() => {
|
|
126
|
+
this.enterDir(this.pwd);
|
|
127
|
+
})
|
|
128
|
+
.catch((e) => {
|
|
129
|
+
console.error(e);
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
</script>
|
|
135
|
+
|
|
136
|
+
<style scoped>
|
|
137
|
+
.webdav {
|
|
138
|
+
width: 100%;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.fm-title {
|
|
142
|
+
margin: 14px;
|
|
143
|
+
}
|
|
144
|
+
.fm-title-path {
|
|
145
|
+
display: flex;
|
|
146
|
+
flex-direction: row;
|
|
147
|
+
}
|
|
148
|
+
.fm-title-path span {
|
|
149
|
+
margin-left: 14px;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.fm-item {
|
|
153
|
+
display: flex;
|
|
154
|
+
flex-direction: row;
|
|
155
|
+
}
|
|
156
|
+
.fm-content {
|
|
157
|
+
margin: 14px;
|
|
158
|
+
}
|
|
159
|
+
th,
|
|
160
|
+
td {
|
|
161
|
+
padding: 0 14px;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.is-dir {
|
|
165
|
+
color: #3daee9;
|
|
166
|
+
cursor: pointer;
|
|
167
|
+
}
|
|
168
|
+
.is-file {
|
|
169
|
+
color: #1cdc9a;
|
|
170
|
+
cursor: pointer;
|
|
171
|
+
}
|
|
172
|
+
.is-dir:hover {
|
|
173
|
+
text-decoration: underline;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.fm-arrow {
|
|
177
|
+
color: #da4453;
|
|
178
|
+
}
|
|
179
|
+
.fm-delete {
|
|
180
|
+
color: #da4453;
|
|
181
|
+
cursor: pointer;
|
|
182
|
+
}
|
|
183
|
+
</style>
|