mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
fix(tls): no certificate available
This commit is contained in:
parent
5864185615
commit
8f7574f212
6 changed files with 41 additions and 6 deletions
|
@ -5,8 +5,8 @@ import type { Key } from 'ant-design-vue/es/_util/type'
|
||||||
import config from '@/api/config'
|
import config from '@/api/config'
|
||||||
import StdPagination from '@/components/StdDesign/StdDataDisplay/StdPagination.vue'
|
import StdPagination from '@/components/StdDesign/StdDataDisplay/StdPagination.vue'
|
||||||
import { message } from 'ant-design-vue'
|
import { message } from 'ant-design-vue'
|
||||||
|
import { defineAsyncComponent } from 'vue'
|
||||||
import { datetime } from '../StdDesign/StdDataDisplay/StdTableTransformer'
|
import { datetime } from '../StdDesign/StdDataDisplay/StdTableTransformer'
|
||||||
import DiffViewer from './DiffViewer.vue'
|
|
||||||
|
|
||||||
// Define props for the component
|
// Define props for the component
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
@ -17,6 +17,19 @@ const props = defineProps<{
|
||||||
const visible = defineModel<boolean>('visible')
|
const visible = defineModel<boolean>('visible')
|
||||||
const currentContent = defineModel<string>('currentContent')
|
const currentContent = defineModel<string>('currentContent')
|
||||||
|
|
||||||
|
// Import DiffViewer asynchronously with loading options
|
||||||
|
const DiffViewer = defineAsyncComponent({
|
||||||
|
loader: () => import('./DiffViewer.vue'),
|
||||||
|
loadingComponent: {
|
||||||
|
template: '<div class="async-loading"><ASpin /></div>',
|
||||||
|
},
|
||||||
|
delay: 200,
|
||||||
|
timeout: 10000,
|
||||||
|
errorComponent: {
|
||||||
|
template: '<div class="async-error"><AAlert type="error" message="Failed to load component" /></div>',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const records = ref<ConfigBackup[]>([])
|
const records = ref<ConfigBackup[]>([])
|
||||||
const showDiffViewer = ref(false)
|
const showDiffViewer = ref(false)
|
||||||
|
@ -186,4 +199,13 @@ const compareButtonText = computed(() => {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.async-loading,
|
||||||
|
.async-error {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
padding: 20px;
|
||||||
|
min-height: 200px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -17,6 +17,9 @@ const emit = defineEmits<{
|
||||||
(e: 'restore'): void
|
(e: 'restore'): void
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
// Import Range class separately to avoid loading the entire ace package
|
||||||
|
const Range = ace.Range
|
||||||
|
|
||||||
// Define modal visibility using defineModel with boolean type
|
// Define modal visibility using defineModel with boolean type
|
||||||
const visible = defineModel<boolean>('visible')
|
const visible = defineModel<boolean>('visible')
|
||||||
// Define currentContent using defineModel
|
// Define currentContent using defineModel
|
||||||
|
@ -253,7 +256,7 @@ function compareAndHighlightLines(leftSession: Ace.EditSession, rightSession: Ac
|
||||||
if (!matchedLeftLines.has(i)) {
|
if (!matchedLeftLines.has(i)) {
|
||||||
leftSession.addGutterDecoration(i, 'ace_gutter-active-line')
|
leftSession.addGutterDecoration(i, 'ace_gutter-active-line')
|
||||||
leftSession.addMarker(
|
leftSession.addMarker(
|
||||||
new ace.Range(i, 0, i, leftLines[i].length || 1),
|
new Range(i, 0, i, leftLines[i].length || 1),
|
||||||
'diff-line-deleted',
|
'diff-line-deleted',
|
||||||
'fullLine',
|
'fullLine',
|
||||||
)
|
)
|
||||||
|
@ -265,7 +268,7 @@ function compareAndHighlightLines(leftSession: Ace.EditSession, rightSession: Ac
|
||||||
if (!matchedRightLines.has(j)) {
|
if (!matchedRightLines.has(j)) {
|
||||||
rightSession.addGutterDecoration(j, 'ace_gutter-active-line')
|
rightSession.addGutterDecoration(j, 'ace_gutter-active-line')
|
||||||
rightSession.addMarker(
|
rightSession.addMarker(
|
||||||
new ace.Range(j, 0, j, rightLines[j].length || 1),
|
new Range(j, 0, j, rightLines[j].length || 1),
|
||||||
'diff-line-added',
|
'diff-line-added',
|
||||||
'fullLine',
|
'fullLine',
|
||||||
)
|
)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"version":"2.0.0-rc.5","build_id":4,"total_build":398}
|
{"version":"2.0.0-rc.5","build_id":9,"total_build":403}
|
|
@ -103,6 +103,14 @@ export default defineConfig(({ mode }) => {
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
chunkSizeWarningLimit: 1000,
|
chunkSizeWarningLimit: 1000,
|
||||||
|
rollupOptions: {
|
||||||
|
output: {
|
||||||
|
manualChunks: {
|
||||||
|
'ace-editor': ['ace-builds'],
|
||||||
|
'ace-ext': ['ace-builds/src-min-noconflict/ext-language_tools'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -22,7 +22,7 @@ func ReloadServerTLSCertificate() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
tlsCert.Store(newCert)
|
tlsCert.Store(&newCert)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
main.go
4
main.go
|
@ -75,12 +75,14 @@ func Program(confPath string) func(state overseer.State) {
|
||||||
GetCertificate: func(clientHello *tls.ClientHelloInfo) (*tls.Certificate, error) {
|
GetCertificate: func(clientHello *tls.ClientHelloInfo) (*tls.Certificate, error) {
|
||||||
return cert.GetServerTLSCertificate()
|
return cert.GetServerTLSCertificate()
|
||||||
},
|
},
|
||||||
|
MinVersion: tls.VersionTLS12,
|
||||||
}
|
}
|
||||||
|
|
||||||
srv.TLSConfig = tlsConfig
|
srv.TLSConfig = tlsConfig
|
||||||
|
|
||||||
logger.Info("Starting HTTPS server")
|
logger.Info("Starting HTTPS server")
|
||||||
err = srv.ServeTLS(state.Listener, "", "")
|
tlsListener := tls.NewListener(state.Listener, tlsConfig)
|
||||||
|
err = srv.Serve(tlsListener)
|
||||||
} else {
|
} else {
|
||||||
logger.Info("Starting HTTP server")
|
logger.Info("Starting HTTP server")
|
||||||
err = srv.Serve(state.Listener)
|
err = srv.Serve(state.Listener)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue