Skip to content

Commit

Permalink
init repo
Browse files Browse the repository at this point in the history
  • Loading branch information
FuShaoLei committed Sep 5, 2024
1 parent 9a19780 commit b248b54
Show file tree
Hide file tree
Showing 11 changed files with 480 additions and 31 deletions.
2 changes: 1 addition & 1 deletion electron-builder.json5
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"$schema": "https://raw.githubusercontent.com/electron-userland/electron-builder/master/packages/app-builder-lib/scheme.json",
"appId": "YourAppID",
"asar": true,
"productName": "YourAppName",
"productName": "Memory",
"directories": {
"output": "release/${version}"
},
Expand Down
2 changes: 1 addition & 1 deletion electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async function createWindow() {
if (VITE_DEV_SERVER_URL) { // #298
win.loadURL(VITE_DEV_SERVER_URL)
// Open devTool if the app is not packaged
win.webContents.openDevTools()
// win.webContents.openDevTools()
} else {
win.loadFile(indexHtml)
}
Expand Down
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "electron-vue-vite",
"version": "28.1.0",
"version": "0.0.1",
"main": "dist-electron/main/index.js",
"description": "Really simple Electron + Vue + Vite boilerplate.",
"author": "草鞋没号 <[email protected]>",
"description": "Github Upload Tool.",
"author": "fushaolei",
"license": "MIT",
"private": true,
"keywords": [
Expand All @@ -24,6 +24,12 @@
"build": "vue-tsc --noEmit && vite build && electron-builder",
"preview": "vite preview"
},
"dependencies": {
"axios": "^1.7.2",
"element-plus": "^2.7.5",
"pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^3.2.1"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.4",
"electron": "^29.1.1",
Expand Down
19 changes: 3 additions & 16 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
<script setup lang="ts">
import HelloWorld from './components/HelloWorld.vue'
import Memory from "./components/Memory.vue";
</script>

<template>
<div>
<a href="https://www.electronjs.org/" target="_blank">
<img src="./assets/electron.svg" class="logo electron" alt="Electron logo" />
</a>
<a href="https://vitejs.dev/" target="_blank">
<img src="./assets/vite.svg" class="logo" alt="Vite logo" />
</a>
<a href="https://vuejs.org/" target="_blank">
<img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
</a>
</div>
<HelloWorld msg="Electron + Vite + Vue" />
<div class="flex-center">
Place static files into the <code>/public</code> folder
<img style="width: 2.4em; margin-left: .4em;" src="/logo.svg" alt="Logo">
</div>
<!-- <HelloWorld msg="xxx"/>-->
<Memory/>
</template>

<style>
Expand Down
53 changes: 53 additions & 0 deletions src/api/GithubApi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import request from "../utils/request.js";
import {useSettingsStore} from "../stores/settingsData.js";


export function testGithubApi() {
const mSettingsStore = useSettingsStore();

return request({
url:`/repos/${mSettingsStore.githubSettings.name}/${mSettingsStore.githubSettings.repo}/contents/`,
headers:{
"Accept":`application/vnd.github+json`,
"Authorization":`Bearer ${mSettingsStore.githubSettings.token}`,
"X-GitHub-Api-Version": `2022-11-28`,
"Cache-Control": "no-cache",
},
method:'get'
})
}

export function upload(name, data) {
const mSettingsStore = useSettingsStore();

return request({
url:`/repos/${mSettingsStore.githubSettings.name}/${mSettingsStore.githubSettings.repo}/contents/`+name,
headers:{
"Accept":`application/vnd.github+json`,
"Authorization":`Bearer ${mSettingsStore.githubSettings.token}`,
"X-GitHub-Api-Version": `2022-11-28`
},
method:'put',
data: data
})
}

export function uploadTest() {
const mSettingsStore = useSettingsStore();

// data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=
const requestData = {
message:'test img upload',
content: 'R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs='
}
return request({
url:`/repos/${mSettingsStore.githubSettings.name}/${mSettingsStore.githubSettings.repo}/contents/`+"helloblack.jpg",
headers:{
"Accept":`application/vnd.github+json`,
"Authorization":`Bearer ${mSettingsStore.githubSettings.token}`,
"X-GitHub-Api-Version": `2022-11-28`
},
method:'put',
data: requestData
})
}
Loading

0 comments on commit b248b54

Please sign in to comment.