mirror of
https://github.com/documize/community.git
synced 2025-08-08 06:55:28 +02:00
Merge branch 'master' into enes-tweaks
This commit is contained in:
commit
a840bfd6c1
14 changed files with 73 additions and 155 deletions
124
README.md
124
README.md
|
@ -10,123 +10,7 @@ This software (Documize Community Edition) is licensed under GNU AGPL v3 http://
|
|||
|
||||
You can operate outside the AGPL restrictions by purchasing Documize Enterprise Edition and obtaining a commercial license by contacting <sales@documize.com>.
|
||||
|
||||
## Running Documize for the first time
|
||||
|
||||
Although the Documize binaries run on Linux, Windows and macOS, the build process has only been tested on macOS.
|
||||
|
||||
Install the prerequisites:
|
||||
* Go from https://golang.org (be careful to set the $GOPATH environment variable correctly, you may find https://www.goinggo.net/2016/05/installing-go-and-your-workspace.html helpful)
|
||||
* NPM from https://www.npmjs.com
|
||||
* Ember from http://emberjs.com/
|
||||
* Bower from https://bower.io/
|
||||
* MySQL (v10.7+) from http://dev.mysql.com/downloads/mysql/ (don't forget to copy the one-time password and your system may require a restart)
|
||||
|
||||
Make sure this repository sits at the following position relative to your $GOPATH: $GOPATH/src/github.com/documize/community
|
||||
|
||||
After cloning the repository in the above location, go there and run:
|
||||
```
|
||||
cd app
|
||||
npm install
|
||||
bower install
|
||||
cd ..
|
||||
./build.sh
|
||||
```
|
||||
|
||||
The build script packages up the Ember JS/HTML/CSS code for production use, then generates Go code that creates a simple in-memory file system to contain it. That generated Go code is compiled with the rest to produce a single binary for each of the target systems.
|
||||
|
||||
Your ./bin directory should now contain a set of binaries for a number of target systems. This binary can be executed on any system which also has access to a MySQL database with no further dependencies.
|
||||
|
||||
Use a MySQL tool to create an empty database for Documize to use, making sure that the default collation setting is utf8_general_ci or some other utf8 variant.
|
||||
|
||||
Run Documize for the first time to set-up the database and your user information (for example on OSX, using port 5001, MySQL user root/password and database ‘documize’):
|
||||
```
|
||||
./bin/documize-darwin-amd64 -port=5001 -db='root:password@tcp(localhost:3306)/documize'
|
||||
```
|
||||
An error message will appear in the log to say your installation is in set-up mode. Now navigate to http://localhost:5001 and follow the instructions.
|
||||
|
||||
Hopefully you will now have a working Documize instance.
|
||||
|
||||
Once you have set-up the database as described above, you could go to the ./documize directory and use the command "go run documize.go" in place of the binary name.
|
||||
|
||||
## Command line flags and environment variables
|
||||
|
||||
The command line flags are defined below:
|
||||
```
|
||||
Usage of ./bin/documize-darwin-amd64:
|
||||
-cert string
|
||||
the cert.pem file used for https
|
||||
-db string
|
||||
"username:password@protocol(hostname:port)/databasename" for example "fred:bloggs@tcp(localhost:3306)/documize"
|
||||
-forcesslport string
|
||||
redirect given http port number to TLS
|
||||
-insecure string
|
||||
if 'true' allow https endpoints with invalid certificates (only for testing)
|
||||
-key string
|
||||
the key.pem file used for https
|
||||
-log string
|
||||
system being logged e.g. 'PRODUCTION' (default "Non-production")
|
||||
-offline string
|
||||
set to '1' for OFFLINE mode
|
||||
-plugin string
|
||||
the JSON file describing plugins, default 'DB' uses the database config table 'FILEPLUGINS' entry (default "DB")
|
||||
-port string
|
||||
http/https port number
|
||||
-showsettings
|
||||
if true, show settings in the log (WARNING: these settings may include passwords)
|
||||
```
|
||||
Flags related to SSL/TLS are discussed in detail later.
|
||||
|
||||
For operational convenience, some of these flags can also be set through environment variables: DOCUMIZECERT => -cert ; DOCUMIZEDB => -db ; DOCUMIZEFORCESSLPORT => -forcesslport ; DOCUMIZEKEY => -key ; DOCUMIZEPORT => -port .
|
||||
|
||||
## Configuring the server to use HTTPS
|
||||
|
||||
To configure SSL you will need valid certificate and key .pem files.
|
||||
|
||||
If you don’t have a valid certification key pair for your development machine, you can generate them by doing the following:
|
||||
```
|
||||
cd selfcert
|
||||
go run generate_cert.go -host localhost
|
||||
cd ..
|
||||
```
|
||||
…obviously you should never use a self-generated certificate in a live environment.
|
||||
|
||||
To run Documize using those certs (using the set-up above):
|
||||
```
|
||||
./bin/documize-darwin-amd64 -db='root:password@tcp(localhost:3306)/documize' -port=5001 -cert selfcert/cert.pem -key selfcert/key.pem
|
||||
```
|
||||
If you navigate to https://localhost:5001 and you want to remove the Chrome warning messages about your invalid self-cert follow the instructions at: https://www.accuweaver.com/2014/09/19/make-chrome-accept-a-self-signed-certificate-on-osx/
|
||||
|
||||
If you do not specify a port, Documize will default to port ```443``` if there are key/cert files, port ```80``` otherwise.
|
||||
|
||||
If you want non-SSL http:// traffic to redirect to the SSL port, say from port 9999, use command line flag: ```-forcesslport=9999```
|
||||
|
||||
## Ember
|
||||
|
||||
This section is only required if you want to develop the Ember code.
|
||||
|
||||
These two commands are best run in different terminal windows:
|
||||
|
||||
(1) Run the Go binary needs to run an SSL server on port 5001, as described in the sections above.
|
||||
|
||||
(2) Run the Ember code using the command ```ember s``` from the app directory.
|
||||
|
||||
Ember should be visible by navigating to: http://localhost:4200
|
||||
|
||||
|
||||
## Configuring SMTP
|
||||
|
||||
In order to send e-mail from your Documize instance, you must configure it.
|
||||
|
||||
At present this configuration is not available from the web interface, it requires the use of a MySQL tool of your choice.
|
||||
|
||||
In your database, the table `config` has two fields `key` holding CHAR(255) and `config` holding JSON.
|
||||
|
||||
The SQL to find you current SMTP configuration is: ``` `SELECT `config` FROM `config` WHERE `key` = 'SMTP'; ```
|
||||
|
||||
In an empty database the result will be something like:
|
||||
|
||||
```{"host": "", "port": "", "sender": "", "userid": "", "password": ""}```
|
||||
|
||||
To configure SMTP, you must set these values in the JSON as your systems require, using a MySQL tool.
|
||||
|
||||
The host is the DNS name of your SMTP server; the port defaults to 587; the sender Documize use is "Documize <hello@documize.com>"; userid and password are your SMTP server credentials.
|
||||
Documentation:
|
||||
* [Install from binary guide](https://developers.documize.com/s/VzO9ZqMOCgABGyfW/installation/d/V16L08ucxwABhZF6/install-documize-from-binary-guide)
|
||||
* [Install for development guide](https://developers.documize.com/s/VzO9ZqMOCgABGyfW/installation/d/V16LOMucxwABhZF1/install-documize-for-development-guide)
|
||||
* [Configuration guide](https://developers.documize.com/s/VzO9ZqMOCgABGyfW/installation/d/VzSL8cVZ4QAB2B4Y/configure-documize-guide)
|
||||
|
|
|
@ -32,8 +32,6 @@ export default Ember.Service.extend({
|
|||
this.start();
|
||||
}
|
||||
|
||||
console.log();
|
||||
|
||||
Intercom('trackEvent', id); //jshint ignore: line
|
||||
Intercom('update'); //jshint ignore: line
|
||||
},
|
||||
|
|
|
@ -9,13 +9,14 @@
|
|||
"loader.js": "^3.5.0",
|
||||
"qunit": "~1.20.0",
|
||||
"install": "~1.0.4",
|
||||
"pretender": "~0.10.1",
|
||||
"pretender": "~1.1.0",
|
||||
"lodash": "~3.7.0",
|
||||
"Faker": "~3.0.0"
|
||||
"Faker": "~3.1.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"jquery": ">=2.1.1",
|
||||
"ember": "v2.5.1"
|
||||
"ember": "v2.5.1",
|
||||
"FakeXMLHttpRequest": "^1.4.0"
|
||||
},
|
||||
"version": "0.0.1"
|
||||
}
|
||||
|
|
|
@ -5,11 +5,11 @@ export default function() {
|
|||
this.namespace = 'api'; // make this `api`, for example, if your API is namespaced
|
||||
// this.timing = 400; // delay for each request, automatically set to 0 during testing
|
||||
|
||||
this.get('/public/meta', function(db) {
|
||||
return db.meta[0];
|
||||
this.get('/public/meta', function(schema) {
|
||||
return schema.db.meta[0];
|
||||
});
|
||||
|
||||
this.get('/public/validate', function(db, request) {
|
||||
this.get('/public/validate', function(schema, request) {
|
||||
let serverToken = request.queryParams.token;
|
||||
let token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkb21haW4iOiIiLCJleHAiOjE0NjQwMjM2NjcsImlzcyI6IkRvY3VtaXplIiwib3JnIjoiVnpNdXlFd18zV3FpYWZjRCIsInN1YiI6IndlYmFwcCIsInVzZXIiOiJWek11eUV3XzNXcWlhZmNFIn0.NXZ6bo8mtvdZF_b9HavbidVUJqhmBA1zr0fSAPvbah0";
|
||||
|
||||
|
@ -55,7 +55,7 @@ export default function() {
|
|||
return [];
|
||||
});
|
||||
|
||||
this.get('/documents', function(db, request) {
|
||||
this.get('/documents', function(schema, request) {
|
||||
let folder_id = request.queryParams.folder;
|
||||
|
||||
if (folder_id = "VzMuyEw_3WqiafcG") {
|
||||
|
@ -101,11 +101,11 @@ export default function() {
|
|||
}
|
||||
});
|
||||
|
||||
this.get('/folders', function(db) {
|
||||
return db.folders;
|
||||
this.get('/folders', function(schema) {
|
||||
return schema.db.folders;
|
||||
});
|
||||
|
||||
this.post('/folders', function(db, request) {
|
||||
this.post('/folders', function(schema, request) {
|
||||
var name = JSON.parse(request.requestBody).name;
|
||||
let newFolder = {
|
||||
"id":"V0Vy5Uw_3QeDAMW9",
|
||||
|
@ -117,8 +117,7 @@ export default function() {
|
|||
"folderType":2
|
||||
};
|
||||
|
||||
let folder = db.folders.insert(newFolder);
|
||||
console.log(newFolder);
|
||||
let folder = schema.db.folders.insert(newFolder);
|
||||
return folder;
|
||||
});
|
||||
|
||||
|
@ -153,8 +152,8 @@ export default function() {
|
|||
};
|
||||
});
|
||||
|
||||
this.get('/users/VzMuyEw_3WqiafcE/permissions', (db) => {
|
||||
return db.permissions;
|
||||
this.get('/users/VzMuyEw_3WqiafcE/permissions', (schema) => {
|
||||
return schema.db.permissions;
|
||||
});
|
||||
|
||||
this.get('/folders/VzMuyEw_3WqiafcG/permissions', () => {
|
||||
|
@ -203,11 +202,10 @@ export default function() {
|
|||
];
|
||||
});
|
||||
|
||||
this.put('/folders/:id', (db, request) => {
|
||||
this.put('/folders/:id', (schema, request) => {
|
||||
let id = request.params.id;
|
||||
let attrs = JSON.parse(request.requestBody);
|
||||
let folder = db.folders.update(id, attrs);
|
||||
console.log(folder);
|
||||
let folder = schema.db.folders.update(id, attrs);
|
||||
return folder;
|
||||
});
|
||||
|
||||
|
@ -223,9 +221,9 @@ export default function() {
|
|||
};
|
||||
});
|
||||
|
||||
this.get('folders/:id', (db, request) => {
|
||||
this.get('folders/:id', (schema, request) => {
|
||||
let id = request.params.id;
|
||||
return db.folders.find(id);
|
||||
return schema.db.folders.find(id);
|
||||
});
|
||||
|
||||
this.get('/organizations/VzMuyEw_3WqiafcD', () => {
|
||||
|
@ -242,7 +240,7 @@ export default function() {
|
|||
};
|
||||
});
|
||||
|
||||
this.put('/organizations/VzMuyEw_3WqiafcD', (db, request) => {
|
||||
this.put('/organizations/VzMuyEw_3WqiafcD', (schema, request) => {
|
||||
let title = JSON.parse(request.requestBody).title;
|
||||
let message = JSON.parse(request.requestBody).title;
|
||||
let allowAnonymousAccess = JSON.parse(request.requestBody).allowAnonymousAccess;
|
||||
|
@ -312,7 +310,7 @@ export default function() {
|
|||
}];
|
||||
});
|
||||
|
||||
this.post('/users', (db, request) => {
|
||||
this.post('/users', (schema, request) => {
|
||||
let firstname = JSON.parse(request.requestBody).firstname;
|
||||
let lastname = JSON.parse(request.requestBody).lastname;
|
||||
let email = JSON.parse(request.requestBody).email;
|
||||
|
@ -373,7 +371,7 @@ export default function() {
|
|||
]};
|
||||
});
|
||||
|
||||
this.put('/users/VzMuyEw_3WqiafcE', (db, request) => {
|
||||
this.put('/users/VzMuyEw_3WqiafcE', (schema, request) => {
|
||||
let firstname = JSON.parse(request.requestBody).firstname;
|
||||
let lastname = JSON.parse(request.requestBody).lastname;
|
||||
let email = JSON.parse(request.requestBody).email;
|
|
@ -29,7 +29,7 @@
|
|||
"ember-cli-htmlbars-inline-precompile": "^0.3.1",
|
||||
"ember-cli-inject-live-reload": "^1.4.0",
|
||||
"ember-cli-jshint": "^1.0.0",
|
||||
"ember-cli-mirage": "0.1.13",
|
||||
"ember-cli-mirage": "^0.2.0",
|
||||
"ember-cli-qunit": "^1.4.0",
|
||||
"ember-cli-release": "0.2.8",
|
||||
"ember-cli-sass": "5.3.1",
|
||||
|
|
|
@ -2,4 +2,5 @@ import Ember from 'ember';
|
|||
|
||||
export default function destroyApp(application) {
|
||||
Ember.run(application, 'destroy');
|
||||
server.shutdown();
|
||||
}
|
||||
|
|
|
@ -85,7 +85,8 @@ func (t *Provider) Command(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
defer r.Body.Close()
|
||||
defer r.Body.Close() // ignore error
|
||||
|
||||
body, err := ioutil.ReadAll(r.Body)
|
||||
|
||||
if err != nil {
|
||||
|
@ -309,7 +310,14 @@ func (*Provider) getCommits(client *gogithub.Client, config githubConfig) ([]git
|
|||
// Refresh ... gets the latest version
|
||||
func (t *Provider) Refresh(configJSON, data string) string {
|
||||
var c = githubConfig{}
|
||||
json.Unmarshal([]byte(configJSON), &c)
|
||||
|
||||
err := json.Unmarshal([]byte(configJSON), &c)
|
||||
|
||||
if err != nil {
|
||||
log.Error("unable to unmarshall github config", err)
|
||||
return data
|
||||
}
|
||||
|
||||
c.Clean()
|
||||
|
||||
refreshed, err := t.getCommits(t.githubClient(c), c)
|
||||
|
@ -335,15 +343,27 @@ type githubRender struct {
|
|||
CommitCount int
|
||||
}
|
||||
|
||||
// Render ... just returns the data given
|
||||
// Render ... just returns the data given, suitably formatted
|
||||
func (*Provider) Render(config, data string) string {
|
||||
var err error
|
||||
|
||||
raw := []githubBranchCommits{}
|
||||
payload := githubRender{}
|
||||
var c = githubConfig{}
|
||||
|
||||
json.Unmarshal([]byte(data), &raw)
|
||||
json.Unmarshal([]byte(config), &c)
|
||||
err = json.Unmarshal([]byte(data), &raw)
|
||||
|
||||
if err != nil {
|
||||
log.Error("unable to unmarshall github data", err)
|
||||
return "Documize internal github json umarshall data error: " + err.Error()
|
||||
}
|
||||
|
||||
err = json.Unmarshal([]byte(config), &c)
|
||||
|
||||
if err != nil {
|
||||
log.Error("unable to unmarshall github config", err)
|
||||
return "Documize internal github json umarshall config error: " + err.Error()
|
||||
}
|
||||
|
||||
c.Clean()
|
||||
|
||||
|
@ -356,7 +376,6 @@ func (*Provider) Render(config, data string) string {
|
|||
}
|
||||
|
||||
t := template.New("github")
|
||||
var err error
|
||||
|
||||
t, err = t.Parse(renderTemplate)
|
||||
|
||||
|
@ -403,12 +422,24 @@ func Callback(res http.ResponseWriter, req *http.Request) error {
|
|||
var gt githubCallbackT
|
||||
|
||||
err = json.NewDecoder(res2.Body).Decode(>)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
res2.Body.Close()
|
||||
err = res2.Body.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
returl, err := url.QueryUnescape(state)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
up, err := url.Parse(returl)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
target := up.Scheme + "://" + up.Host + up.Path + "?code=" + gt.AccessToken
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# SDK for the Documize system
|
||||
|
||||
The SDK is in development, please do not use in a live environment.
|
||||
|
||||
## documize command
|
||||
|
||||
The directory "documize" contains a command line utility to load files onto the Documize server.
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
|
@ -30,7 +30,10 @@ func main() {
|
|||
flagSet.String("folder", "", "the Documize folder to use"),
|
||||
flagSet.String("action", "load", "the Documize action to take")
|
||||
|
||||
flagSet.Parse(os.Args[1:])
|
||||
if err := flagSet.Parse(os.Args[1:]); err != nil {
|
||||
fmt.Println("unable to parse Documize arguments:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if *url == "" {
|
||||
fmt.Println("Please set the environment variable DOCUMIZEAPI or use the -api flag")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue