mirror of
https://github.com/blossom-editor/blossom
synced 2024-11-17 22:48:03 +08:00
规范代码
This commit is contained in:
parent
4944ef9801
commit
dff1ea8ea7
@ -21,7 +21,6 @@ public class PropertiesCheckListener implements ApplicationListener<ApplicationE
|
|||||||
log.warn("\n\n正在检查 Blossom 后台配置项\n\n" +
|
log.warn("\n\n正在检查 Blossom 后台配置项\n\n" +
|
||||||
"\n[CHECK] ==========================================================================================================================" +
|
"\n[CHECK] ==========================================================================================================================" +
|
||||||
"\n[CHECK] 使用环境: [{}], 版本: [{}]" +
|
"\n[CHECK] 使用环境: [{}], 版本: [{}]" +
|
||||||
"\n[CHECK] 访问地址: http://127.0.0.1:{}{}" +
|
|
||||||
"\n[CHECK] ==========================================================================================================================" +
|
"\n[CHECK] ==========================================================================================================================" +
|
||||||
"\n[CHECK] 数据库配置: {}" +
|
"\n[CHECK] 数据库配置: {}" +
|
||||||
"\n[CHECK] 数据库用户: {}" +
|
"\n[CHECK] 数据库用户: {}" +
|
||||||
@ -30,7 +29,6 @@ public class PropertiesCheckListener implements ApplicationListener<ApplicationE
|
|||||||
"\n[CHECK] 图片存储: {}" +
|
"\n[CHECK] 图片存储: {}" +
|
||||||
"\n[CHECK] ==========================================================================================================================\n\n",
|
"\n[CHECK] ==========================================================================================================================\n\n",
|
||||||
get(env, SpringUtil.PROFILE_ACTION), get(env, "project.base.version"),
|
get(env, SpringUtil.PROFILE_ACTION), get(env, "project.base.version"),
|
||||||
get(env, SpringUtil.SERVER_PORT), StrUtil.isBlank(get(env, SpringUtil.SERVLET_CONTEXT_PATH)) ? "" : get(env, SpringUtil.SERVLET_CONTEXT_PATH),
|
|
||||||
get(env, "spring.datasource.url"),
|
get(env, "spring.datasource.url"),
|
||||||
get(env, "spring.datasource.username"),
|
get(env, "spring.datasource.username"),
|
||||||
get(env, "spring.datasource.password"),
|
get(env, "spring.datasource.password"),
|
||||||
|
@ -86,7 +86,7 @@ public class PictureBlosController {
|
|||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkFileName(String filename) {
|
private void checkFilename(String filename) {
|
||||||
if (StrUtil.isBlank(filename)) {
|
if (StrUtil.isBlank(filename)) {
|
||||||
throw new XzException400("未知文件");
|
throw new XzException400("未知文件");
|
||||||
}
|
}
|
||||||
@ -94,7 +94,6 @@ public class PictureBlosController {
|
|||||||
// 如果图片前缀不是配置的前缀,则去数据库查询文件是否上传过。
|
// 如果图片前缀不是配置的前缀,则去数据库查询文件是否上传过。
|
||||||
throw new XzException400("无法访问");
|
throw new XzException400("无法访问");
|
||||||
}
|
}
|
||||||
System.out.println(FileUtil.exist(filename));
|
|
||||||
if (!FileUtil.exist(filename)) {
|
if (!FileUtil.exist(filename)) {
|
||||||
throw new XzException400("未知文件");
|
throw new XzException400("未知文件");
|
||||||
}
|
}
|
||||||
@ -110,7 +109,7 @@ public class PictureBlosController {
|
|||||||
public ResponseEntity<StreamingResponseBody> getFile(@PathVariable String filename,
|
public ResponseEntity<StreamingResponseBody> getFile(@PathVariable String filename,
|
||||||
HttpServletRequest request, HttpServletResponse resp) {
|
HttpServletRequest request, HttpServletResponse resp) {
|
||||||
filename = getFilename(filename, request);
|
filename = getFilename(filename, request);
|
||||||
checkFileName(filename);
|
checkFilename(filename);
|
||||||
// sendfile 方式下载图片
|
// sendfile 方式下载图片
|
||||||
sendfile(filename, resp);
|
sendfile(filename, resp);
|
||||||
return ResponseEntity.ok(null);
|
return ResponseEntity.ok(null);
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
#server:
|
|
||||||
# servlet:
|
|
||||||
# context-path: /dev
|
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
@ -78,6 +74,6 @@ project:
|
|||||||
os-type: blossom
|
os-type: blossom
|
||||||
blos:
|
blos:
|
||||||
# 请以 /pic 结尾, 如果你在 nginx 中配置有代理, 注意别忘了添加你的代理路径
|
# 请以 /pic 结尾, 如果你在 nginx 中配置有代理, 注意别忘了添加你的代理路径
|
||||||
domain: "http://localhost:9999/dev/pic/"
|
domain: "http://localhost:9999/pic/"
|
||||||
# 请以 / 开头, / 结尾, 简短的路径在文章中有更好的显示效果, 过长一定程度会使文章内容混乱
|
# 请以 / 开头, / 结尾, 简短的路径在文章中有更好的显示效果, 过长一定程度会使文章内容混乱
|
||||||
default-path: "/home/bl/img/"
|
default-path: "/home/bl/img/"
|
@ -420,8 +420,6 @@ export const initOnWindow = (window: BrowserWindow) => {
|
|||||||
*/
|
*/
|
||||||
window.webContents.setWindowOpenHandler((details: HandlerDetails): any => {
|
window.webContents.setWindowOpenHandler((details: HandlerDetails): any => {
|
||||||
let url = details.url as string
|
let url = details.url as string
|
||||||
console.log(url)
|
|
||||||
|
|
||||||
if (blossomUserinfo && url.startsWith(blossomUserinfo.params.WEB_ARTICLE_URL)) {
|
if (blossomUserinfo && url.startsWith(blossomUserinfo.params.WEB_ARTICLE_URL)) {
|
||||||
let articleId: string = url.replaceAll(blossomUserinfo.params.WEB_ARTICLE_URL, '')
|
let articleId: string = url.replaceAll(blossomUserinfo.params.WEB_ARTICLE_URL, '')
|
||||||
createNewWindow('article', articleId, Number(articleId))
|
createNewWindow('article', articleId, Number(articleId))
|
||||||
@ -439,7 +437,6 @@ export const initOnWindow = (window: BrowserWindow) => {
|
|||||||
*/
|
*/
|
||||||
const interceptorATag = (e: Event, url: string): boolean => {
|
const interceptorATag = (e: Event, url: string): boolean => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
console.log(`[${new Date()}] electron 执行 <a/> 标签拦截器`)
|
|
||||||
let innerUrl = url
|
let innerUrl = url
|
||||||
if (blossomUserinfo && innerUrl.startsWith(blossomUserinfo.params.WEB_ARTICLE_URL)) {
|
if (blossomUserinfo && innerUrl.startsWith(blossomUserinfo.params.WEB_ARTICLE_URL)) {
|
||||||
let articleId: string = innerUrl.replaceAll(blossomUserinfo.params.WEB_ARTICLE_URL, '')
|
let articleId: string = innerUrl.replaceAll(blossomUserinfo.params.WEB_ARTICLE_URL, '')
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
|
<link rel="icon" href="/favicon.png" />
|
||||||
<meta name="referrer" content="no-referrer" />
|
<meta name="referrer" content="no-referrer" />
|
||||||
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
|
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
|
||||||
<meta
|
<meta
|
||||||
@ -37,9 +38,6 @@
|
|||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
/* background-image: linear-gradient(to bottom right, #a59aca, #5f479a); */
|
|
||||||
/* background-image: linear-gradient(135deg, #bdc3c7, #2c3e50); */
|
|
||||||
/* background-image: linear-gradient(135deg, #bbd2c5, #536976, #292e49); */
|
|
||||||
background-image: linear-gradient(135deg, #fff, #fff, #f5f5f5);
|
background-image: linear-gradient(135deg, #fff, #fff, #f5f5f5);
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
z-index: 999999;
|
z-index: 999999;
|
||||||
|
BIN
blossom-editor/src/renderer/public/favicon.png
Normal file
BIN
blossom-editor/src/renderer/public/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
@ -145,12 +145,8 @@ export const writeText = (text: string): void => {
|
|||||||
const blob = new Blob([text], { type })
|
const blob = new Blob([text], { type })
|
||||||
const data = [new ClipboardItem({ [type]: blob })]
|
const data = [new ClipboardItem({ [type]: blob })]
|
||||||
navigator.clipboard.write(data).then(
|
navigator.clipboard.write(data).then(
|
||||||
() => {
|
() => {},
|
||||||
console.log('write success')
|
() => {}
|
||||||
},
|
|
||||||
() => {
|
|
||||||
console.log('write failure ')
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
let textArea = document.createElement('textarea')
|
let textArea = document.createElement('textarea')
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
import hljs from 'highlight.js'
|
|
||||||
|
|
||||||
hljs.addPlugin({
|
|
||||||
'after:highlight': (el) => {
|
|
||||||
// console.log(el.value);
|
|
||||||
// let result = '<ol>'
|
|
||||||
let lines: any[] = el.value.split(/\n|\r\n?|\n\n+/g)
|
|
||||||
// snsArr.forEach((item: string) => {
|
|
||||||
// result += `<li>${item}</li>`
|
|
||||||
// })
|
|
||||||
// el.value = result += '</ol>'
|
|
||||||
let result = '<ol>'
|
|
||||||
for (let i = 0; i < lines.length; i++) {
|
|
||||||
// let line = lines[i]
|
|
||||||
result += `<li>${i + 1}</li>`
|
|
||||||
}
|
|
||||||
el.value = el.value + result + '</ol>'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const html = hljs.highlight(
|
|
||||||
`/**
|
|
||||||
* 注释
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void main () {
|
|
||||||
li
|
|
||||||
神经
|
|
||||||
}`,
|
|
||||||
{ language: 'java' }
|
|
||||||
).value
|
|
||||||
|
|
||||||
console.log(html)
|
|
@ -126,8 +126,6 @@ const weather = ref({
|
|||||||
|
|
||||||
const getWeather = () => {
|
const getWeather = () => {
|
||||||
getAll({ location: userStore.userinfo.location }).then((resp) => {
|
getAll({ location: userStore.userinfo.location }).then((resp) => {
|
||||||
console.log(123)
|
|
||||||
|
|
||||||
if (resp.data.now) {
|
if (resp.data.now) {
|
||||||
if (resp.data.now.iconValue === '#wt-qing') {
|
if (resp.data.now.iconValue === '#wt-qing') {
|
||||||
let nowHours = new Date().getHours()
|
let nowHours = new Date().getHours()
|
||||||
|
@ -38,7 +38,6 @@ class ShortcutRegistrant {
|
|||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* window.onblur = () => {
|
* window.onblur = () => {
|
||||||
* console.log('没有被激活')
|
|
||||||
* shortcutRegistrant.clearDownCodes()
|
* shortcutRegistrant.clearDownCodes()
|
||||||
* }
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
@ -56,7 +55,6 @@ class ShortcutRegistrant {
|
|||||||
*/
|
*/
|
||||||
public keyup(event: KeyboardEvent): void {
|
public keyup(event: KeyboardEvent): void {
|
||||||
if (this.debug) {
|
if (this.debug) {
|
||||||
console.log(event)
|
|
||||||
let row1 = { col1: '动作', col2: '松开' }
|
let row1 = { col1: '动作', col2: '松开' }
|
||||||
let row2 = { col1: 'key', col2: event.key }
|
let row2 = { col1: 'key', col2: event.key }
|
||||||
let row3 = { col1: 'code', col2: event.code }
|
let row3 = { col1: 'code', col2: event.code }
|
||||||
@ -82,7 +80,6 @@ class ShortcutRegistrant {
|
|||||||
*/
|
*/
|
||||||
public keydown(event: KeyboardEvent): void {
|
public keydown(event: KeyboardEvent): void {
|
||||||
if (this.debug) {
|
if (this.debug) {
|
||||||
console.log(event)
|
|
||||||
let row1 = { col1: '动作', col2: '按下' }
|
let row1 = { col1: '动作', col2: '按下' }
|
||||||
let row2 = { col1: 'key', col2: event.key }
|
let row2 = { col1: 'key', col2: event.key }
|
||||||
let row3 = { col1: 'code', col2: event.code }
|
let row3 = { col1: 'code', col2: event.code }
|
||||||
|
@ -452,7 +452,6 @@ const createUrl = (type: 'open' | 'copy' | 'link' | 'tempVisit', open: boolean =
|
|||||||
url = `[${curDoc.value.n}](${userinfo.params.WEB_ARTICLE_URL + curDoc.value.i} "${grammar}${curDoc.value.i}${grammar}")`
|
url = `[${curDoc.value.n}](${userinfo.params.WEB_ARTICLE_URL + curDoc.value.i} "${grammar}${curDoc.value.i}${grammar}")`
|
||||||
writeText(url)
|
writeText(url)
|
||||||
} else if (type === 'tempVisit') {
|
} else if (type === 'tempVisit') {
|
||||||
// console.log(server.serverUrl)
|
|
||||||
articleTempKey({ id: curDoc.value.i }).then((resp) => {
|
articleTempKey({ id: curDoc.value.i }).then((resp) => {
|
||||||
url = server.serverUrl + articleTempH + resp.data
|
url = server.serverUrl + articleTempH + resp.data
|
||||||
writeText(url)
|
writeText(url)
|
||||||
|
@ -12,7 +12,6 @@ export const login = async (username: string, password: string) => {
|
|||||||
auth.value = { token: '', status: AuthStatus.Loging }
|
auth.value = { token: '', status: AuthStatus.Loging }
|
||||||
await loginApi({ username: username, password: password, clientId: 'blossom', grantType: 'password' })
|
await loginApi({ username: username, password: password, clientId: 'blossom', grantType: 'password' })
|
||||||
.then((resp: any) => {
|
.then((resp: any) => {
|
||||||
console.log(resp)
|
|
||||||
auth.value = { token: resp.data.token, status: AuthStatus.Succ }
|
auth.value = { token: resp.data.token, status: AuthStatus.Succ }
|
||||||
Local.set(storeKey, auth.value)
|
Local.set(storeKey, auth.value)
|
||||||
// getUserinfo()
|
// getUserinfo()
|
||||||
|
@ -143,7 +143,6 @@ onMounted(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
onActivated(() => {
|
onActivated(() => {
|
||||||
console.log(123123123)
|
|
||||||
getRouteQueryParams()
|
getRouteQueryParams()
|
||||||
window.addEventListener('resize', onresize)
|
window.addEventListener('resize', onresize)
|
||||||
initStyle()
|
initStyle()
|
||||||
|
@ -44,7 +44,6 @@ onMounted(() => {
|
|||||||
const notes = ref()
|
const notes = ref()
|
||||||
const getNoteAll = () => {
|
const getNoteAll = () => {
|
||||||
noteAllApi().then((resp) => {
|
noteAllApi().then((resp) => {
|
||||||
console.log(resp.data)
|
|
||||||
notes.value = resp.data
|
notes.value = resp.data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user