Compare commits
	
		
			7 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 47aeaff66e | |||
| d18a5fd272 | |||
| 3a0566ca0a | |||
| 36f62dd502 | |||
| 5b1a94c735 | |||
| 75c3a98f33 | |||
| e9fbfd0277 | 
							
								
								
									
										1
									
								
								.hgtags
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.hgtags
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					e2250a7fd29052ea767f18e1459cabea4cd7efd3 release-1.0.0
 | 
				
			||||||
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							@@ -2,7 +2,7 @@
 | 
				
			|||||||
# Makefile for contented
 | 
					# Makefile for contented
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VERSION:=1.0.0
 | 
					VERSION:=1.0.1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SOURCES:=Makefile \
 | 
					SOURCES:=Makefile \
 | 
				
			||||||
	static \
 | 
						static \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -86,6 +86,7 @@ const (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func (this *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 | 
					func (this *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 | 
				
			||||||
	w.Header().Set(`Server`, SERVER_HEADER)
 | 
						w.Header().Set(`Server`, SERVER_HEADER)
 | 
				
			||||||
 | 
						w.Header().Set(`Access-Control-Allow-Origin`, `*`) // Blanket allow CORS
 | 
				
			||||||
	if this.opts.MaxUploadBytes > 0 {
 | 
						if this.opts.MaxUploadBytes > 0 {
 | 
				
			||||||
		r.Body = http.MaxBytesReader(w, r.Body, this.opts.MaxUploadBytes)
 | 
							r.Body = http.MaxBytesReader(w, r.Body, this.opts.MaxUploadBytes)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -108,10 +109,12 @@ func (this *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 | 
				
			|||||||
		this.handleUpload(w, r)
 | 
							this.handleUpload(w, r)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	} else if r.Method == "OPTIONS" {
 | 
						} else if r.Method == "OPTIONS" {
 | 
				
			||||||
		// Blanket allow
 | 
							// Blanket allow (headers already set)
 | 
				
			||||||
		w.Header().Set(`Access-Control-Allow-Origin`, `*`)
 | 
					 | 
				
			||||||
		w.WriteHeader(200)
 | 
							w.WriteHeader(200)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						} else if r.Method == "GET" && r.URL.Path == `/` {
 | 
				
			||||||
 | 
							http.Redirect(w, r, `/index.html`, http.StatusFound)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	} else if static, err := Asset(r.URL.Path[1:]); err == nil && r.Method == "GET" {
 | 
						} else if static, err := Asset(r.URL.Path[1:]); err == nil && r.Method == "GET" {
 | 
				
			||||||
		http.ServeContent(w, r, r.URL.Path[1:], this.startTime, bytes.NewReader(static))
 | 
							http.ServeContent(w, r, r.URL.Path[1:], this.startTime, bytes.NewReader(static))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -44,18 +44,17 @@ The server responds on the following URLs:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
=USAGE (EMBEDDING FOR WEB)=
 | 
					=USAGE (EMBEDDING FOR WEB)=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Your webpage should load the SDK from the contented server, then call the `contented.init` function to display the upload widget over the top of an existing DOM element.
 | 
					Your webpage should load the SDK from the contented server, then call the `contented.init` function to display the upload widget over the top of an existing DOM element. Your callback will be passed an array of file IDs of any uploaded items. The SDK depends on jQuery.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The SDK will run your callback, passing it the file IDs of any uploaded items.
 | 
					`<script type="text/javascript" src="SERVER_ADDR/sdk.js"></script>
 | 
				
			||||||
 | 
					 | 
				
			||||||
The SDK depends on jQuery.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
`
 | 
					 | 
				
			||||||
<script type="text/javascript" src="SERVER_ADDR/sdk.js"></script>
 | 
					 | 
				
			||||||
contented.init("#target", function(/* String[] */ items) {});
 | 
					contented.init("#target", function(/* String[] */ items) {});
 | 
				
			||||||
`
 | 
					`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=CHANGELOG=
 | 
					=CHANGELOG=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					2017-10-08: 1.0.1
 | 
				
			||||||
 | 
					- Fix an issue with CORS preflight requests
 | 
				
			||||||
 | 
					- Fix an issue with index URLs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
2017-10-08: 1.0.0
 | 
					2017-10-08: 1.0.0
 | 
				
			||||||
- Initial public release
 | 
					- Initial public release
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								_dist/image1.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								_dist/image1.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 7.2 KiB  | 
		Reference in New Issue
	
	Block a user