mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 08:19:15 +08:00
feat: 修改代码问题
This commit is contained in:
parent
69f71b653d
commit
3c4dd6249a
@ -19,7 +19,6 @@ import (
|
|||||||
"github.com/1Panel-dev/1Panel/backend/utils/compose"
|
"github.com/1Panel-dev/1Panel/backend/utils/compose"
|
||||||
"github.com/1Panel-dev/1Panel/backend/utils/files"
|
"github.com/1Panel-dev/1Panel/backend/utils/files"
|
||||||
"github.com/1Panel-dev/1Panel/backend/utils/nginx"
|
"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/backend/utils/nginx/parser"
|
||||||
"github.com/1Panel-dev/1Panel/cmd/server/nginx_conf"
|
"github.com/1Panel-dev/1Panel/cmd/server/nginx_conf"
|
||||||
"github.com/pkg/errors"
|
"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)
|
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 {
|
func createPemFile(website model.Website, websiteSSL model.WebsiteSSL) error {
|
||||||
nginxApp, err := appRepo.GetFirst(appRepo.WithKey(constant.AppNginx))
|
nginxApp, err := appRepo.GetFirst(appRepo.WithKey(constant.AppNginx))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -8,13 +8,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type manager struct {
|
type manager struct {
|
||||||
thresholdSize int64
|
startAt time.Time
|
||||||
startAt time.Time
|
fire chan string
|
||||||
fire chan string
|
cr *cron.Cron
|
||||||
cr *cron.Cron
|
context chan int
|
||||||
context chan int
|
wg sync.WaitGroup
|
||||||
wg sync.WaitGroup
|
lock sync.Mutex
|
||||||
lock sync.Mutex
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *manager) Fire() chan string {
|
func (m *manager) Fire() chan string {
|
||||||
|
@ -2,6 +2,7 @@ package log
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/1Panel-dev/1Panel/backend/global"
|
||||||
"github.com/1Panel-dev/1Panel/backend/utils/files"
|
"github.com/1Panel-dev/1Panel/backend/utils/files"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
@ -41,6 +42,7 @@ func (w *AsynchronousWriter) Close() error {
|
|||||||
func() {
|
func() {
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
|
global.LOG.Error(r)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
w.m.Close()
|
w.m.Close()
|
||||||
@ -59,11 +61,11 @@ func (w *AsynchronousWriter) onClose() {
|
|||||||
select {
|
select {
|
||||||
case w.errChan <- err:
|
case w.errChan <- err:
|
||||||
default:
|
default:
|
||||||
_asyncBufferPool.Put(b)
|
_asyncBufferPool.Put(&b)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_asyncBufferPool.Put(b)
|
_asyncBufferPool.Put(&b)
|
||||||
default:
|
default:
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -183,7 +185,7 @@ func (w *AsynchronousWriter) writer() {
|
|||||||
if _, err = w.file.Write(b); err != nil && len(w.errChan) < cap(w.errChan) {
|
if _, err = w.file.Write(b); err != nil && len(w.errChan) < cap(w.errChan) {
|
||||||
w.errChan <- err
|
w.errChan <- err
|
||||||
}
|
}
|
||||||
_asyncBufferPool.Put(b)
|
_asyncBufferPool.Put(&b)
|
||||||
case <-w.ctx:
|
case <-w.ctx:
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -191,11 +193,9 @@ func (w *AsynchronousWriter) writer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (w *Writer) DoRemove() {
|
func (w *Writer) DoRemove() {
|
||||||
select {
|
file := <-w.rollingfilech
|
||||||
case file := <-w.rollingfilech:
|
if err := os.Remove(file); err != nil {
|
||||||
if err := os.Remove(file); err != nil {
|
log.Println("error in remove log file", file, err)
|
||||||
log.Println("error in remove log file", file, err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,16 +3,13 @@ package ssl
|
|||||||
import (
|
import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"crypto/rsa"
|
"crypto/rsa"
|
||||||
"crypto/tls"
|
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/backend/utils/cmd"
|
|
||||||
"github.com/go-acme/lego/v4/acme/api"
|
"github.com/go-acme/lego/v4/acme/api"
|
||||||
"github.com/go-acme/lego/v4/certcrypto"
|
"github.com/go-acme/lego/v4/certcrypto"
|
||||||
"github.com/go-acme/lego/v4/certificate"
|
"github.com/go-acme/lego/v4/certificate"
|
||||||
@ -22,22 +19,6 @@ import (
|
|||||||
"github.com/go-acme/lego/v4/registration"
|
"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) {
|
func TestCreatePrivate(t *testing.T) {
|
||||||
priKey, err := rsa.GenerateKey(rand.Reader, 2048)
|
priKey, err := rsa.GenerateKey(rand.Reader, 2048)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -261,27 +242,3 @@ func TestSSL(t *testing.T) {
|
|||||||
fmt.Println(cert2)
|
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])
|
|
||||||
}
|
|
||||||
|
@ -48,13 +48,11 @@ func (c *Client) Write() {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
message, ok := <-c.Msg
|
||||||
case message, ok := <-c.Msg:
|
if !ok {
|
||||||
if !ok {
|
return
|
||||||
return
|
|
||||||
}
|
|
||||||
_ = c.Socket.WriteMessage(websocket.TextMessage, message)
|
|
||||||
}
|
}
|
||||||
|
_ = c.Socket.WriteMessage(websocket.TextMessage, message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -874,6 +874,7 @@ export default {
|
|||||||
github: '开源社区',
|
github: '开源社区',
|
||||||
doc: '文档',
|
doc: '文档',
|
||||||
document: '文档说明',
|
document: '文档说明',
|
||||||
|
updatePrompt: '当前应用均为最新版本',
|
||||||
},
|
},
|
||||||
website: {
|
website: {
|
||||||
website: '网站',
|
website: '网站',
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</slot>
|
</slot>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="slots.prompt">
|
<div v-if="slots.prompt" class="prompt">
|
||||||
<slot name="prompt"></slot>
|
<slot name="prompt"></slot>
|
||||||
</div>
|
</div>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
@ -120,6 +120,10 @@ const showBack = computed(() => {
|
|||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.prompt {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.divider {
|
.divider {
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
border: 0;
|
border: 0;
|
||||||
|
@ -73,3 +73,12 @@
|
|||||||
.el-avatar {
|
.el-avatar {
|
||||||
--el-avatar-bg-color: #ffffff;
|
--el-avatar-bg-color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.update-prompt {
|
||||||
|
text-align: center;
|
||||||
|
span {
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 16px;
|
||||||
|
color: #bbbfc4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -39,6 +39,9 @@
|
|||||||
<el-button @click="sync" type="primary" link v-if="mode === 'installed'">{{ $t('app.sync') }}</el-button>
|
<el-button @click="sync" type="primary" link v-if="mode === 'installed'">{{ $t('app.sync') }}</el-button>
|
||||||
</template>
|
</template>
|
||||||
<template #main>
|
<template #main>
|
||||||
|
<div class="update-prompt">
|
||||||
|
<span v-if="mode === 'update'">{{ $t('app.updatePrompt') }}</span>
|
||||||
|
</div>
|
||||||
<el-row :gutter="5">
|
<el-row :gutter="5">
|
||||||
<el-col v-for="(installed, index) in data" :key="index" :span="12">
|
<el-col v-for="(installed, index) in data" :key="index" :span="12">
|
||||||
<div class="app-card">
|
<div class="app-card">
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="2">
|
<el-col :span="2">
|
||||||
<el-button :icon="Back" @click="jump(paths.length - 2)" circle :disabled="paths.length == 0" />
|
<div>
|
||||||
<el-button :icon="Refresh" circle @click="search" />
|
<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>
|
||||||
<el-col :span="22">
|
<el-col :span="22">
|
||||||
<div class="path">
|
<div class="path">
|
||||||
@ -54,7 +56,7 @@
|
|||||||
<el-button plain @click="openDownload" :disabled="selects.length === 0">
|
<el-button plain @click="openDownload" :disabled="selects.length === 0">
|
||||||
{{ $t('file.download') }}
|
{{ $t('file.download') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<div class="search-button">
|
<!-- <div class="search-button">
|
||||||
<el-input
|
<el-input
|
||||||
clearable
|
clearable
|
||||||
@clear="search()"
|
@clear="search()"
|
||||||
@ -63,7 +65,7 @@
|
|||||||
@blur="search()"
|
@blur="search()"
|
||||||
:placeholder="$t('commons.button.search')"
|
:placeholder="$t('commons.button.search')"
|
||||||
></el-input>
|
></el-input>
|
||||||
</div>
|
</div> -->
|
||||||
</template>
|
</template>
|
||||||
<template #main>
|
<template #main>
|
||||||
<ComplexTable :pagination-config="paginationConfig" v-model:selects="selects" :data="data" @search="search">
|
<ComplexTable :pagination-config="paginationConfig" v-model:selects="selects" :data="data" @search="search">
|
||||||
@ -379,27 +381,6 @@ const openDownload = () => {
|
|||||||
downloadRef.value.acceptParams(fileDownload);
|
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) => {
|
const openDetail = (row: File.File) => {
|
||||||
detailRef.value.acceptParams({ path: row.path });
|
detailRef.value.acceptParams({ path: row.path });
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user