- * @LastEditTime: 2023-07-14 00:01:05
+ * @LastEditTime: 2023-08-10 10:33:59
*/
import fetch from '@/utils/axios'
-const reader = new FileReader()
-const knock = 'qpV8PUxwY7as4jc'
-const cut = 'AqYfNFb6G2f2OVl4IVFOY'
+const cutToken = 'ghp_qpV8PUxwY7as4jc'
+const reader = new FileReader()
function getBase64(file: File) {
return new Promise((resolve) => {
reader.onload = function (event: any) {
@@ -21,22 +20,17 @@ function getBase64(file: File) {
}
const putPic = async (file: any) => {
- const content = typeof file === 'string' ? file : await getBase64(file)
const repo = 'shawnphang/files'
const d = new Date()
+ const content = typeof file === 'string' ? file : await getBase64(file)
const path = `${d.getFullYear()}/${d.getMonth()}/${d.getTime()}${file.name?.split('.').pop() || '.png'}`
const imageUrl = 'https://api.github.com/repos/' + repo + '/contents/' + path
- const body = {
- branch: 'main',
- message: 'upload',
- content,
- path,
- }
- await fetch(imageUrl, body, 'put', {
- Authorization: 'token ' + 'ghp_' + knock + cut,
+ const body = { branch: 'main', message: 'upload', content, path }
+ const res = await fetch(imageUrl, body, 'put', {
+ Authorization: `token ${cutToken}AqYfNFb6G2f2OVl4IVFOY`,
'Content-Type': 'application/json; charset=utf-8',
})
- return `https://fastly.jsdelivr.net/gh/shawnphang/files@main/${path}`
+ return res?.content?.download_url || `https://fastly.jsdelivr.net/gh/shawnphang/files@main/${path}`
}
export default { putPic }
diff --git a/src/components/modules/panel/widgetPanel.vue b/src/components/modules/panel/widgetPanel.vue
index bc5ee38..a78b77a 100644
--- a/src/components/modules/panel/widgetPanel.vue
+++ b/src/components/modules/panel/widgetPanel.vue
@@ -7,6 +7,7 @@
{{ item.name }}
+
源码
@@ -109,6 +110,7 @@ export default {
position: relative;
// width: 360px;
.widget-classify {
+ position: relative;
border-right: 1px solid rgba(0, 0, 0, 0.07);
background-color: #ffffff;
height: 100%;
@@ -212,4 +214,20 @@ export default {
}
}
}
+
+.github {
+ cursor: pointer;
+ position: absolute;
+ bottom: 12px;
+ font-size: 12px;
+ display: flex;
+ align-items: flex-end;
+ justify-content: center;
+ width: 100%;
+ img {
+ width: 21px;
+ height: 21px;
+ margin: 0 2px;
+ }
+}
diff --git a/src/views/components/CopyRight.vue b/src/views/components/CopyRight.vue
index 8ee17b9..d0b6006 100644
--- a/src/views/components/CopyRight.vue
+++ b/src/views/components/CopyRight.vue
@@ -3,7 +3,7 @@
* @Date: 2022-03-25 15:19:02
* @Description: 版权声明
* @LastEditors: ShawnPhang
- * @LastEditTime: 2023-07-06 16:48:12
+ * @LastEditTime: 2023-08-08 10:09:59
-->
@@ -20,7 +20,7 @@ import toolTip from '@/components/common/PopoverTip.vue'
export default defineComponent({
components: { toolTip },
setup() {
- const content = '本站为个人项目,素材资源均来源于网络,不提供任何版权保障,下载之作品仅供学习研究或欣赏目的而使用,请于24h内自行删除。'
+ const content = '本站为个人项目,所使用素材图片等均为网络收集而来,下载之作品仅供学习研究或欣赏目的而使用,无法提供商用授权哦。'
return {
content,
}