Skip to content

Commit 842508c

Browse files
committed
移动端上传文件
1 parent ad09d24 commit 842508c

File tree

6 files changed

+124
-8023
lines changed

6 files changed

+124
-8023
lines changed

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- run: CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o pptter_mac_amd64
2020
- run: CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -o pptter_linux_arm
2121
- run: CGO_ENABLED=0 GOOS=windows GOARCH=arm go build -o pptter_windows_arm.exe
22-
#- run: CGO_ENABLED=0 GOOS=darwin GOARCH=arm go build -o pptter_mac_arm
22+
- run: CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o pptter_mac_arm
2323
#- run: zip pptter-windows-amd64.zip pptter_windows_amd64.exe key.key crt.crt
2424
#- run: zip pptter-linux-amd64.zip pptter_linux_amd64 key.key crt.crt
2525
#- run: zip pptter-mac-amd64.zip pptter_mac_amd64 key.key crt.crt
@@ -36,4 +36,4 @@ jobs:
3636
pptter_mac_amd64
3737
pptter_windows_arm.exe
3838
pptter_linux_arm
39-
#pptter_mac_arm
39+
pptter_mac_arm

assets/css/index.css

Lines changed: 91 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ html {
22
height: 100%;
33
}
44

5+
56
body {
67
height: 100%;
78
display: grid;
@@ -12,16 +13,87 @@ body {
1213
overflow: hidden;
1314
}
1415

15-
svg:hover{
16-
stroke: rgb(85, 227, 189);
17-
}
16+
#seldomlayout {
17+
grid-area: 1/1/21/37;
18+
display: grid;
19+
grid-template-columns: repeat(36, 1fr);
20+
grid-template-rows: repeat(20, 1fr);
21+
z-index: 1;
22+
pointer-events: none;
23+
display: none;
24+
}
25+
26+
#info,
27+
#notification{
28+
grid-area: 2/10/4/26;
29+
display: flex;
30+
background-color: #fff;
31+
opacity: 1;
32+
transition-duration: .75s;
33+
transition-property: opacity;
34+
border-radius: 10px;
35+
box-shadow: 0 0 10px rgb(0 0 0 / 50%);
36+
align-items: center;
37+
justify-content: center;
38+
}
1839

19-
.shadow {
40+
#info{
41+
display: none;
42+
grid-area: 8/13/12/23;
43+
}
44+
45+
46+
#shadow {
2047
grid-area: 3 / 8 / 19 / 30;
2148
border-radius: 10px;
22-
box-shadow: 0px 0px 60px rgb(0 0 0 / 50%);
49+
box-shadow: 0 0 60px rgb(0 0 0 / 50%);
2350
}
2451

52+
#emojibox{
53+
grid-area: 13/14/18/20;
54+
background-color: #9b9b9b;
55+
display: grid;
56+
grid-template-areas:
57+
"a a a a"
58+
"a a a a"
59+
"a a a a"
60+
"w x y z";
61+
column-gap: 2%;
62+
align-items: center;
63+
justify-items: center;
64+
}
65+
66+
#emojibox .content{
67+
width:100%;
68+
height: 100%;
69+
margin: 10px;
70+
border-radius: 10px;
71+
grid-area: a;
72+
background-color: white;
73+
}
74+
75+
#emojibox .emojis{
76+
height: 100%;
77+
grid-area: w;
78+
background-color: white;
79+
}
80+
81+
#emojibox .huaji{
82+
grid-area: x;
83+
background-color: white;
84+
}
85+
86+
#emojibox .setu{
87+
grid-area: y;
88+
background-color: white;
89+
}
90+
91+
#emojibox .beiyong{
92+
grid-area: z;
93+
background-color: white;
94+
}
95+
96+
2597
.sidebar {
2698
grid-area: 3 / 8 / 19 / 9;
2799
background-color: rgb(5 159 149 / 80%);
@@ -164,9 +236,14 @@ h3 span {
164236
grid-area: 18 / 14 / 19 / 30;
165237
background-color: rgb(255 255 255 / 80%);
166238
border-bottom-right-radius: 10px;
239+
167240
backdrop-filter: blur(6px);
168241
}
169242

243+
.icon-tabler-file-upload{
244+
display: none;
245+
}
246+
170247
.inputarea form {
171248
flex-grow: 20;
172249
}
@@ -262,33 +339,19 @@ h3 span {
262339
margin-right: 1%;
263340
}
264341

265-
#info,
266-
#notification{
267-
grid-area: 2/10/3/26;
268-
display: flex;
269-
background-color: #fff;
270-
opacity: 1;
271-
transition-duration: .75s;
272-
transition-property: opacity;
273-
border-radius: 10px;
274-
box-shadow: 0px 0px 10px rgb(0 0 0 / 50%);
275-
z-index: 100;
276-
align-items: center;
277-
justify-content: center;
278-
}
279342

280-
#info{
281-
display: none;
282-
grid-area: 8/13/12/23;
283-
}
284343

