From ae420a03ed165a90df10b8824e2ec80599cc5dda Mon Sep 17 00:00:00 2001 From: xdzqyyds <2292136545@qq.com> Date: Tue, 10 Dec 2024 16:43:39 +0800 Subject: [PATCH] certs --- certs/server.crt | 23 +++++++++++++++++++++++ certs/server.key | 28 ++++++++++++++++++++++++++++ server/config.go | 2 ++ server/daemon/daemon.go | 2 ++ webapp/lib/api.ts | 3 +-- 5 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 certs/server.crt create mode 100644 certs/server.key diff --git a/certs/server.crt b/certs/server.crt new file mode 100644 index 0000000..ec457cf --- /dev/null +++ b/certs/server.crt @@ -0,0 +1,23 @@ +-----BEGIN CERTIFICATE----- +MIIDzzCCAregAwIBAgIUYV+M7I18m9QQwgYOZUgUwcVU5ZowDQYJKoZIhvcNAQEL +BQAwdzELMAkGA1UEBhMCQ04xEDAOBgNVBAgMB1NoYWFueGkxDTALBgNVBAcMBFhp +YW4xCzAJBgNVBAoMAlhEMQswCQYDVQQLDAJYRDELMAkGA1UEAwwCWEQxIDAeBgkq +hkiG9w0BCQEWETIyOTIxMzY1NDVAcXEuY29tMB4XDTI0MTIxMDA2MDcwOVoXDTM0 +MTIwODA2MDcwOVowdzELMAkGA1UEBhMCQ04xEDAOBgNVBAgMB1NoYWFueGkxDTAL +BgNVBAcMBFhpYW4xCzAJBgNVBAoMAlhEMQswCQYDVQQLDAJYRDELMAkGA1UEAwwC +WEQxIDAeBgkqhkiG9w0BCQEWETIyOTIxMzY1NDVAcXEuY29tMIIBIjANBgkqhkiG +9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuKnS0Zn6GfksxnIzasS3c5ZKbPpkI6nxPLSf +RM3+VHZ4nGQ8mkPht5PydMBldRt8ZCpu7iot6kKDxTl8TI/1+kEYwZBR/6gjRaDq +yGIvUSJ3Oj4whWFvBOfX8DPb1UHI5flqmKDyAOHcDB3b2eV46guNSuPlapscHOF8 +uRaod8vza4fnrGbIPwJv06NvhbuzUVPPux6wvaZlxb8uLo/AdIYmvCBUrNUvrIYp +YGBy6Ap27ehd12uy8z6HuInJjtEyKSzhx1vRZrXIIhvqlQHpkpatjbErY6p0vU5R +GeqhogYrv1ps2NPok8OG28qBWcShBrkjZaPhQFZVR2p4KXPFHQIDAQABo1MwUTAd +BgNVHQ4EFgQU7yN4hsNSPfJ8BfgJG2jDR6nCSJYwHwYDVR0jBBgwFoAU7yN4hsNS +PfJ8BfgJG2jDR6nCSJYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC +AQEAa8ERes+2LNNYf3zzt0hNO6h/oDA6DQBgODCkvjznTbZv5/CWCrd8HDkq4/Pp +w8P1qyAFsSy5Kmi7AGM1O/EPS/Mdq1inoY+aFmcPFeNmBgXcq6nO0Q6dpCQbDmj+ +xhOhnHuSc9klVwRiXmG4cBcpDr6lukgUVaRR9qfJoX0JXwrB+ecV96K1cUBK6iTI +XtBByfuei6/Nuzb7AJ3ykzQkgpBJuNAFvf8AHPTqMmHjJPj9OAJUXdBclad2u668 +Sa5tpCTBTDaaPccfJTCBEeClSmqq4zI4fSb79nd+eYHLF7SRMt5lDi7xOrTuFti1 +5VO8W8xnAhbpaapFlFVEOkItqQ== +-----END CERTIFICATE----- diff --git a/certs/server.key b/certs/server.key new file mode 100644 index 0000000..6fae634 --- /dev/null +++ b/certs/server.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC4qdLRmfoZ+SzG +cjNqxLdzlkps+mQjqfE8tJ9Ezf5UdnicZDyaQ+G3k/J0wGV1G3xkKm7uKi3qQoPF +OXxMj/X6QRjBkFH/qCNFoOrIYi9RInc6PjCFYW8E59fwM9vVQcjl+WqYoPIA4dwM +HdvZ5XjqC41K4+Vqmxwc4Xy5Fqh3y/Nrh+esZsg/Am/To2+Fu7NRU8+7HrC9pmXF +vy4uj8B0hia8IFSs1S+shilgYHLoCnbt6F3Xa7LzPoe4icm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KLdIU2kjWyKq3Q3OG7vfCxv86HDrDKxGuY8uiOrnPnI8RxOBDK7/9/QzrZmP +YK9ByiXqFfJxmU9AUULTLux+Dr9v0R8OS+6xEqSZkQKBgA+22QuvMpouhxf4c37s +aehr4PJL4FLptoreRfrkeM+rDJ2IVnzbnJaCl+2yCTNXZ27ZPIJRW2Ng1/vrMV/P +JV+oCkzrxk9mlfMSTUtmShMk3lbq8l7qv74e+urORyoagkhL3oujxzt4ZV78+3Pb +/JoySJnIOoXj5T1wutsUWfFN +-----END PRIVATE KEY----- diff --git a/server/config.go b/server/config.go index 09ed708..9af2821 100644 --- a/server/config.go +++ b/server/config.go @@ -6,4 +6,6 @@ type Config struct { RedisUrl string `env:"REDIS_URL" envDefault:"redis://localhost:6379/0"` Live777Url string `env:"LIVE777_URL" envDefault:"http://localhost:7777"` Live777Token string `env:"LIVE777_TOKEN" envDefault:""` + CertFile string `env:"CERT_FILE" envDefault:"certs/server.crt"` + KeyFile string `env:"KEY_FILE" envDefault:"certs/server.key"` } diff --git a/server/daemon/daemon.go b/server/daemon/daemon.go index 3899841..f685a0d 100644 --- a/server/daemon/daemon.go +++ b/server/daemon/daemon.go @@ -52,4 +52,6 @@ func Daemon(ctx context.Context) { log.Println("=== started ===") log.Panicln(http.ListenAndServe(":"+cfg.Port, handler)) + //log.Println("=== HTTPS server started ===") + //log.Panicln(http.ListenAndServeTLS(":"+cfg.Port, cfg.CertFile, cfg.KeyFile, handler)) } diff --git a/webapp/lib/api.ts b/webapp/lib/api.ts index 3b84367..1af86ca 100644 --- a/webapp/lib/api.ts +++ b/webapp/lib/api.ts @@ -164,7 +164,6 @@ function sendInvite(meetingId: string, inviterId: string, inviteeId: string): Pr }), }) .then(() => { - // 处理成功后不做任何事,或者可以在此添加日志等 }) .catch((error) => { console.error('Error sending invite:', error) @@ -188,7 +187,7 @@ async function getInvitation(inviteeId: string): Promise