Giter Site home page Giter Site logo

standardnotes-extensions's Introduction

archived.

Project has been archived and will no longer be maintained. I've decided to move away from standard notes due to both Standard Notes's business and architectural model for self-hosted users.


Standard Notes Extension Repository

Standard Notes Extensions - Self-Hosted Repository

Host Standard Notes extensions on your own server. This utility parses most of the open-source extensions available from the Standard Notes team as well as a range of extensions created by the wider Standard Notes community to build an extensions repository which can then be plugged directly into Standard Notes Web/Desktop Clients. (https://standardnotes.org/)

Extensions are listed as YAML in the /extensions sub-directory, pull a request if you'd like to add yours.

Requirements

  • Python 3
    • pyyaml module
    • requests module

Demo

Standard Notes Extension Repository Demo

Usage

  • Clone this repository to your web-server:
$ git clone https://github.com/iganeshk/standardnotes-extensions.git
$ cd standardnotes-extensions
$ pip3 install -r requirements.txt
  • Visit the following link to generate a personal access token:
$ https://github.com/settings/tokens

Github Personal Access Token

  • Use the provided env.sample to create a .env file for your environment variables and including your Github personal access token.
# Sample ENV setup Variables (YAML)
# Copy this file and update as needed.
#
#   $ cp env.sample .env
#
# Do not include this new file in source control
# Github Credentials
# Generate your token here: https://github.com/settings/tokens
# No additional permission required, this is just to avoid github api rate limits
#

domain: https://your-domain.com/extensions

github:
  username: USERNAME
  token: TOKEN

  • [Optional] Add more extensions to the /extensions directory, using the YAML sample templates for extensions or themes, or modify any existing extensions.
  • Run the utility:
$ python3 build_repo.py
  • Serve the /public directory and verify that the endpoint is reachable.
https://your-domain.com/extensions/index.json
  • Import the latest url for each extension you want to add (for example: https://your-domaim.com/extensions/bold-editor/index.json) into the Standard Notes Web Desktop client under the General > Advanced Settings > Install Custom Extension menu. (Note: Enable CORS for your web server respectively, nginx setup provided below)

  • If you are self-hosting Standard Notes Server (aka Standard Notes Standalone), you may need to add a "subscription" to your self-hosted user account in order to avoid any problems accessing official Standard Notes extensions.

  • To add a subscription to your self-hosted user account, run the following commands (Replace EMAIL@ADDR with your user email) from within your standalone directory: ./server.sh create-subscription EMAIL@ADDR

Docker

  • To run via Docker, clone this repository, create your .env file using the provided env.sample, and optionally add any additional extensions to the /extensions directory, following the instructions above.
  • Then pull and run the container, specifying the mount points for the .env file, the extensions directory, and the public directory, where the self-hosted extensions will be placed:
$ docker run \
  -v $PWD/.env:/build/.env \
  -v $PWD/extensions:/build/extensions \
  -v $PWD/public:/build/public \
  -v $PWD/standardnotes-extensions-list.txt:/build/standardnotes-extensions-list.txt \
  iganesh/standardnotes-extensions

Docker Compose

If you would like to use the container with docker-compose, the exact setup will be somewhat specific to your configuration, however the following snippet may be helpful, assuming you have cloned this repository in your $HOME directory and followed the instructions regarding the .env file and /extensions directory:

version: '3.3'
services:
  nginx:
  ...
    volumes:
    - standardnotes-extensions:/usr/share/nginx/html

  standardnotes-extensions:
    image: iganesh/standardnotes-extensions
    restart: "no"
    volumes:
      - $HOME/standardnotes-extensions/.env:/build/.env
      - $HOME/standardnotes-extensions/extensions:/build/extensions
      - $HOME/standardnotes-extensions/standardnotes-extensions-list.txt:/build/standardnotes-extensions-list.txt
      - standardnotes-extensions:/build/public

volumes:
  standardnotes-extensions:
    name: standardnotes-extensions

This snippet will handle the building of the extension creation-container, and place the result in the standardnotes-extensions volume, which can then be mounted in the nginx container so that it can be served as demonstrated in the instructions below. Note that it's necessary to include the restart: "no" flag, because the container is designed to stop after it has finished generating the extensions.

Also, please note that the configuration snippet above is in no way a complete setup: you will still have to configure the nginx container and set up the syncing server containers.

Docker Build

If you need to build the container, clone this repository, cd into it, and run the following command:

$ docker build --no-cache -t standardnotes-extensions:local .

Setup with nginx

	location ^~ /extensions {
		autoindex off;
		alias /path/to/standardnotes-extensions/public;
		# CORS HEADERS
		if ($request_method = 'OPTIONS') {
		   add_header 'Access-Control-Allow-Origin' '*';
		   add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
		   #
		   # Custom headers and headers various browsers *should* be OK with but aren't
		   #
		   add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,X-Application-Version,X-SNJS-Version';
		   #
		   # Tell client that this pre-flight info is valid for 20 days
		   #
		   add_header 'Access-Control-Max-Age' 1728000;
		   add_header 'Content-Type' 'text/plain; charset=utf-8';
		   add_header 'Content-Length' 0;
		   return 204;
		}
		if ($request_method = 'POST') {
		   add_header 'Access-Control-Allow-Origin' '*';
		   add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
		   add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,X-Application-Version,X-SNJS-Version';
		   add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
		}
		if ($request_method = 'GET') {
		   add_header 'Access-Control-Allow-Origin' '*';
		   add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
		   add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,X-Application-Version,X-SNJS-Version';
		   add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
		}
	}

Acknowledgments

standardnotes-extensions's People

Contributors

crevio avatar edleeman avatar iganeshk avatar kylejbrk avatar marcolaux avatar mtoohey31 avatar xthursdayx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

standardnotes-extensions's Issues

Encountered error when parsing theme "overcast-theme"

The script failed to parse overcast-theme. Delete overcase-theme in extension folder and rerun python3 build_repo.py will run without any error. Below is the error log

Traceback (most recent call last):
  File "/home/note/standardnotes-extensions/build_repo.py", line 337, in <module>
    main()
  File "/home/note/standardnotes-extensions/build_repo.py", line 333, in main
    parse_extensions(base_dir, extensions_dir, public_dir, base_url, stdnotes_ext_list_path, ghub_headers)
  File "/home/note/standardnotes-extensions/build_repo.py", line 154, in parse_extensions
    ext_yaml = yaml.load(extyaml, Loader=yaml.FullLoader)
  File "/home/note/.local/lib/python3.9/site-packages/yaml/__init__.py", line 79, in load
    loader = Loader(stream)
  File "/home/note/.local/lib/python3.9/site-packages/yaml/loader.py", line 24, in __init__
    Reader.__init__(self, stream)
  File "/home/note/.local/lib/python3.9/site-packages/yaml/reader.py", line 85, in __init__
    self.determine_encoding()
  File "/home/note/.local/lib/python3.9/site-packages/yaml/reader.py", line 135, in determine_encoding
    self.update(1)
  File "/home/note/.local/lib/python3.9/site-packages/yaml/reader.py", line 169, in update
    self.check_printable(data)
  File "/home/note/.local/lib/python3.9/site-packages/yaml/reader.py", line 143, in check_printable
    raise ReaderError(self.name, position, ord(character),
yaml.reader.ReaderError: unacceptable character #x0080: special characters are not allowed
  in "/home/note/standardnotes-extensions/extensions/overcast-theme.yaml", position 349

Advanced Markdown Editor index.html path is wrong

Hi everyone,

I followed this guideline for setting up the extensions for a selfhosted instance of standardnotes.
The process was quick and easy. At first glance everything looked good. However the extension "Advanced Markdown Editor" did not work. I did get a ngnix "404: not found" error when trying to use it. A bit of debugging show me that the path to the index.html of the advanced-markdown-editor is set wrong path in these two generated files:

  • ./public/advanced-markdown-editor/index.json
  • ./public/index.json

In the file "./public/advanced-markdown-editor/index.json" the url line is set incorrectly:

{
    "identifier": "org.standardnotes.advanced-markdown-editor",
    "name": "Advanced Markdown Editor",
    "content_type": "SN|Component",
    "area": "editor-editor",
    "version": "1.3.11",
    "description": "A fully featured Markdown editor that supports live preview, a styling toolbar, and split pane support.",
    "marketing_url": "https://standardnotes.org/extensions/advanced-markdown",
    "thumbnail_url": "https://s3.amazonaws.com/standard-notes/screenshots/models/editors/adv-markdown.jpg",
    "valid_until": "2030-05-16T18:35:33.000Z",
    "url": "https://STATIC_IP/extensions/advanced-markdown-editor/1.3.11/index.html",
    "download_url": "https://github.com/sn-extensions/advanced-markdown-editor/archive/1.3.11.zip",
    "latest_url": "https://STATIC_IP/extensions/advanced-markdown-editor/index.json"
}

It should be
"url": "https://STATIC_IP/extensions/advanced-markdown-editor/1.3.11/dist/index.html",
Between the folder 1.3.11 and the file index.html the subpath dist is missing.
The same error also exists in the ./public/index.json file.

EDIT:

It seems that only the configuration in the advanced-markdown-editor.yaml needs to be adjusted to
main: dist/index.html

Error: Unable to update Callisto (callisto-theme.yaml)

Please Can help they start do right way till callisto-theme.yaml Please fix this thanks so much

python3 build_repo.py
Unknown error occurred: 'status'
Extension: ActionBar 1.3.2 (updated)
Extension: Quick Tags 1.3.2 (updated)
Extension: Bold Editor 1.2.2 (updated)
Extension: Code Editor 1.3.8 (updated)
Extension: Folders Component 1.3.8 (updated)
Extension: GitHub Push 1.2.4 (updated)
Extension: Simple Markdown Editor 1.4.0 (updated)
Extension: Markdown Pro 1.3.14 (updated)
Extension: Math Editor 1.3.4 (updated)
Extension: 2FA Manager 1.2.5 (updated)
Extension: Minimal Markdown Editor 1.3.7 (updated)
Extension: Plus Editor 1.5.0 (updated)
Extension: Rich Markdown Editor 0.18.0 (updated)
Extension: Secure Spreadsheets 1.4.0 (updated)
Extension: Simple Task Editor 1.3.7 (updated)
Extension: TokenVault 2.0.3 (updated)
Extension: Vim Editor 1.3.7 (updated)
Theme: Autobiography 1.0.0 (updated)
Error: Unable to update Callisto (callisto-theme.yaml) does it have a release at Github?
Traceback (most recent call last):
File "build_repo.py", line 283, in
main()
File "build_repo.py", line 268, in main
parse_extensions(base_dir, base_url, ghub_session)
File "build_repo.py", line 137, in parse_extensions
ext_yaml = yaml.load(extyaml, Loader=yaml.FullLoader)
File "/usr/lib/python3.8/site-packages/yaml/init.py", line 114, in load
return loader.get_single_data()
File "/usr/lib/python3.8/site-packages/yaml/constructor.py", line 49, in get_single_data
node = self.get_single_node()
File "/usr/lib/python3.8/site-packages/yaml/composer.py", line 36, in get_single_node
document = self.compose_document()
File "/usr/lib/python3.8/site-packages/yaml/composer.py", line 58, in compose_document
self.get_event()
File "/usr/lib/python3.8/site-packages/yaml/parser.py", line 118, in get_event
self.current_event = self.state()
File "/usr/lib/python3.8/site-packages/yaml/parser.py", line 193, in parse_document_end
token = self.peek_token()
File "/usr/lib/python3.8/site-packages/yaml/scanner.py", line 129, in peek_token
self.fetch_more_tokens()
File "/usr/lib/python3.8/site-packages/yaml/scanner.py", line 223, in fetch_more_tokens
return self.fetch_value()
File "/usr/lib/python3.8/site-packages/yaml/scanner.py", line 577, in fetch_value
raise ScannerError(None, None,
yaml.scanner.ScannerError: mapping values are not allowed here
in "/volume1/docker/standardnotes-extensions/extensions/dark-hybrid-theme.yaml", line 2, column 3

Plus Editor 404's

Hello!

Using the plus editor (both your version and selfhosting it) I get a 404:

404
File not found
The site configured at this address does not contain the requested file.
If this is your site, make sure that the filename case matches the URL.
For root URLs (like http://example.com/) you must provide an index.html file.
Read the full documentation for more information about using GitHub Pages.

Anyone else running into "No subscriptions" errors when using self-hosted Standard Notes editors?

I do not have a subscription, since I self-host all of the extensions I use in Standard Notes using this repo. However, after the most recent update to Standard Notes Desktop, all of the editors created by Standard Notes (e.g. Bold Editor or Simple Task Editor) no longer work and there is a banner at the top of the editor window that says:

You do not have an active subscription.
Simple Task Editor is in a read-only state.

Strangely, other SN extension created by SN organization, such as Action Bar and their themes, still seem to work.

Is anyone else running into problem? I'm hoping that SN's open-source extensions will no longer be self-hostable. This appears to be related to this issue in the SN Desktop repo: standardnotes/desktop#789

Either way, with the most recent versions of Standard Notes Desktop and Standard Notes Web the instructions in the README.md are no longer correct. If you try to add your https://your-domain.com/extensions/index.json endpoint in the Activate Offline Subscription box in Preferences > General > Advanced Settings you will get the following error:

An unknown issue occurred during offline activation. Please try again.

This requires the user to manually add each extension using the extensions specific index.json, for example, https://your-domain.com/extensions/append-editor/index.json. I believe that this is why the extensions created by Standard Notes are no longer working, despite being self-hosted.

CORS issue

I used the nginx template from README.md but still, I'm getting this error on chrome

Access to XMLHttpRequest at 'https://notes.mydomain.com/extensions/sn-nord-theme/index.json' from origin 'https://app.standardnotes.com' has been blocked by CORS policy: Request header field x-application-version is not allowed by Access-Control-Allow-Headers in preflight response.

my nginx configuration

server {
    server_name notes.mydomain.com;

    location / {
        proxy_pass http://127.0.0.1:3000; # syncing-server address
    }

client_max_body_size 50M;

location ^~ /extensions {
                autoindex off;
                alias /opt/standardnotes/standardnotes-extensions/public;
                # CORS HEADERS
                if ($request_method = 'OPTIONS') {
                   add_header 'Access-Control-Allow-Origin' '*';
                   add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
                   #
                   # Custom headers and headers various browsers *should* be OK with but aren't
                   #
                   add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
                   #
                   # Tell client that this pre-flight info is valid for 20 days
                   #
                   add_header 'Access-Control-Max-Age' 1728000;
                   add_header 'Content-Type' 'text/plain; charset=utf-8';
                   add_header 'Content-Length' 0;
                   return 204;
                }
                if ($request_method = 'POST') {
                   add_header 'Access-Control-Allow-Origin' '*';
                   add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
                   add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
                   add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
                }
                if ($request_method = 'GET') {
                   add_header 'Access-Control-Allow-Origin' '*';
                   add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
                   add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
                   add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
                }
        }

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/notes.mydomain.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/notes.mydomain.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

To reproduce it , click on install:
nginx/1.18.0
Browser: Google Chrome 100.0.4896.88 (Official Build) (64-bit)
headers: add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
image

Difficulty encountered with Apache config

Hi I tried to use Apache alias to redirect to the "public" directory. However, this has been unsuccessful. Are there any templates that could help Apache user?

Thank you.

Problem with dark-hybrid-theme

Hi there
Many thanks for making the SN extensions available.
I was trying to build the repo but got the following error for the dark-hybrid theme:
Would you know where this would come from? as it break the constitution of the repo, i cannot at the moment access the /extensions webpage!
Thanks in advance
Mel

Traceback (most recent call last):
  File "build_repo.py", line 283, in <module>
    main()
  File "build_repo.py", line 268, in main
    parse_extensions(base_dir, base_url, ghub_session)
  File "build_repo.py", line 137, in parse_extensions
    ext_yaml = yaml.load(extyaml, Loader=yaml.FullLoader)
  File "/usr/lib/python3/dist-packages/yaml/__init__.py", line 114, in load
    return loader.get_single_data()
  File "/usr/lib/python3/dist-packages/yaml/constructor.py", line 49, in get_single_data
    node = self.get_single_node()
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 36, in get_single_node
    document = self.compose_document()
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 58, in compose_document
    self.get_event()
  File "/usr/lib/python3/dist-packages/yaml/parser.py", line 118, in get_event
    self.current_event = self.state()
  File "/usr/lib/python3/dist-packages/yaml/parser.py", line 193, in parse_document_end
    token = self.peek_token()
  File "/usr/lib/python3/dist-packages/yaml/scanner.py", line 129, in peek_token
    self.fetch_more_tokens()
  File "/usr/lib/python3/dist-packages/yaml/scanner.py", line 223, in fetch_more_tokens
    return self.fetch_value()
  File "/usr/lib/python3/dist-packages/yaml/scanner.py", line 577, in fetch_value
    raise ScannerError(None, None,
yaml.scanner.ScannerError: mapping values are not allowed here

Installation and integration in standard notes

Hi,
I was wondering if i still need the extended/payed version to use the extensions.
I followed your instructions but i don't get new extensions in standardnotes..

Thanks for any help.

Error: Cannot GET /extensions/index.json

Trying to access notes.example.com/extensions/index.json after successfully installling extensions in selfhosted SN docker.

Is it about nginx permissions/ folder ownership?

After updating standardnotes server, problem #33 is reappearing.

Hi,
I have updated my standardnotes server and desktop app to the latest version and the problem #33 with the extension is back. I followed all the steps and reinstalled all the extensions, but I keep getting the message that I don't have a valid subscription and some extension are under the payment plan.

Does anyone have this also after updating, and is there a new trick or solution to get it working again?

Hosted Web Versions from "s.murrum.eu" re Down

Basically as the title states. I've learned that the web clients have to use the hosted version of the extensions, something that wasn't clear to me as this was meant to be about self hosting them.

So, while the desktop client is working, the web one isn't.

I suggest change this so you can point the client for extensions that that are being hosted by the person themselves.

For Moookino this would probably require him to set up his docker image to read a variable to the the host url and apply it to the extensions served.

Feature Request: Please add extensions-manager and batch-manager to the Repo

As it say in the title, I'd like to request the extensions-manager and batch-manager to be added to the repo.

It took me a while to narrow down the issue, but when replacing the /extensions part of the url, it removes access to the web docker image version of those two repos. So while all the files to these repo exist, the extension management tools cease working as they can't be accessed.

Currently I've just copied the app and dist folder from them over into my copy of the repo here, and it seems to have worked without issue. So I'd like to ask the be added to the repo to prevent needing to copy them in the future.

extensions-manager repo: https://github.com/sn-extensions/extensions-manager/tree/master
batch-manager repo: https://github.com/sn-extensions/batch-manager/tree/master

Markdown Visual Editor and Midnight theme (at least) don't work

Hi,

I'm trying to use this but getting this error on desktop: "The extension was not found on your system, possibly because it is still downloading. If the extension doesn't load, try uninstalling then reinstalling the extension.". On the web version it simply doesn't load.

I'm hosting this on GitLab Pages. Can I not do that? Everything is accessible: https://julianfairfax.gitlab.io/standard-notes-extensions/index.json, https://julianfairfax.gitlab.io/standard-notes-extensions/markdown-visual/index.json, https://julianfairfax.gitlab.io/standard-notes-extensions/markdown-visual/1.0.7/public/index.html, etc.

no "dist" folder created for simple tastk editor

When I do a python3 build_repo.py no dist folder (public/simple-task-editor/1.3.10/dist) is created for the simple tastk editor. The build repo output shows all fine and simple-task-editor 1.3.10 as updated. I also tried it after deleting the previousl public folder.
Therefore it also can't be loaded into standardnotes as https://sample.com/extensions/simple-task-editor/1.3.10/dist/index.html can't be found.
I suspect this happens since the 1.3.10 update, but can't be shure.

By the way thanks for creating this great tool! It does help me alot.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.