285344
.avatar{
286345
pointer-events:none;
287346
}
288347

348+
.icon:hover{
349+
stroke: rgb(85, 227, 189);
350+
}
351+
289352

290353
@media screen and (max-width: 780px) {
291-
.shadow{
354+
#shadow{
292355
display: none;
293356
}
294357

@@ -320,4 +383,8 @@ h3 span {
320383
grid-area: 19 / 1 / 21 / 37;
321384
border-radius: 0;
322385
}
386+
387+
.icon-tabler-file-upload{
388+
display: block;
389+
}
323390
}

assets/index.html

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,20 @@
1616
</style>
1717
</head>
1818
<body>
19-
<div id="info">
20-
<h3>关于</h3>
21-
<h5></h5>
19+
<div id="seldomlayout">
20+
<div id="info">
21+
<h3>关于</h3>
22+
<h5></h5>
23+
</div>
24+
<div id="shadow"></div>
25+
<div id="emojibox">
26+
<div class="content"></div>
27+
<div class="emojis">emoji</div>
28+
<div class="huaji">滑稽</div>
29+
<div class="setu">GKD</div>
30+
<div class="beiyong">备用</div>
31+
</div>
2232
</div>
23-
<div class="shadow"></div>
2433
<div class="sidebar">
2534
<div class="list"></div>
2635
<div class="info">
@@ -132,7 +141,7 @@ <h3>{{.GroupName}} <span>({{.Usercount}})</span></h3>
132141
<form autocomplete="off" class="form--m6M1I" οnkeydοwn="return false">
133142
<input class="input" id="inputext" maxlength="2048" placeholder="随便聊点啥吧,支持拖拽或粘贴文件上传" type="text">
134143
</form>
135-
<svg class="icon icon-tabler icon-tabler-file-upload" fill="none" height="30" stroke="#9e9e9e" style="display: none"
144+
<svg class="icon icon-tabler icon-tabler-file-upload" fill="none" height="30" stroke="#9e9e9e"
136145
stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" width="30"
137146
xmlns="http://www.w3.org/2000/svg">
138147
<path d="M0 0h24v24H0z" fill="none" stroke="none"/>
@@ -153,8 +162,7 @@ <h3>{{.GroupName}} <span>({{.Usercount}})</span></h3>
153162
<script src="/assets/js/index.js"></script>
154163
<script src="/assets/js/venobox.min.js"></script>
155164
<script src="/assets/js/crc32.js" async></script>
156-
<script src="/assets/js/vanillaEmojiPicker.js" async></script>
157-
<script src="/assets/js/emoji-popover.es.js"></script>
165+
<script src="/assets/js/emoji-popover.es.js" async></script>
158166
<script src="/assets/js/reconnecting-websocket.min.js" type="text/javascript"></script>
159167
<script>
160168
const socket = new ReconnectingWebSocket(((window.location.protocol === "https:") ? "wss://" : "ws://") + window.location.host + "/ws");
@@ -275,13 +283,11 @@ <h3>{{.GroupName}} <span>({{.Usercount}})</span></h3>
275283
})
276284
//分享
277285
btn[3].addEventListener("click", function () {
278-
if (navigator.clipboard) {
279-
navigator.clipboard.writeText(location);
280-
}
286+
if (navigator.clipboard) {navigator.clipboard.writeText(location)}
281287
var x = document.createElement('div')
282288
x.setAttribute("id","notification")
283289
x.innerText="已复制到剪贴板,去邀请其他人加入群组吧"
284-
document.body.append(x)
290+
document.getElementById("seldomlayout").append(x)
285291
setTimeout(function() {document.getElementById("notification").style.opacity=0}, 750)
286292
setTimeout(function() {document.getElementById("notification").remove()}, 1500)
287293

@@ -291,9 +297,11 @@ <h3>{{.GroupName}} <span>({{.Usercount}})</span></h3>
291297
// alert(4)
292298
// })
293299
btn[5].addEventListener("click", function () {
294-
//<input id="uploadfile" type="file" name="file" style="display: none">
295300
var x = document.createElement('input')
296301
x.setAttribute("type","file")
302+
x.addEventListener('change',()=>{
303+
socket.send(x.files[0])
304+
})
297305
x.click()
298306
})
299307
btn[6].addEventListener("click", message.send)
@@ -312,16 +320,4 @@ <h3>{{.GroupName}} <span>({{.Usercount}})</span></h3>
312320
})
313321
})
314322
</script>
315-
<script>
316-
var margin = 10,
317-
instance1 = new emojiButtonList( "emoji", {
318-
dropDownXAlign: "left",
319-
textBoxID: "inputext",
320-
yAlignMargin: margin,
321-
xAlignMargin: margin
322-
} );
323-
function emojiClickEvent( emojiText ) {
324-
document.title += " " + emojiText;
325-
}
326-
</script>
327323
</html>

assets/js/emoji-popover.es.js

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)