mirror of
				https://github.com/janeczku/calibre-web
				synced 2025-11-04 01:03:02 +00:00 
			
		
		
		
	mp3 player was missing the csrf_token
This commit is contained in:
		
							
								
								
									
										12
									
								
								cps/static/js/libs/bar-ui.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								cps/static/js/libs/bar-ui.js
									
									
									
									
										vendored
									
									
								
							@@ -177,6 +177,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        whileplaying: function () {
 | 
					        whileplaying: function () {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          // get csrf_token
 | 
				
			||||||
 | 
					          let csrf_token = $("input[name='csrf_token']").val();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          //This sends a bookmark update to calibreweb every 30 seconds.
 | 
					          //This sends a bookmark update to calibreweb every 30 seconds.
 | 
				
			||||||
          if (this.progressBuffer == undefined) {
 | 
					          if (this.progressBuffer == undefined) {
 | 
				
			||||||
@@ -187,7 +190,10 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            $.ajax(calibre.bookmarkUrl, {
 | 
					            $.ajax(calibre.bookmarkUrl, {
 | 
				
			||||||
              method: "post",
 | 
					              method: "post",
 | 
				
			||||||
              data: { bookmark: this.position }
 | 
					              data: {
 | 
				
			||||||
 | 
					                csrf_token: csrf_token,
 | 
				
			||||||
 | 
					                bookmark: this.position
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
            }).fail(function (xhr, status, error) {
 | 
					            }).fail(function (xhr, status, error) {
 | 
				
			||||||
              console.error(error);
 | 
					              console.error(error);
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
@@ -313,14 +319,14 @@
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        onstop: function () {
 | 
					        onstop: function () {
 | 
				
			||||||
          
 | 
					
 | 
				
			||||||
          $.ajax(calibre.bookmarkUrl, {
 | 
					          $.ajax(calibre.bookmarkUrl, {
 | 
				
			||||||
            method: "post",
 | 
					            method: "post",
 | 
				
			||||||
            data: { bookmark: this.position }
 | 
					            data: { bookmark: this.position }
 | 
				
			||||||
          }).fail(function (xhr, status, error) {
 | 
					          }).fail(function (xhr, status, error) {
 | 
				
			||||||
            console.error(error);
 | 
					            console.error(error);
 | 
				
			||||||
          });
 | 
					          });
 | 
				
			||||||
        
 | 
					
 | 
				
			||||||
          utils.css.remove(dom.o, 'playing');
 | 
					          utils.css.remove(dom.o, 'playing');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -114,6 +114,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
soundManager.setup({
 | 
					soundManager.setup({
 | 
				
			||||||
  useHTML5Audio: true,
 | 
					  useHTML5Audio: true,
 | 
				
			||||||
@@ -137,6 +139,7 @@ window.calibre = {
 | 
				
			|||||||
        bookmarkUrl: "{{ url_for('web.set_bookmark', book_id=mp3file, book_format=audioformat.upper()) }}",
 | 
					        bookmarkUrl: "{{ url_for('web.set_bookmark', book_id=mp3file, book_format=audioformat.upper()) }}",
 | 
				
			||||||
        bookmark: "{{ bookmark.bookmark_key if bookmark != None }}",
 | 
					        bookmark: "{{ bookmark.bookmark_key if bookmark != None }}",
 | 
				
			||||||
        useBookmarks: "{{ g.user.is_authenticated | tojson }}"
 | 
					        useBookmarks: "{{ g.user.is_authenticated | tojson }}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
</body>
 | 
					</body>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user