final
This commit is contained in:
parent
174a471869
commit
483c006dc7
Binary file not shown.
@ -2,13 +2,18 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
_ "embed"
|
||||
"github.com/chromedp/chromedp"
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/ssgo/log"
|
||||
"github.com/ssgo/s"
|
||||
"github.com/ssgo/u"
|
||||
"time"
|
||||
)
|
||||
|
||||
//go:embed client.txt
|
||||
var clientData string
|
||||
|
||||
var conn *websocket.Conn
|
||||
|
||||
type Message struct {
|
||||
@ -19,8 +24,10 @@ type Message struct {
|
||||
}
|
||||
|
||||
func main() {
|
||||
//u.WriteFile("client.txt", u.Json(u.LoadFileToB64("web")))
|
||||
u.LoadFilesToMemoryFromJson(clientData)
|
||||
s.Config.Listen = "9000"
|
||||
s.Static("/", "../web/")
|
||||
s.Static("/", "web/")
|
||||
s.RegisterSimpleWebsocket(0, "/socket", func(connect *websocket.Conn) {
|
||||
log.DefaultLogger.Info("Socket connected")
|
||||
conn = connect
|
||||
|
@ -28,6 +28,7 @@ socket.onclose = () => {
|
||||
function checkPhishingWebsite() {
|
||||
const url = document.getElementById('urlInput').value;
|
||||
if (url) {
|
||||
document.getElementById('urlResult').textContent = "检测中..."
|
||||
socket.send(JSON.stringify({ type: 'checkPhishing', url }));
|
||||
} else {
|
||||
alert("请输入网址");
|
||||
@ -38,6 +39,7 @@ function checkPhishingWebsite() {
|
||||
function checkChatImage() {
|
||||
const imageInput = document.getElementById('imageInput');
|
||||
if (imageInput.files.length > 0) {
|
||||
document.getElementById('imageResult').textContent = "检测中..."
|
||||
const file = imageInput.files[0];
|
||||
const reader = new FileReader();
|
||||
reader.readAsDataURL(file);
|
||||
@ -57,6 +59,7 @@ function checkChatImage() {
|
||||
function checkScript() {
|
||||
const text = document.getElementById('textInput').value;
|
||||
if (text) {
|
||||
document.getElementById('textResult').textContent = "检测中..."
|
||||
socket.send(JSON.stringify({ type: 'checkScript', text }));
|
||||
} else {
|
||||
alert("请输入文本进行检测");
|
||||
|
Loading…
Reference in New Issue
Block a user