1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 00:09:16 +08:00

feat: 修改代码问题

This commit is contained in:
zhengkunwang223 2023-02-01 15:50:39 +08:00 committed by zhengkunwang223
parent 69f71b653d
commit 3c4dd6249a
10 changed files with 42 additions and 104 deletions

View File

@ -19,7 +19,6 @@ import (
"github.com/1Panel-dev/1Panel/backend/utils/compose"
"github.com/1Panel-dev/1Panel/backend/utils/files"
"github.com/1Panel-dev/1Panel/backend/utils/nginx"
"github.com/1Panel-dev/1Panel/backend/utils/nginx/components"
"github.com/1Panel-dev/1Panel/backend/utils/nginx/parser"
"github.com/1Panel-dev/1Panel/cmd/server/nginx_conf"
"github.com/pkg/errors"
@ -245,19 +244,6 @@ func deleteListenAndServerName(website model.Website, ports []int, domains []str
return nginxCheckAndReload(nginxConfig.OldContent, nginxConfig.FilePath, nginxFull.Install.ContainerName)
}
func getKeysFromStaticFile(scope dto.NginxKey) []string {
var res []string
newConfig := &components.Config{}
switch scope {
case dto.SSL:
newConfig = parser.NewStringParser(string(nginx_conf.SSL)).Parse()
}
for _, dir := range newConfig.GetDirectives() {
res = append(res, dir.GetName())
}
return res
}
func createPemFile(website model.Website, websiteSSL model.WebsiteSSL) error {
nginxApp, err := appRepo.GetFirst(appRepo.WithKey(constant.AppNginx))
if err != nil {

View File

@ -8,13 +8,12 @@ import (
)
type manager struct {
thresholdSize int64
startAt time.Time
fire chan string
cr *cron.Cron
context chan int
wg sync.WaitGroup
lock sync.Mutex
startAt time.Time
fire chan string
cr *cron.Cron
context chan int
wg sync.WaitGroup
lock sync.Mutex
}
func (m *manager) Fire() chan string {

View File

@ -2,6 +2,7 @@ package log
import (
"fmt"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/1Panel-dev/1Panel/backend/utils/files"
"io/ioutil"
"log"
@ -41,6 +42,7 @@ func (w *AsynchronousWriter) Close() error {
func() {
defer func() {
if r := recover(); r != nil {
global.LOG.Error(r)
}
}()
w.m.Close()
@ -59,11 +61,11 @@ func (w *AsynchronousWriter) onClose() {
select {
case w.errChan <- err:
default:
_asyncBufferPool.Put(b)
_asyncBufferPool.Put(&b)
return
}
}
_asyncBufferPool.Put(b)
_asyncBufferPool.Put(&b)
default:
return
}
@ -183,7 +185,7 @@ func (w *AsynchronousWriter) writer() {
if _, err = w.file.Write(b); err != nil && len(w.errChan) < cap(w.errChan) {
w.errChan <- err
}
_asyncBufferPool.Put(b)
_asyncBufferPool.Put(&b)
case <-w.ctx:
return
}
@ -191,11 +193,9 @@ func (w *AsynchronousWriter) writer() {
}
func (w *Writer) DoRemove() {
select {
case file := <-w.rollingfilech:
if err := os.Remove(file); err != nil {
log.Println("error in remove log file", file, err)
}
file := <-w.rollingfilech
if err := os.Remove(file); err != nil {
log.Println("error in remove log file", file, err)
}
}

View File

@ -3,16 +3,13 @@ package ssl
import (
"crypto/rand"
"crypto/rsa"
"crypto/tls"
"crypto/x509"
"encoding/pem"
"fmt"
"io/ioutil"
"os"
"strings"
"testing"
"github.com/1Panel-dev/1Panel/backend/utils/cmd"
"github.com/go-acme/lego/v4/acme/api"
"github.com/go-acme/lego/v4/certcrypto"
"github.com/go-acme/lego/v4/certificate"
@ -22,22 +19,6 @@ import (
"github.com/go-acme/lego/v4/registration"
)
type plainDnsProvider struct {
Resolve
}
func (p *plainDnsProvider) Present(domain, token, keyAuth string) error {
fqdn, value := dns01.GetRecord(domain, keyAuth)
p.Key = fqdn
p.Value = value
return nil
}
func (p *plainDnsProvider) CleanUp(domain, token, keyAuth string) error {
fmt.Printf("%s,%s,%s", domain, token, keyAuth)
return nil
}
func TestCreatePrivate(t *testing.T) {
priKey, err := rsa.GenerateKey(rand.Reader, 2048)
if err != nil {
@ -261,27 +242,3 @@ func TestSSL(t *testing.T) {
fmt.Println(cert2)
}
func TestDaoqi(t *testing.T) {
conn, err := tls.Dial("tcp", "1panel.xyz:443", nil)
if err != nil {
panic(err)
}
conn2 := conn.ConnectionState()
fmt.Println(conn2.PeerCertificates[0].NotBefore)
fmt.Println(conn.ConnectionState().PeerCertificates[0].AuthorityKeyId)
fmt.Println(string(conn.ConnectionState().PeerCertificates[0].SubjectKeyId))
}
func Test111(t *testing.T) {
out, err := cmd.Exec("docker exec -i 1Panel-nginx1.23.1-AiCt curl http://127.0.0.1/nginx_status")
if err != nil {
panic(err)
}
outArray := strings.Split(out, " ")
fmt.Println(outArray)
fmt.Println(outArray[8])
}

View File

@ -48,13 +48,11 @@ func (c *Client) Write() {
}()
for {
select {
case message, ok := <-c.Msg:
if !ok {
return
}
_ = c.Socket.WriteMessage(websocket.TextMessage, message)
message, ok := <-c.Msg
if !ok {
return
}
_ = c.Socket.WriteMessage(websocket.TextMessage, message)
}
}

View File

@ -874,6 +874,7 @@ export default {
github: '开源社区',
doc: '文档',
document: '文档说明',
updatePrompt: '当前应用均为最新版本',
},
website: {
website: '网站',

View File

@ -54,7 +54,7 @@
</div>
</slot>
</div>
<div v-if="slots.prompt">
<div v-if="slots.prompt" class="prompt">
<slot name="prompt"></slot>
</div>
<div class="main">
@ -120,6 +120,10 @@ const showBack = computed(() => {
margin-top: 20px;
}
.prompt {
margin-top: 10px;
}
.divider {
margin-top: 20px;
border: 0;

View File

@ -73,3 +73,12 @@
.el-avatar {
--el-avatar-bg-color: #ffffff;
}
.update-prompt {
text-align: center;
span {
font-weight: 500;
font-size: 16px;
color: #bbbfc4;
}
}

View File

@ -39,6 +39,9 @@
<el-button @click="sync" type="primary" link v-if="mode === 'installed'">{{ $t('app.sync') }}</el-button>
</template>
<template #main>
<div class="update-prompt">
<span v-if="mode === 'update'">{{ $t('app.updatePrompt') }}</span>
</div>
<el-row :gutter="5">
<el-col v-for="(installed, index) in data" :key="index" :span="12">
<div class="app-card">

View File

@ -1,8 +1,10 @@
<template>
<el-row>
<el-col :span="2">
<el-button :icon="Back" @click="jump(paths.length - 2)" circle :disabled="paths.length == 0" />
<el-button :icon="Refresh" circle @click="search" />
<div>
<el-button :icon="Back" @click="jump(paths.length - 2)" circle :disabled="paths.length == 0" />
<el-button :icon="Refresh" circle @click="search" />
</div>
</el-col>
<el-col :span="22">
<div class="path">
@ -54,7 +56,7 @@
<el-button plain @click="openDownload" :disabled="selects.length === 0">
{{ $t('file.download') }}
</el-button>
<div class="search-button">
<!-- <div class="search-button">
<el-input
clearable
@clear="search()"
@ -63,7 +65,7 @@
@blur="search()"
:placeholder="$t('commons.button.search')"
></el-input>
</div>
</div> -->
</template>
<template #main>
<ComplexTable :pagination-config="paginationConfig" v-model:selects="selects" :data="data" @search="search">
@ -379,27 +381,6 @@ const openDownload = () => {
downloadRef.value.acceptParams(fileDownload);
};
// const closeDownload = () => {
// downloadPage.open = false;
// search();
// };
// const saveContent = (content: string) => {
// editorPage.loading = true;
// SaveFileContent({ path: codeReq.path, content: content }).finally(() => {
// editorPage.loading = false;
// editorPage.open = false;
// ElMessage.success(i18n.global.t('commons.msg.updateSuccess'));
// });
// };
// const quickSave = (content: string) => {
// editorPage.loading = true;
// SaveFileContent({ path: codeReq.path, content: content }).finally(() => {
// editorPage.loading = false;
// ElMessage.success(i18n.global.t('commons.msg.updateSuccess'));
// });
// };
const openDetail = (row: File.File) => {
detailRef.value.acceptParams({ path: row.path });
};