Compare commits
4 Commits
dddd3a7ed5
...
hedgeagent
| Author | SHA1 | Date | |
|---|---|---|---|
| f3e3a802ab | |||
|
|
9eff2d9c1a | ||
|
|
d76790c22c | ||
|
|
c3e078c9c6 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -16,6 +16,8 @@ backups/
|
|||||||
*.log
|
*.log
|
||||||
*.sqlite
|
*.sqlite
|
||||||
|
|
||||||
|
*~
|
||||||
|
|
||||||
# ignore config files
|
# ignore config files
|
||||||
config.json
|
config.json
|
||||||
.sequelizerc
|
.sequelizerc
|
||||||
|
|||||||
33
Dockerfile
Normal file
33
Dockerfile
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
############################
|
||||||
|
# 1) Builder: bygg HedgeDoc
|
||||||
|
############################
|
||||||
|
FROM node:18-alpine AS builder
|
||||||
|
|
||||||
|
WORKDIR /build
|
||||||
|
|
||||||
|
# H??mta din branch som tarball (ingen git beh??vs)
|
||||||
|
ADD https://git.sa6anw.se/sa6anw/hedgedoc/archive/refs/heads/hedgeagent/1.10.5.tar.gz /tmp/hedgedoc.tar.gz
|
||||||
|
|
||||||
|
RUN tar -xzf /tmp/hedgedoc.tar.gz --strip-components=1 \
|
||||||
|
&& rm /tmp/hedgedoc.tar.gz
|
||||||
|
|
||||||
|
# Installera deps + bygg frontend/backend
|
||||||
|
RUN corepack enable \
|
||||||
|
&& yarn install --immutable \
|
||||||
|
&& yarn build
|
||||||
|
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# 2) Runtime: officiell HedgeDoc-image
|
||||||
|
########################################
|
||||||
|
FROM quay.io/hedgedoc/hedgedoc:1.10.5
|
||||||
|
|
||||||
|
USER root
|
||||||
|
|
||||||
|
# Ers??tt upstream-koden
|
||||||
|
RUN rm -rf /hedgedoc
|
||||||
|
|
||||||
|
# Kopiera f??rdigbyggd app med r??tt UID/GID
|
||||||
|
COPY --from=builder --chown=10000:10000 /build /hedgedoc
|
||||||
|
|
||||||
|
USER 10000
|
||||||
18
README.md
18
README.md
@@ -1,3 +1,21 @@
|
|||||||
|
# HedgeDoc-HedgeAgent
|
||||||
|
|
||||||
|
This is a customized version that makes it possible to invite an AI agent to a note via the menu. "Invite Agent" sends the `note_id` to hedgeagent.
|
||||||
|
|
||||||
|
To start an instance for development, the following is required:
|
||||||
|
1. ```cp config.json.example config.json ```
|
||||||
|
2. Update ```"domain": "change this" ```
|
||||||
|
3. ```.yarn/releases/yarn-4.12.0.cjs install```
|
||||||
|
4. ```.yarn/releases/yarn-4.12.0.cjs run build```
|
||||||
|
5. ```.yarn/releases/yarn-4.12.0.cjs start```
|
||||||
|
|
||||||
|
To start for production:
|
||||||
|
1. `docker compose up -d`
|
||||||
|
|
||||||
|
Note: Use UID 10000 for data folders.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
# HedgeDoc
|
# HedgeDoc
|
||||||
|
|||||||
50
docker-compose.yaml
Normal file
50
docker-compose.yaml
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
services:
|
||||||
|
database:
|
||||||
|
image: postgres:13.4-alpine
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER=hedgedoc
|
||||||
|
- POSTGRES_PASSWORD=password
|
||||||
|
- POSTGRES_DB=hedgedoc
|
||||||
|
volumes:
|
||||||
|
- ./db:/var/lib/postgresql/data
|
||||||
|
restart: always
|
||||||
|
networks:
|
||||||
|
- internal
|
||||||
|
|
||||||
|
app:
|
||||||
|
build: .
|
||||||
|
image: hedgedoc-hedgeagent:1.10.5
|
||||||
|
container_name: hedgedoc
|
||||||
|
environment:
|
||||||
|
CMD_DB_URL: postgres://hedgedoc:password@database:5432/hedgedoc
|
||||||
|
CMD_PORT: "3000"
|
||||||
|
CMD_HOST: "0.0.0.0"
|
||||||
|
CMD_DOMAIN: hedgedoc.sa6anw.se
|
||||||
|
CMD_URL_ADDPORT: "false"
|
||||||
|
CMD_PROTOCOL_USESSL: "true"
|
||||||
|
CMD_EMAIL: "true"
|
||||||
|
CMD_ALLOW_EMAIL_REGISTER: "true"
|
||||||
|
volumes:
|
||||||
|
- ./uploads:/hedgedoc/public/uploads
|
||||||
|
restart: always
|
||||||
|
depends_on:
|
||||||
|
- database
|
||||||
|
# Since I use Caddy I don't need this
|
||||||
|
# ports:
|
||||||
|
# - "3000:3000"
|
||||||
|
|
||||||
|
## If you use Caddy like I do keep below
|
||||||
|
networks:
|
||||||
|
- internal
|
||||||
|
- proxy
|
||||||
|
|
||||||
|
labels:
|
||||||
|
caddy: hedgedoc.sa6anw.se
|
||||||
|
caddy.reverse_proxy: "{{upstreams 3000}}"
|
||||||
|
|
||||||
|
networks:
|
||||||
|
internal:
|
||||||
|
internal: true
|
||||||
|
proxy:
|
||||||
|
external: true
|
||||||
|
## If you don't, you can deleta all of this
|
||||||
@@ -7,7 +7,7 @@ const CspStrategy = {}
|
|||||||
const defaultDirectives = {
|
const defaultDirectives = {
|
||||||
defaultSrc: ['\'none\''],
|
defaultSrc: ['\'none\''],
|
||||||
baseUri: ['\'self\''],
|
baseUri: ['\'self\''],
|
||||||
connectSrc: ['\'self\'', buildDomainOriginWithProtocol(config, 'ws'), 'https://vimeo.com/api/v2/video/'],
|
connectSrc: ['\'self\'', buildDomainOriginWithProtocol(config, 'ws'), 'https://vimeo.com/api/v2/video/', 'https://hedgeagent.sa6anw.se/add_note'],
|
||||||
fontSrc: ['\'self\''],
|
fontSrc: ['\'self\''],
|
||||||
manifestSrc: ['\'self\''],
|
manifestSrc: ['\'self\''],
|
||||||
frameSrc: ['\'self\'', 'https://player.vimeo.com', 'https://www.youtube.com', 'https://gist.github.com'],
|
frameSrc: ['\'self\'', 'https://player.vimeo.com', 'https://www.youtube.com', 'https://gist.github.com'],
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
"Extra": "Extra",
|
"Extra": "Extra",
|
||||||
"Revision": "Revision",
|
"Revision": "Revision",
|
||||||
"Slide Mode": "Slide Mode",
|
"Slide Mode": "Slide Mode",
|
||||||
|
"Invite Agent": "Invite Agent",
|
||||||
"Export": "Export",
|
"Export": "Export",
|
||||||
"Import": "Import",
|
"Import": "Import",
|
||||||
"Clipboard": "Clipboard",
|
"Clipboard": "Clipboard",
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
"Extra": "Extra",
|
"Extra": "Extra",
|
||||||
"Revision": "Revision",
|
"Revision": "Revision",
|
||||||
"Slide Mode": "Slide Mode",
|
"Slide Mode": "Slide Mode",
|
||||||
|
"Invite Agent": "Invite Agent",
|
||||||
"Export": "Exportera",
|
"Export": "Exportera",
|
||||||
"Import": "Importera",
|
"Import": "Importera",
|
||||||
"Clipboard": "Urklipp",
|
"Clipboard": "Urklipp",
|
||||||
|
|||||||
@@ -1206,6 +1206,23 @@ ui.toolbar.publish.attr('href', noteurl + '/publish')
|
|||||||
// extra
|
// extra
|
||||||
// slide
|
// slide
|
||||||
ui.toolbar.extra.slide.attr('href', noteurl + '/slide')
|
ui.toolbar.extra.slide.attr('href', noteurl + '/slide')
|
||||||
|
|
||||||
|
// invite agent
|
||||||
|
ui.toolbar.extra.inviteAgent.click(function (e) {
|
||||||
|
e.preventDefault()
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: 'https://hedgeagent.sa6anw.se/add_note',
|
||||||
|
type: 'POST',
|
||||||
|
contentType: 'application/json',
|
||||||
|
data: JSON.stringify({ note_id: noteid }),
|
||||||
|
error: function (xhr, status, err) {
|
||||||
|
console.error('Invite agent failed:', status, err)
|
||||||
|
alert('Failed to invite agent.')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
// download
|
// download
|
||||||
// markdown
|
// markdown
|
||||||
ui.toolbar.download.markdown.click(function (e) {
|
ui.toolbar.download.markdown.click(function (e) {
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ export const getUIElements = () => ({
|
|||||||
publish: $('.ui-publish'),
|
publish: $('.ui-publish'),
|
||||||
extra: {
|
extra: {
|
||||||
revision: $('.ui-extra-revision'),
|
revision: $('.ui-extra-revision'),
|
||||||
slide: $('.ui-extra-slide')
|
slide: $('.ui-extra-slide'),
|
||||||
|
inviteAgent: $('.ui-invite-agent')
|
||||||
},
|
},
|
||||||
download: {
|
download: {
|
||||||
markdown: $('.ui-download-markdown'),
|
markdown: $('.ui-download-markdown'),
|
||||||
|
|||||||
@@ -34,6 +34,8 @@
|
|||||||
</li>
|
</li>
|
||||||
<li role="presentation"><a role="menuitem" class="ui-extra-slide" tabindex="-1" href="#" target="_blank" rel="noopener"><i class="fa fa-tv fa-fw"></i> <%= __('Slide Mode') %></a>
|
<li role="presentation"><a role="menuitem" class="ui-extra-slide" tabindex="-1" href="#" target="_blank" rel="noopener"><i class="fa fa-tv fa-fw"></i> <%= __('Slide Mode') %></a>
|
||||||
</li>
|
</li>
|
||||||
|
<li role="presentation"><a role="menuitem" class="ui-invite-agent" tabindex="-1" href="#"><i class="fa fa-robot fa-fw"></i> <%= __('Invite Agent') %></a>
|
||||||
|
</li>
|
||||||
<% if(enableGitHubGist || enableDropBoxSave || enableGitlabSnippets) { %>
|
<% if(enableGitHubGist || enableDropBoxSave || enableGitlabSnippets) { %>
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
<li class="dropdown-header"><%= __('Export') %></li>
|
<li class="dropdown-header"><%= __('Export') %></li>
|
||||||
@@ -136,6 +138,8 @@
|
|||||||
</li>
|
</li>
|
||||||
<li role="presentation"><a role="menuitem" class="ui-extra-slide" tabindex="-1" href="#" target="_blank" rel="noopener"><i class="fa fa-tv fa-fw"></i> <%= __('Slide Mode') %></a>
|
<li role="presentation"><a role="menuitem" class="ui-extra-slide" tabindex="-1" href="#" target="_blank" rel="noopener"><i class="fa fa-tv fa-fw"></i> <%= __('Slide Mode') %></a>
|
||||||
</li>
|
</li>
|
||||||
|
<li role="presentation"><a role="menuitem" class="ui-invite-agent" tabindex="-1" href="#"><i class="fa fa-robot fa-fw"></i> <%= __('Invite Agent') %></a>
|
||||||
|
</li>
|
||||||
<% if(enableGitHubGist || enableDropBoxSave || enableGitlabSnippets) { %>
|
<% if(enableGitHubGist || enableDropBoxSave || enableGitlabSnippets) { %>
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
<li class="dropdown-header"><%= __('Export') %></li>
|
<li class="dropdown-header"><%= __('Export') %></li>
|
||||||
|
|||||||
Reference in New Issue
Block a user