generated from haydenull/logseq-plugin-react-boilerplate
-
-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
希望支持自定义web版本agenda链接本地server的地址 #290
Labels
enhancement
New feature or request
Comments
附议。同需要这个功能。 目前靠自己架设一个Agenda网页勉强实现,参考:https://github.com/haydenull/logseq-plugin-agenda/tree/main?tab=readme-ov-file
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['./src/tests/setupTest.ts'],
},
server: { // 添加的部分开始
host: '0.0.0.0',
port: 自行修改,
https: false, // 关闭HTTPS支持(可选)
}, // 添加的部分结束
}
})
interface GithubContentResponse {
sha: string;
}
export const uploadIcsHttp = async ({ repo, token, file }: { repo: string; token: string; file: string }) => {
const base64File = window.btoa(unescape(encodeURIComponent(file)));
let sha;
try {
const response = await fetch(`https://api.github.com/repos/${repo}/contents/agenda.ics`, {
headers: {
'Authorization': `token ${token}`,
},
});
const data = await response.json() as GithubContentResponse;
sha = data.sha;
} catch (err) {
console.log('Failed to get file SHA:', err);
}
const date = new Date();
const commitTitle = `[Local Agenda]: update agenda.ics ${date.toLocaleDateString('en-US', { timeZone: 'UTC' })}, ${date.toLocaleTimeString('en-US', { timeZone: 'UTC' })}`;
return new Promise((resolve, reject) => {
fetch(`https://api.github.com/repos/${repo}/contents/agenda.ics`, {
method: 'PUT',
headers: {
'Authorization': `token ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
message: commitTitle,
content: base64File,
...(sha && { sha }),
}),
})
.then(async (response) => {
console.log('upload ics response', response)
const data = (await response.json()) as { message: string }
if (!response.ok) {
reject(data)
}
resolve(data)
})
.catch((err) => {
reject(err)
})
})
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Search first
What Happened?
电脑和平板在同一个局域网里面。 想从平板上看agenda,电脑上使用笔记
Reproduce the Bug
现在没找到能修改server地址的地方
Screenshots
No response
Environment Information
No response
Additional Context
No response
Are you willing to submit a PR? If you know how to fix the bug.
The text was updated successfully, but these errors were encountered: