Skip to content

Commit ed2bd9a

Browse files
author
codepad
committed
1.0.7
1 parent 9e59d4c commit ed2bd9a

File tree

290 files changed

+1683
-31618
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

290 files changed

+1683
-31618
lines changed

.npmignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
.ep_initialized
33
highlight.js
44
themes-disabled
5-
publish.sh
5+
publish.sh
6+
dev.sh
7+
import.sh

README.md

+27-21
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,71 @@
1-
Turn etherpad into codepad - a collaborative open development enviroment.
2-
3-
Status: Beta - ~bugfixes mostly until 1.0.0 - bug reports welcome.
1+
Turn etherpad into codepad, a collaborative online development enviroment.
2+
http://codepad.etherpad.org
43

54
This etherpad-lite plugin merges functionality of a few simple plugins, and adds tons of functionality on its own.
65
Current features:
76

8-
- File Tree view, open files into pads and save them back.
9-
- Syntaxhighlighting for 92 popular languages - based on highlight.js
7+
- File Tree view, open files into pads and save them, push them to the server filesystem
8+
- Search in project files, replace all instances file by file
9+
- Syntaxhighlighting for 92+ popular languages - based on highlight.js
1010
- Adds themes, properly implemented with css, and a theme generator
1111
- beutify html/css/javascript code with jsBeutify
1212
- Syntax-check javascipt with jsHint, and display results
13-
- Search and replace in pads, and in the prject tree
13+
- Search and replace in pads in a javascript implementation
1414
- save/commit/push (F2) and run custom commands or scripts
1515

1616
- It sets some reasonable defaults and customizes buttons
1717
- Admin interface based on adminpads
1818
- Can use a hash instead of a password in the users section of settings.json (ep_hash_auth)
19-
- Authentication user name to username, and custom color
19+
- Authentication username to etherpad-username, and custom colors defined in settings.json
2020

2121
Special URI's:
2222

23-
- /files - filetree
23+
- /files[#URI] - filetree
2424
- /log - logview
25-
- /v[/folder]/file - quick view-only with syntaxhighlighting
26-
- /p[/folder]/file - open pad for editing
25+
- /v[/folder(s)]/file - quick view-only with syntaxhighlighting
26+
- /s[/folder(s)]/file - raw static view-only without anything
27+
- /p[/folder(s)]/file - open pad for editing
2728

2829
Currently the following codepad parameters are supported in etherpad's settings.json:
2930
- default theme
30-
- project_path to save files
31+
- project_path to save files (needs to be writeable by codepad)
3132
- log_path for displaying logs (parent dir needs execute right)
32-
- button to open a browser to the project
33+
- customize the button to open a browser to the project
3334
- action to perform when pushing files
34-
- authentication password-hash, custom colors
35+
- authentication password-hash and the custom colors
3536

3637
The use of authentication and authorization over https is strongly recommended.
3738
Unauthorized access to settings.json may expose operating system files, in the name of the user etherpad is run as.
39+
Install with npm or git, create your settings.json and restart etherpad after installation.
3840

3941
```
4042
"ep_codepad": {
4143
"theme": "Cobalt",
4244
"project_path": "/srv/project",
4345
"log_path": "/var/log/codepad/log",
4446
"play_url": "http://project.local",
45-
"push_action": "cd /srv/project && git add . && git commit -m codepad-auto"
47+
"push_action": "cd /srv/project && git add . && git commit -m 2.x"
4648
},
4749
"ep_hash_auth": {
4850
"hash_typ": "sha512",
4951
"hash_digest": "hex",
5052
"allow_namechange": "true"
5153
},
5254
"users": {
53-
"Bob": {"hash": "6c98..66d2","is_admin": true, color: "#ff2222"},
54-
"Al": {"hash": "c7r2..b72c","is_admin": true, color: "#2244ff"}
55+
"Bud": {"hash": "6c98..66d2","is_admin": true, "color": "#ff2222"},
56+
"Al": {"hash": "c7r2..b72c","is_admin": true, "color": "#2244ff"}
5557
},
5658
```
59+
An optional parameter, installation_folder has been added to support etherpad installations in a subfolder-path in the URI.
60+
61+
Codpad is NOT tested on and not designed for non-linux operating systems, functionality is partially dependant on linux commands and filesystem properties.
62+
Etherpad / mariadb has limitations on folder/file length - there is a patch to double the allowed 50 characters if you insist on using long path and filenames.
63+
Edit etherpad-lite/src/node/db/PadManager.js change '{1,50}$/.test(padId);' to '{1,100}$/.test(padId);'
5764

58-
Codepad is designed to work together with fedora "srvctl", an LXC container and virtual server farm managment tool.
59-
https://githubub.com/LaKing/Fedora-scripts
65+
Error messages from pads might be hard to see with the tree-view on a dark-backgrounded theme.
6066

61-
Known issues:
62-
- while editing, multiline comments in pads don't get highlighted.
67+
Codepad is designed to work together with fedora srvctl utility, an LXC container and virtual server farm managment tool. It is recommended to run codepad on a VE or VM.
68+
https://github.com/LaKing/srvctl
6369

6470
Please feel free to send comments, bug-reports, ...
65-
.. and/or in case of professional, or commercial use please donate to support open source software developers.
71+
.. and/or in case of professional, or commercial use please donate to support open source software developers, or hire them.

TODO.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// codepad.d250.hu TODO list
2+
3+
SSH2 integration?

buttons.js

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
var eejs = require('ep_etherpad-lite/node/eejs/');
2+
var settings = require('ep_etherpad-lite/node/utils/Settings');
3+
// codepad installation folder
4+
var cif = '';
5+
6+
if (settings.ep_codepad) {
7+
if (settings.ep_codepad.installation_folder) {
8+
cif = settings.ep_codepad.installation_folder;
9+
}
10+
}
211

312
exports.eejsBlock_scripts = function(hook_name, args, cb) {
413
//args.content = args.content + "<script src='../static/plugins/ep_codepad/static/js/buttons.js'></script>";
5-
args.content += eejs.require("ep_codepad/templates/menuLeftScripts.ejs");
14+
args.content += eejs.require("ep_codepad/templates/menuLeftScripts.ejs", {
15+
cif: cif
16+
});
617
return cb();
718
};
819

920
exports.eejsBlock_styles = function(hook_name, args, cb) {
1021
args.content += "<link href='../static/plugins/ep_codepad/static/css/button.css' rel='stylesheet'>";
11-
args.content += "<link rel='stylesheet' href='/static/plugins/ep_codepad/static/css/font-awesome.min.css'>";
22+
args.content += "<link rel='stylesheet' href='../static/plugins/ep_codepad/static/css/font-awesome.min.css'>";
1223
return cb();
13-
};
24+
};

debug-db-reset.sh

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
json="../../settings.json"
4+
5+
DB="$(cat $json | grep -A 5 dbSettings | grep user | tr '"' ' ' | tr ',' ' ' | tr -d '[[:space:]]' )"
6+
db_usr="${DB:5}"
7+
echo "user: $db_usr"
8+
9+
10+
DB="$(cat $json | grep -A 5 dbSettings | grep host | tr '"' ' ' | tr ',' ' ' | tr -d '[[:space:]]' )"
11+
db_host="${DB:5}"
12+
echo "host: $db_host"
13+
14+
15+
DB="$(cat $json | grep -A 5 dbSettings | grep password | tr '"' ' ' | tr ',' ' ' | tr -d '[[:space:]]' )"
16+
db_pwd="${DB:9}"
17+
echo "password: $db_pwd"
18+
19+
20+
DB="$(cat $json | grep -A 5 dbSettings | grep database | tr '"' ' ' | tr ',' ' ' | tr -d '[[:space:]]' )"
21+
db_name="${DB:9}"
22+
echo "database: $db_name"
23+
24+
MDA="-u root"
25+
26+
SQL1="DROP DATABASE $db_name;"
27+
echo "$SQL1"
28+
29+
SQL2="CREATE DATABASE IF NOT EXISTS $db_name;"
30+
echo "$SQL2"
31+
32+
SQL3="GRANT ALL ON $db_name.* TO '$db_usr'@'localhost' IDENTIFIED BY '$db_pwd'; flush privileges;"
33+
echo "$SQL3"
34+
35+
mysql $MDA -e "$SQL1 $SQL2 $SQL3"
36+
37+
38+

dev.sh

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1-
// codepad.d250.hu devell script - my client side
2-
31
#!/bin/bash
4-
while true; do ssh [email protected] "cd /srv/codepad.d250.hu/rootfs/srv/node-project/etherpad-lite/node_modules/ep_codepad/highlight.js && python3 tools/build.py -n && cat /srv/codepad.d250.hu/rootfs/srv/node-project/etherpad-lite/node_modules/ep_codepad/highlight.js/build/highlight.pack.js > /srv/codepad.d250.hu/rootfs/srv/node-project/etherpad-lite/node_modules/ep_codepad/static/js/highlight.codepad.js && chown codepad:codepad /srv/codepad.d250.hu/rootfs/srv/node-project/etherpad-lite/node_modules/ep_codepad/static/js/highlight.codepad.js"; ssh [email protected] "ssh codepad.d250.hu rc" && sleep 2 && firefox-aurora --private "http://codepad.d250.hu/p/test.js"; done
2+
## Codepad development script
3+
4+
while true
5+
do
6+
ssh [email protected] "ssh codepad-devel.d250.hu 'rm -fr /var/log/node-project/*'"
7+
ssh [email protected] "ssh codepad-devel.d250.hu 'cd /srv/highlight.js && node tools/build.js -n && cat /srv/highlight.js/build/highlight.pack.js > /srv/node-project/etherpad-lite/node_modules/ep_codepad/static/js/highlight.codepad.js && chown codepad:codepad /srv/node-project/etherpad-lite/node_modules/ep_codepad/static/js/highlight.codepad.js'"
8+
ssh [email protected] "ssh codepad-devel.d250.hu 'sc node-project !'"
9+
sleep 2
10+
firefox --private "http://codepad-devel.d250.hu/p/test.js";
11+
ssh [email protected] "ssh codepad-devel.d250.hu 'cat /var/log/node-project/err'"
12+
ssh [email protected] "ssh codepad-devel.d250.hu 'tail /var/log/node-project/log'"
13+
done
14+
15+
# codepad.d250.hu devell script
16+
17+
518

0 commit comments

Comments
 (0)