44 |
45 |
46 | -------------------------------------------------------------------------------- /src/main/resources/fiets/views/js/bookmarklet-orig.js: -------------------------------------------------------------------------------- 1 | $.ajax({ 2 | url: "%HOST%/add-feed", 3 | dataType: "jsonp", 4 | data: { 5 | url: window.location.href 6 | } 7 | }) 8 | .done(function (data) { 9 | alert(data.title || data.error); 10 | }); 11 | 12 | -------------------------------------------------------------------------------- /src/main/resources/fiets/views/js/bookmarklet.js: -------------------------------------------------------------------------------- 1 | javascript:void%20function(a){var%20b=function(a){a.ajax({url:%HOST%/add-feed%22,dataType:%22jsonp%22,data:{url:window.location.href}}).done(function(a){alert(a.title||a.error)})};if(a%26%26a.fn%26%261.7%3C=parseFloat(a.fn.jquery))return%20void%20load(a);var%20c=document.createElement(%22script%22);c.src=%22https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js%22,c.onload=c.onreadystatechange=function(){var%20a=this.readyState;a%26%26%22loaded%22!==a%26%26%22complete%22!==a||b(jQuery.noConflict())},document.getElementsByTagName(%22head%22)[0].appendChild(c)}(window.jQuery); -------------------------------------------------------------------------------- /src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ./logs 5 | 6 | 7 | 8 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/main/resources/static/scripts.js: -------------------------------------------------------------------------------- 1 | setInterval(function () { 2 | $.ajax({ 3 | dataType: "json", 4 | url: "/counts", 5 | cache: false 6 | }) 7 | .done(function (data, textStatus, jqXHR) { 8 | var unread = data.unread_count; 9 | var $unread = $('.unread-count'); 10 | if ($unread.length > 0) { 11 | $('.unread-count').text(unread); 12 | var $doc = $(document); 13 | var title = $doc.attr("title"); 14 | if (title.indexOf(' of ') > 0) { 15 | title = title.replace(/of \d+ posts/, 'of ' + unread + ' posts'); 16 | } else { 17 | title = title.replace(/\d+ posts/, unread + ' posts'); 18 | } 19 | $doc.attr("title", title); 20 | } 21 | }) 22 | .fail(function(jqXHR, textStatus, errorThrown) { 23 | console.log(textStatus + " - " + errorThrown); 24 | alert(textStatus); 25 | }); 26 | }, 30000); 27 | 28 | $('body') 29 | .on('click', '.post-actions .add-bookmark,.post-actions .remove-bookmark', function (evt) { 30 | evt.preventDefault(); 31 | var $link = $(this); 32 | var target = $link.attr('href'); 33 | var $post = $link.closest('.post'); 34 | $.ajax({ 35 | url: target, 36 | cache: false 37 | }) 38 | .done(function (data, textStatus, jqXHR) { 39 | var $bookmarkCount = $('.bookmark-count'); 40 | var count = parseInt($bookmarkCount.text()); 41 | if ($link.hasClass('add-bookmark')) { 42 | $post.addClass('bookmarked'); 43 | $bookmarkCount.text(count+1); 44 | } else if ($link.hasClass('remove-bookmark')) { 45 | $post.removeClass('bookmarked'); 46 | $bookmarkCount.text(count-1); 47 | } 48 | }) 49 | .fail(function(jqXHR, textStatus, errorThrown) { 50 | console.log(textStatus + " - " + errorThrown); 51 | alert(textStatus); 52 | }); 53 | }) 54 | .on('click', '.post-actions .add-filter', function (evt) { 55 | var link = $(this).closest('.post').find("h3 a"); 56 | var url = link.attr('href'); 57 | var title = link.closest('h3').attr('title'); 58 | $('#filter-url').val(url); 59 | $('#filter-title').val(title); 60 | $('#add-filter').show(); 61 | $('#edit-filter').hide(); 62 | $('#edit-filter-modal').modal(); 63 | }) 64 | .on('click', '.filter-actions .edit-filter', function (evt) { 65 | var row = $(this).closest('ul'); 66 | var id = row.data('id'); 67 | var url = row.find('.url').val(); 68 | var urlMatch = row.find('.url-match').val(); 69 | var title = row.find('.title').val(); 70 | var titleMatch = row.find('.title-match').val(); 71 | $('#filter-id').val(id); 72 | $('#filter-url').val(url); 73 | $('#filter-url-match').val(urlMatch); 74 | $('#filter-title').val(title); 75 | $('#filter-title-match').val(titleMatch); 76 | $('#edit-filter').show(); 77 | $('#add-filter').hide(); 78 | $('#edit-filter-modal').modal(); 79 | }) 80 | ; 81 | 82 | $('#add-filter').click(function () { 83 | var form = $('#edit-filter-modal form'); 84 | $.ajax({ 85 | type: 'POST', 86 | url: '/add-filter', 87 | data: form.serialize() 88 | }) 89 | .done(function (data, textStatus, jqXHR) { 90 | $('#edit-filter-modal').modal('hide'); 91 | }) 92 | .fail(function(jqXHR, textStatus, errorThrown) { 93 | console.log(textStatus + " - " + errorThrown); 94 | alert(textStatus); 95 | }); 96 | }); 97 | $('#edit-filter').click(function () { 98 | var form = $('#edit-filter-modal form'); 99 | $.ajax({ 100 | type: 'POST', 101 | url: '/edit-filter', 102 | data: form.serialize() 103 | }) 104 | .done(function (data, textStatus, jqXHR) { 105 | $('#edit-filter-modal').modal('hide'); 106 | }) 107 | .fail(function(jqXHR, textStatus, errorThrown) { 108 | console.log(textStatus + " - " + errorThrown); 109 | alert(textStatus); 110 | }); 111 | }); 112 | $('.bookmarklet').each(function () { 113 | var $a = $(this); 114 | var href = $a.attr("href"); 115 | var url = window.location.href; 116 | var pos = url.indexOf('://') + 3; 117 | pos = url.indexOf('/', pos); 118 | href = href.replace("*HOST*", url.substring(0, pos)); 119 | $a.attr("href", href); 120 | }); 121 | -------------------------------------------------------------------------------- /src/main/resources/static/styles.css: -------------------------------------------------------------------------------- 1 | html { 2 | position: relative; 3 | min-height: 100%; 4 | } 5 | body { 6 | margin-bottom: 60px; 7 | } 8 | .footer { 9 | position: fixed; 10 | bottom: 0; 11 | width: 100%; 12 | height: 60px; 13 | line-height: 60px; 14 | background: white; 15 | border-top: 1px solid #eee; 16 | z-index: 20; 17 | } 18 | 19 | .post, .feed { 20 | position: relative; 21 | } 22 | .feed-actions, .filter-actions, .post-actions { 23 | float: right; 24 | } 25 | 26 | @media (min-width: 576px) { 27 | .post-actions { 28 | visibility: hidden; 29 | } 30 | } 31 | 32 | .post:hover .post-actions { 33 | visibility: visible; 34 | } 35 | 36 | .post h3 { 37 | font-size: 1.1rem; 38 | } 39 | .post.bookmarked .add-bookmark, .post:not(.bookmarked) .remove-bookmark { 40 | display: none; 41 | } 42 | 43 | .list-group-item.post.bookmarked { 44 | border: 1px solid black; 45 | z-index: 1; 46 | } 47 | 48 | .nav-item.active { 49 | border-bottom: 2px solid #ddd; 50 | margin-bottom: 5px; 51 | } 52 | 53 | #edit-filter-modal { 54 | display: none; 55 | } 56 | -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | EMAIL="asiemer@gmx.de" 3 | PASS="test" 4 | 5 | JAR=$(ls fiets-*.jar | tail -1) 6 | nohup java -Dfeverapi.email="$EMAIL" -Dfeverapi.password="$PASS" -jar $JAR \ 7 | >stdout.txt 2>stderr.txt fiets.pid 8 | -------------------------------------------------------------------------------- /stop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PID=`cat fiets.pid` 4 | kill $PID 5 | --------------------------------------------------------------------------------