From f8b4051e4a0f9ee743801c52fc7c4c147f75e1ed Mon Sep 17 00:00:00 2001 From: Sam Wilson Date: Tue, 29 Mar 2022 17:33:59 +0800 Subject: [PATCH] Add push-to-Flickr syndication --- assets/css/post.less | 2 +- public/build/app.5d4441fa.css | 1 - public/build/app.ab8285ed.css | 1 + public/build/entrypoints.json | 2 +- public/build/manifest.json | 2 +- src/Controller/FlickrController.php | 104 +++++++++++++++++++++++++++ src/Controller/SettingController.php | 48 +++++++++++++ src/Filesystems.php | 16 +++++ src/Repository/CommonsRepository.php | 11 +-- templates/post/commons.html.twig | 6 +- templates/post/flickr.html.twig | 62 ++++++++++++++++ templates/post/form.html.twig | 7 ++ templates/setting/index.html.twig | 9 ++- translations/messages.en.yaml | 8 +++ 14 files changed, 266 insertions(+), 13 deletions(-) delete mode 100644 public/build/app.5d4441fa.css create mode 100644 public/build/app.ab8285ed.css create mode 100644 src/Controller/FlickrController.php create mode 100644 templates/post/flickr.html.twig diff --git a/assets/css/post.less b/assets/css/post.less index b0f4e52..ee25af9 100644 --- a/assets/css/post.less +++ b/assets/css/post.less @@ -107,7 +107,7 @@ form.post-edit { #map { height: 300px; } } -form.commons { +form.posse { display: flex; & > .image { diff --git a/public/build/app.5d4441fa.css b/public/build/app.5d4441fa.css deleted file mode 100644 index 40a32d0..0000000 --- a/public/build/app.5d4441fa.css +++ /dev/null @@ -1 +0,0 @@ -/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{-webkit-text-size-adjust:100%;line-height:1.15}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}[hidden],template{display:none}.flashes .message{border:2px solid #ddd;margin:0 1em 1em;padding:.8em}.flashes .message a{font-weight:bolder;text-decoration:underline}.flashes .error{background:#fbe3e4;border-color:#fbc2c4;color:#8a1f11}.flashes .notice{background:#fff6bf;border-color:#ffd324;color:#514721}.flashes .success{background:#e6efc2;border-color:#c6d880;color:#264409}.flashes .error a{color:#8a1f11}.flashes .notice a{color:#514721}.flashes .success a{color:#264409}h1{text-align:center}.post-list{list-style-type:none;margin:auto;max-width:820px;padding:0}.post-list .post{border:solid #def3e6;border-width:1px 1px 0}.post-list .post header{align-items:center;background-color:#f4f6fb;display:flex;padding:0 0 .2em}.post-list .post header>*{padding:0 .8em}.post-list .post header .titles{flex:2}.post-list .post header .titles h2,.post-list .post header .titles p{margin:0;padding:0}.post-list .post header .in-reply-to{font-size:smaller}.post-list .post header a.date{flex:1;font-size:smaller;text-align:right}@media screen and (max-width:500px){.post-list .post header{flex-direction:column}.post-list .post header a.time{font-variant:small-caps;text-align:center}}.post-list .post article{padding:10px}.post-list .post article p.file{text-align:center}.post-list .post article img{max-width:100%}.post-list .post footer{padding-bottom:1em;text-align:center}.post-list .post footer a{color:gray}.post-list .post footer p{margin:0}.post-list .post header h2{flex:2;font-size:medium;margin:0;padding:0}.post-list .post header h2 a{color:#283434}.post-list .post:last-child{border-bottom:1px solid #def3e6}nav.dates{float:left}nav.dates ol{list-style-type:none;padding:0}nav.dates ol ol{margin-left:1em}@media screen and (max-width:500px){nav.dates{border:1px solid #def3e6;float:none;margin:auto;text-align:center}nav.dates ol{margin:0}}nav.dates a.current{color:#283434}nav.dates a.current:hover{text-decoration:none}form.post-edit #body,form.post-edit #map{height:300px}form.commons{display:flex}form.commons>.image{flex:1}form.commons>.form{flex:3;margin-left:1em}form.commons textarea{font-family:monospace}form.login,form.register{margin:4rem auto;max-width:20rem}table td.description.private{background:repeating-linear-gradient(45deg,#f8f7f3,#eee6e6 10px,#f6e4e3 0,#f5dbda 20px)}.tag-cloud{text-align:center}.tag-cloud li{border:1px solid #e5f1e1;display:inline-block;margin:2px;padding:3px}.tag-cloud li a{color:inherit;display:inline-block;font-size:1.3em}.tag-cloud li:hover{background-color:#d2f1cb}.tag-cloud a:hover{text-decoration:none}.tag-cloud li:hover a,.tag-cloud li:hover span.count{visibility:visible}.tag-cloud li a.include{color:green}.tag-cloud li a.exclude{color:orange}.tag-cloud li.weight-1{color:#999;font-size:.8em}.tag-cloud li.weight-2{color:#777;font-size:.8em}.tag-cloud li.weight-3{color:#555;font-size:.8em}.tag-cloud li.weight-4{color:#333;font-size:.9em}.tag-cloud li.weight-5{color:#000;font-size:1em}.tag-cloud li.weight-6{color:#000;font-size:1.1em}.tag-cloud li.weight-7{color:#000;font-size:1.2em}.tag-cloud li.weight-8{color:#000;font-size:1.3em}.tag-cloud li.weight-9{color:#000;font-size:1.4em}.tag-cloud li.weight-10{color:#000;font-size:1.5em}#autoComplete_list{border-top-left-radius:0;border-top-right-radius:0;left:auto;margin:0;right:auto;top:auto}table.wikidata{background-color:#fcfeff;float:right}table.wikidata ul{list-style-type:none;margin:0}table.wikidata th{text-align:left}.icon-link{align-items:center;display:flex}.icon-link img{margin-right:4px}.authority-control{clear:both;font-size:smaller}hr.end{clear:both;visibility:hidden}article{margin:auto;max-width:66em}article .meta{color:#626463;font-variant:small-caps}article .meta a{color:inherit;font-variant:none}article img{max-width:100%}blockquote{border-left:4px solid #768282;margin:0;padding-left:1em}code{background:rgba(71,87,120,.1);border-radius:3px;color:#000;font-size:88%;line-break:anywhere;padding:1px 4px;white-space:pre-wrap}hr{background:#768282;border:0;color:#768282;font-size:0;height:2px;width:50%}table{border-collapse:collapse;border-color:#789987;border-style:solid;border-width:2px 0;margin:auto}table td,table th{padding:.4em .8em;vertical-align:top}table td p,table th p{margin:0}table thead th{border-bottom:1px solid #def3e6}body{color:#283434;font-family:serif}body>footer,body>main{padding:1rem}body>footer{border-top:2px solid #789987}body>footer .footer-inner{margin:auto;max-width:99em}body>footer .p-name{color:inherit;display:block;font-size:larger}body>footer .u-email{display:inline-block;margin-left:2em}body>footer .p-note{max-width:40em}body>footer .powered-by{font-size:smaller;margin-top:3em}a{color:#4e4efa;text-decoration:none}body>header{background-color:#f1f8f2;border-bottom:2px solid #789987;flex:2;padding:.5rem;text-align:center}body>header a{color:#283434}body>header h1{color:#283434;font-variant:small-caps;letter-spacing:.1em;margin:0}body>header nav ul{display:flex;flex-wrap:wrap;list-style-type:none;margin:0;padding:0}body>header nav ul li{flex:1;padding:0 .2em}a:hover{color:#2c2cff;text-decoration:underline}form{background-color:#efefef;padding:1rem}form label{display:block}form .fields{align-items:start;display:flex;flex-wrap:wrap;margin-bottom:.4rem}form .fields .field.size-1{flex:1}form .fields .field.size-2{flex:2}form .fields .field.size-4{flex:4}form .fields .field.size-6{flex:6}form .form-input,form input[type=email],form input[type=password],form input[type=text],form input[type=url],form select,form textarea{background-color:#fff;border:1px solid #def3e6;box-sizing:border-box;height:1.9rem;padding:.2em .4em;width:100%}form textarea{height:auto}form input[disabled]{background-color:#fdfafa;cursor:not-allowed}form a.button,form input[type=submit]{background-color:gray;border:3px outset #a9a9a9;border-radius:3px;color:#fff;display:inline-block;margin-right:1em;padding:0 .3em}form a.button{text-decoration:underline}nav.pagination{margin:1em 0;text-align:center}nav.pagination .disabled{opacity:.5}ol.tabs{border-bottom:1px solid #a9a9a9;display:flex;list-style-type:none}ol.tabs,ol.tabs li{margin:0;padding:0}ol.tabs li a{border:1px solid #d3d3d3;border-bottom-color:#a9a9a9;bottom:-1px;display:block;margin-right:1em;padding:.5em;position:relative}ol.tabs li.active a{border-color:#a9a9a9 #a9a9a9 #fff;color:inherit;z-index:5}ol.tabs li.disabled{opacity:.7}.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;overflow:hidden;padding-left:8px;padding-right:20px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir=rtl] .select2-selection--single .select2-selection__rendered{padding-left:20px;padding-right:8px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{border:none;box-sizing:border-box;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:#fff;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;left:-100000px;position:absolute;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{box-sizing:border-box;padding:4px;width:100%}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{background-color:#fff;border:0;display:block;filter:alpha(opacity=0);height:auto;left:0;margin:0;min-height:100%;min-width:100%;opacity:0;padding:0;position:fixed;top:0;width:auto;z-index:99}.select2-hidden-accessible{clip:rect(0 0 0 0)!important;border:0!important;-webkit-clip-path:inset(50%)!important;clip-path:inset(50%)!important;height:1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;white-space:nowrap!important;width:1px!important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;right:1px;top:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent;border-style:solid;border-width:5px 4px 0;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir=rtl] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir=rtl] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888;border-width:0 4px 5px}.select2-container--default .select2-selection--multiple{background-color:#fff;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-right:10px;margin-top:5px;padding:1px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:700;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir=rtl] .select2-selection--multiple .select2-search--inline,.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:1px solid #000;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple,.select2-container--default.select2-container--open.select2-container--above .select2-selection--single{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple,.select2-container--default.select2-container--open.select2-container--below .select2-selection--single{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{-webkit-appearance:textfield;background:transparent;border:none;box-shadow:none;outline:0}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:#fff}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;background-image:-webkit-linear-gradient(top,#fff 50%,#eee);background-image:-o-linear-gradient(top,#fff 50%,#eee 100%);background-image:linear-gradient(180deg,#fff 50%,#eee);background-repeat:repeat-x;border:1px solid #aaa;border-radius:4px;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#FFFFFFFF",endColorstr="#FFEEEEEE",GradientType=0);outline:0}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;background-image:-webkit-linear-gradient(top,#eee 50%,#ccc);background-image:-o-linear-gradient(top,#eee 50%,#ccc 100%);background-image:linear-gradient(180deg,#eee 50%,#ccc);background-repeat:repeat-x;border:none;border-bottom-right-radius:4px;border-left:1px solid #aaa;border-top-right-radius:4px;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#FFEEEEEE",endColorstr="#FFCCCCCC",GradientType=0);height:26px;position:absolute;right:1px;top:1px;width:20px}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent;border-style:solid;border-width:5px 4px 0;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir=rtl] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir=rtl] .select2-selection--single .select2-selection__arrow{border:none;border-radius:0;border-bottom-left-radius:4px;border-right:1px solid #aaa;border-top-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888;border-width:0 4px 5px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{background-image:-webkit-linear-gradient(top,#fff,#eee 50%);background-image:-o-linear-gradient(top,#fff 0,#eee 50%);background-image:linear-gradient(180deg,#fff 0,#eee 50%);background-repeat:repeat-x;border-top:none;border-top-left-radius:0;border-top-right-radius:0;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#FFFFFFFF",endColorstr="#FFEEEEEE",GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{background-image:-webkit-linear-gradient(top,#eee 50%,#fff);background-image:-o-linear-gradient(top,#eee 50%,#fff 100%);background-image:linear-gradient(180deg,#eee 50%,#fff);background-repeat:repeat-x;border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#FFEEEEEE",endColorstr="#FFFFFFFF",GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:#fff;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:700;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice{float:right;margin-left:5px;margin-right:auto}.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{box-shadow:none;outline:0}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb} \ No newline at end of file diff --git a/public/build/app.ab8285ed.css b/public/build/app.ab8285ed.css new file mode 100644 index 0000000..8609791 --- /dev/null +++ b/public/build/app.ab8285ed.css @@ -0,0 +1 @@ +/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{-webkit-text-size-adjust:100%;line-height:1.15}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}[hidden],template{display:none}.flashes .message{border:2px solid #ddd;margin:0 1em 1em;padding:.8em}.flashes .message a{font-weight:bolder;text-decoration:underline}.flashes .error{background:#fbe3e4;border-color:#fbc2c4;color:#8a1f11}.flashes .notice{background:#fff6bf;border-color:#ffd324;color:#514721}.flashes .success{background:#e6efc2;border-color:#c6d880;color:#264409}.flashes .error a{color:#8a1f11}.flashes .notice a{color:#514721}.flashes .success a{color:#264409}h1{text-align:center}.post-list{list-style-type:none;margin:auto;max-width:820px;padding:0}.post-list .post{border:solid #def3e6;border-width:1px 1px 0}.post-list .post header{align-items:center;background-color:#f4f6fb;display:flex;padding:0 0 .2em}.post-list .post header>*{padding:0 .8em}.post-list .post header .titles{flex:2}.post-list .post header .titles h2,.post-list .post header .titles p{margin:0;padding:0}.post-list .post header .in-reply-to{font-size:smaller}.post-list .post header a.date{flex:1;font-size:smaller;text-align:right}@media screen and (max-width:500px){.post-list .post header{flex-direction:column}.post-list .post header a.time{font-variant:small-caps;text-align:center}}.post-list .post article{padding:10px}.post-list .post article p.file{text-align:center}.post-list .post article img{max-width:100%}.post-list .post footer{padding-bottom:1em;text-align:center}.post-list .post footer a{color:gray}.post-list .post footer p{margin:0}.post-list .post header h2{flex:2;font-size:medium;margin:0;padding:0}.post-list .post header h2 a{color:#283434}.post-list .post:last-child{border-bottom:1px solid #def3e6}nav.dates{float:left}nav.dates ol{list-style-type:none;padding:0}nav.dates ol ol{margin-left:1em}@media screen and (max-width:500px){nav.dates{border:1px solid #def3e6;float:none;margin:auto;text-align:center}nav.dates ol{margin:0}}nav.dates a.current{color:#283434}nav.dates a.current:hover{text-decoration:none}form.post-edit #body,form.post-edit #map{height:300px}form.posse{display:flex}form.posse>.image{flex:1}form.posse>.form{flex:3;margin-left:1em}form.posse textarea{font-family:monospace}form.login,form.register{margin:4rem auto;max-width:20rem}table td.description.private{background:repeating-linear-gradient(45deg,#f8f7f3,#eee6e6 10px,#f6e4e3 0,#f5dbda 20px)}.tag-cloud{text-align:center}.tag-cloud li{border:1px solid #e5f1e1;display:inline-block;margin:2px;padding:3px}.tag-cloud li a{color:inherit;display:inline-block;font-size:1.3em}.tag-cloud li:hover{background-color:#d2f1cb}.tag-cloud a:hover{text-decoration:none}.tag-cloud li:hover a,.tag-cloud li:hover span.count{visibility:visible}.tag-cloud li a.include{color:green}.tag-cloud li a.exclude{color:orange}.tag-cloud li.weight-1{color:#999;font-size:.8em}.tag-cloud li.weight-2{color:#777;font-size:.8em}.tag-cloud li.weight-3{color:#555;font-size:.8em}.tag-cloud li.weight-4{color:#333;font-size:.9em}.tag-cloud li.weight-5{color:#000;font-size:1em}.tag-cloud li.weight-6{color:#000;font-size:1.1em}.tag-cloud li.weight-7{color:#000;font-size:1.2em}.tag-cloud li.weight-8{color:#000;font-size:1.3em}.tag-cloud li.weight-9{color:#000;font-size:1.4em}.tag-cloud li.weight-10{color:#000;font-size:1.5em}#autoComplete_list{border-top-left-radius:0;border-top-right-radius:0;left:auto;margin:0;right:auto;top:auto}table.wikidata{background-color:#fcfeff;float:right}table.wikidata ul{list-style-type:none;margin:0}table.wikidata th{text-align:left}.icon-link{align-items:center;display:flex}.icon-link img{margin-right:4px}.authority-control{clear:both;font-size:smaller}hr.end{clear:both;visibility:hidden}article{margin:auto;max-width:66em}article .meta{color:#626463;font-variant:small-caps}article .meta a{color:inherit;font-variant:none}article img{max-width:100%}blockquote{border-left:4px solid #768282;margin:0;padding-left:1em}code{background:rgba(71,87,120,.1);border-radius:3px;color:#000;font-size:88%;line-break:anywhere;padding:1px 4px;white-space:pre-wrap}hr{background:#768282;border:0;color:#768282;font-size:0;height:2px;width:50%}table{border-collapse:collapse;border-color:#789987;border-style:solid;border-width:2px 0;margin:auto}table td,table th{padding:.4em .8em;vertical-align:top}table td p,table th p{margin:0}table thead th{border-bottom:1px solid #def3e6}body{color:#283434;font-family:serif}body>footer,body>main{padding:1rem}body>footer{border-top:2px solid #789987}body>footer .footer-inner{margin:auto;max-width:99em}body>footer .p-name{color:inherit;display:block;font-size:larger}body>footer .u-email{display:inline-block;margin-left:2em}body>footer .p-note{max-width:40em}body>footer .powered-by{font-size:smaller;margin-top:3em}a{color:#4e4efa;text-decoration:none}body>header{background-color:#f1f8f2;border-bottom:2px solid #789987;flex:2;padding:.5rem;text-align:center}body>header a{color:#283434}body>header h1{color:#283434;font-variant:small-caps;letter-spacing:.1em;margin:0}body>header nav ul{display:flex;flex-wrap:wrap;list-style-type:none;margin:0;padding:0}body>header nav ul li{flex:1;padding:0 .2em}a:hover{color:#2c2cff;text-decoration:underline}form{background-color:#efefef;padding:1rem}form label{display:block}form .fields{align-items:start;display:flex;flex-wrap:wrap;margin-bottom:.4rem}form .fields .field.size-1{flex:1}form .fields .field.size-2{flex:2}form .fields .field.size-4{flex:4}form .fields .field.size-6{flex:6}form .form-input,form input[type=email],form input[type=password],form input[type=text],form input[type=url],form select,form textarea{background-color:#fff;border:1px solid #def3e6;box-sizing:border-box;height:1.9rem;padding:.2em .4em;width:100%}form textarea{height:auto}form input[disabled]{background-color:#fdfafa;cursor:not-allowed}form a.button,form input[type=submit]{background-color:gray;border:3px outset #a9a9a9;border-radius:3px;color:#fff;display:inline-block;margin-right:1em;padding:0 .3em}form a.button{text-decoration:underline}nav.pagination{margin:1em 0;text-align:center}nav.pagination .disabled{opacity:.5}ol.tabs{border-bottom:1px solid #a9a9a9;display:flex;list-style-type:none}ol.tabs,ol.tabs li{margin:0;padding:0}ol.tabs li a{border:1px solid #d3d3d3;border-bottom-color:#a9a9a9;bottom:-1px;display:block;margin-right:1em;padding:.5em;position:relative}ol.tabs li.active a{border-color:#a9a9a9 #a9a9a9 #fff;color:inherit;z-index:5}ol.tabs li.disabled{opacity:.7}.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;overflow:hidden;padding-left:8px;padding-right:20px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir=rtl] .select2-selection--single .select2-selection__rendered{padding-left:20px;padding-right:8px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{border:none;box-sizing:border-box;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:#fff;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;left:-100000px;position:absolute;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{box-sizing:border-box;padding:4px;width:100%}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{background-color:#fff;border:0;display:block;filter:alpha(opacity=0);height:auto;left:0;margin:0;min-height:100%;min-width:100%;opacity:0;padding:0;position:fixed;top:0;width:auto;z-index:99}.select2-hidden-accessible{clip:rect(0 0 0 0)!important;border:0!important;-webkit-clip-path:inset(50%)!important;clip-path:inset(50%)!important;height:1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;white-space:nowrap!important;width:1px!important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;right:1px;top:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent;border-style:solid;border-width:5px 4px 0;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir=rtl] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir=rtl] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888;border-width:0 4px 5px}.select2-container--default .select2-selection--multiple{background-color:#fff;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-right:10px;margin-top:5px;padding:1px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:700;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir=rtl] .select2-selection--multiple .select2-search--inline,.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:1px solid #000;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple,.select2-container--default.select2-container--open.select2-container--above .select2-selection--single{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple,.select2-container--default.select2-container--open.select2-container--below .select2-selection--single{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{-webkit-appearance:textfield;background:transparent;border:none;box-shadow:none;outline:0}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:#fff}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;background-image:-webkit-linear-gradient(top,#fff 50%,#eee);background-image:-o-linear-gradient(top,#fff 50%,#eee 100%);background-image:linear-gradient(180deg,#fff 50%,#eee);background-repeat:repeat-x;border:1px solid #aaa;border-radius:4px;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#FFFFFFFF",endColorstr="#FFEEEEEE",GradientType=0);outline:0}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;background-image:-webkit-linear-gradient(top,#eee 50%,#ccc);background-image:-o-linear-gradient(top,#eee 50%,#ccc 100%);background-image:linear-gradient(180deg,#eee 50%,#ccc);background-repeat:repeat-x;border:none;border-bottom-right-radius:4px;border-left:1px solid #aaa;border-top-right-radius:4px;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#FFEEEEEE",endColorstr="#FFCCCCCC",GradientType=0);height:26px;position:absolute;right:1px;top:1px;width:20px}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent;border-style:solid;border-width:5px 4px 0;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir=rtl] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir=rtl] .select2-selection--single .select2-selection__arrow{border:none;border-radius:0;border-bottom-left-radius:4px;border-right:1px solid #aaa;border-top-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888;border-width:0 4px 5px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{background-image:-webkit-linear-gradient(top,#fff,#eee 50%);background-image:-o-linear-gradient(top,#fff 0,#eee 50%);background-image:linear-gradient(180deg,#fff 0,#eee 50%);background-repeat:repeat-x;border-top:none;border-top-left-radius:0;border-top-right-radius:0;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#FFFFFFFF",endColorstr="#FFEEEEEE",GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{background-image:-webkit-linear-gradient(top,#eee 50%,#fff);background-image:-o-linear-gradient(top,#eee 50%,#fff 100%);background-image:linear-gradient(180deg,#eee 50%,#fff);background-repeat:repeat-x;border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#FFEEEEEE",endColorstr="#FFFFFFFF",GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:#fff;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:700;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice{float:right;margin-left:5px;margin-right:auto}.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{box-shadow:none;outline:0}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb} \ No newline at end of file diff --git a/public/build/entrypoints.json b/public/build/entrypoints.json index 51a0751..e80fd27 100644 --- a/public/build/entrypoints.json +++ b/public/build/entrypoints.json @@ -7,7 +7,7 @@ "/build/app.103342a2.js" ], "css": [ - "/build/app.5d4441fa.css" + "/build/app.ab8285ed.css" ] }, "map": { diff --git a/public/build/manifest.json b/public/build/manifest.json index 4b98aea..7993362 100644 --- a/public/build/manifest.json +++ b/public/build/manifest.json @@ -1,5 +1,5 @@ { - "build/app.css": "/build/app.5d4441fa.css", + "build/app.css": "/build/app.ab8285ed.css", "build/app.js": "/build/app.103342a2.js", "build/map.css": "/build/map.194bb611.css", "build/map.js": "/build/map.bc128b20.js", diff --git a/src/Controller/FlickrController.php b/src/Controller/FlickrController.php new file mode 100644 index 0000000..0041916 --- /dev/null +++ b/src/Controller/FlickrController.php @@ -0,0 +1,104 @@ +flickrApiKey(), $settings->flickrApiSecret()); + $accessToken = new StdOAuth1Token(); + $accessToken->setAccessToken($settings->flickrToken()); + $accessToken->setAccessTokenSecret($settings->flickrTokenSecret()); + $phpFlickr->getOauthTokenStorage()->storeAccessToken('Flickr', $accessToken); + return $phpFlickr; + } + + /** + * @Route("/P{id}/flickr", name="flickr", methods={"GET"}) + * @IsGranted("ROLE_ADMIN") + */ + public function form( + PostRepository $postRepository, + Settings $settings, + string $id + ): Response { + $post = $postRepository->find($id); + if (!$post) { + throw $this->createNotFoundException(); + } + $userInfo = $this->getPhpFlickr($settings)->test()->login(); + return $this->render('post/flickr.html.twig', [ + 'flickr_user' => $userInfo, + 'post' => $post, + ]); + } + + /** + * @Route("/P{id}/flickr", name="flickr_save", methods={"POST"}) + * @IsGranted("ROLE_ADMIN") + */ + public function upload( + PostRepository $postRepository, + SyndicationRepository $syndicationRepository, + Settings $settings, + Filesystems $filesystems, + Request $request, + $id + ) { + /** @var Post $post */ + $post = $postRepository->find($id); + if (!$post) { + throw $this->createNotFoundException(); + } + $fullTempPath = $filesystems->getLocalTempFilepath($post->getFile()); + $tags = []; + foreach ($request->get('tags', []) as $tag) { + // implode(' ', $request->get('tags', [])), + $tags[] = '"' . str_replace('"', "'", $tag) . '"'; + } + $phpFlickr = $this->getPhpFlickr($settings); + $postUrl = $this->generateUrl('post_view', ['id' => $post->getId()], UrlGeneratorInterface::ABSOLUTE_URL); + $result = $phpFlickr->uploader()->upload( + $fullTempPath, + $request->get('title'), + trim($request->get('description')) . "\n\n" . $postUrl, + implode(' ', $tags), + $request->get('is_public') !== null, + $request->get('is_friend') !== null, + $request->get('is_family') !== null, + ); + if (isset($result['message'])) { + $this->addFlash(self::FLASH_NOTICE, $result['message']); + return $this->redirectToRoute('flickr', ['id' => $id]); + } + if (isset($result['stat']) && $result['stat'] === 'ok') { + if ($post->getLocation()) { + $phpFlickr->photosGeo()->setLocation( + $result['photoid'], + $post->getLocation()->getY(), + $post->getLocation()->getX() + ); + } + $userInfo = $this->getPhpFlickr($settings)->test()->login(); + $flickrUrl = 'https://www.flickr.com/photos/' . $userInfo['path_alias'] . '/' . $result['photoid']; + $syndicationRepository->addSyndication($post, $flickrUrl, 'Flickr'); + $this->addFlash(self::FLASH_SUCCESS, 'Uploaded: ' . $flickrUrl); + return $this->redirectToRoute('post_view', ['id' => $id]); + } + } +} diff --git a/src/Controller/SettingController.php b/src/Controller/SettingController.php index 331e73c..ce4ec5d 100644 --- a/src/Controller/SettingController.php +++ b/src/Controller/SettingController.php @@ -3,10 +3,13 @@ namespace App\Controller; use App\Settings; +use Samwilson\PhpFlickr\PhpFlickr; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted; use Symfony\Component\HttpFoundation\Response; +use OAuth\Common\Storage\Session; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; class SettingController extends ControllerBase { @@ -36,6 +39,51 @@ public function index() ]); } + /** + * @Route("/settings/flickr/connect", name="flickr_connect") + * @isGranted("ROLE_ADMIN") + */ + public function flickrConnect(Settings $settings): Response + { + $flickr = new PhpFlickr($settings->flickrApiKey(), $settings->flickrApiSecret()); + $flickr->setOauthStorage(new Session()); + $callbackUrl = $this->generateUrl('flickr_callback', [], UrlGeneratorInterface::ABSOLUTE_URL); + return $this->redirect($flickr->getAuthUrl('write', $callbackUrl)); + } + + /** + * @Route("/settings/flickr/callback", name="flickr_callback") + * @isGranted("ROLE_ADMIN") + */ + public function flickrCallback(Settings $settings, Request $request): Response + { + if (!$request->get('oauth_verifier') || !$request->get('oauth_token')) { + $this->addFlash(self::FLASH_NOTICE, 'No OAuth verifier params passed for Flickr callback.'); + return $this->redirectToRoute('settings'); + } + $flickr = new PhpFlickr($settings->flickrApiKey(), $settings->flickrApiSecret()); + $flickr->setOauthStorage(new Session()); + $accessToken = $flickr->retrieveAccessToken($request->get('oauth_verifier'), $request->get('oauth_token')); + $settings->saveData([ + 'flickr_token' => $accessToken->getAccessToken(), + 'flickr_token_secret' => $accessToken->getAccessTokenSecret(), + ]); + return $this->redirectToRoute('settings'); + } + + /** + * @Route("/settings/flickr/disconnect", name="flickr_disconnect") + * @isGranted("ROLE_ADMIN") + */ + public function flickrDisconnect(Settings $settings): Response + { + $settings->saveData([ + 'flickr_token' => '', + 'flickr_token_secret' => '', + ]); + return $this->redirectToRoute('settings'); + } + /** * @Route("/settings/css", name="settings_css") * @Route("/settings/js", name="settings_js") diff --git a/src/Filesystems.php b/src/Filesystems.php index e9a5cdb..b3ce7b1 100644 --- a/src/Filesystems.php +++ b/src/Filesystems.php @@ -65,6 +65,22 @@ private function getDataStoragePath(File $file): string return "/files/$bracket/" . $id . "." . $file->getExtension(); } + /** + * Download the full-sized original of a file to local temp and return its path. + * + * @return string Full local filesystem path the to file. + */ + public function getLocalTempFilepath(File $file): string + { + $outStream = $this->read($file, File::SIZE_FULL); + $tempFilePath = 'local_tmp/' . $file->getPost()->getId() . '.' . $file->getExtension(); + $tempFs = $this->temp(); + if (!$tempFs->has($tempFilePath)) { + $tempFs->writeStream($tempFilePath, $outStream); + } + return $this->tempRoot() . $tempFilePath; + } + public function write(Filesystem $fs, File $file, string $filePath) { $storagePath = $this->getDataStoragePath($file); diff --git a/src/Repository/CommonsRepository.php b/src/Repository/CommonsRepository.php index b1f3274..debe901 100644 --- a/src/Repository/CommonsRepository.php +++ b/src/Repository/CommonsRepository.php @@ -72,13 +72,14 @@ public function getCommonsUrl(): string */ public function upload(Post $post, string $title, string $text, string $caption, array $depicts): array { - $outStream = $this->filesystems->read($post->getFile(), File::SIZE_FULL); + //$outStream = $this->filesystems->read($post->getFile(), File::SIZE_FULL); $tempFilePath = 'commons/' . $post->getId() . '.' . $post->getFile()->getExtension(); $tempFs = $this->filesystems->temp(); - if (!$tempFs->has($tempFilePath)) { - $tempFs->writeStream($tempFilePath, $outStream); - } - $fullTempPath = $this->filesystems->tempRoot() . $tempFilePath; + // if (!$tempFs->has($tempFilePath)) { + // $tempFs->writeStream($tempFilePath, $outStream); + // } + // $fullTempPath = $this->filesystems->tempRoot() . $tempFilePath; + $fullTempPath = $this->filesystems->getLocalTempFilepath($post->getFile(), $tempFilePath); $api = $this->getMediaWikiApi(); $uploader = new CommonsFileUploader($api); $uploadResult = $uploader->uploadWithResult($title, $fullTempPath, $text); diff --git a/templates/post/commons.html.twig b/templates/post/commons.html.twig index 2ffd209..afd9fa5 100644 --- a/templates/post/commons.html.twig +++ b/templates/post/commons.html.twig @@ -10,7 +10,7 @@

← Return to editing this post

-
+
Image of the file attached to this post.
@@ -26,10 +26,10 @@

- {% for tag in post.tags %} {% if tag.wikidata %} - + {% endif %} {% endfor %} diff --git a/templates/post/flickr.html.twig b/templates/post/flickr.html.twig new file mode 100644 index 0000000..dc8278c --- /dev/null +++ b/templates/post/flickr.html.twig @@ -0,0 +1,62 @@ +{% extends 'base.html.twig' %} + +{% block title %} + {{'posts.flickr.copy_to'|trans}} +{% endblock %} + +{% block body %} + +

{{'posts.flickr.copy_to'|trans}}

+ +

← Return to editing this post

+ + +
+ Image of the file attached to this post. +
+
+

+ {% set flickr_link -%} + + {{- flickr_user.username -}} + + {%- endset %} + {{ 'posts.flickr.logged_in'|trans({'%username_link%': flickr_link})|raw }} +

+

+ + +

+

+ + +

+

+ + +

+

+ + + +

+

+ +

+
+
+ +{% endblock %} diff --git a/templates/post/form.html.twig b/templates/post/form.html.twig index cc49e99..93083bf 100644 --- a/templates/post/form.html.twig +++ b/templates/post/form.html.twig @@ -141,6 +141,13 @@ {% endif %} + {% if post.id %} + + + {{'posts.flickr.copy_to'|trans}} + + + {% endif %}

diff --git a/templates/setting/index.html.twig b/templates/setting/index.html.twig index 729519c..2d2b06a 100644 --- a/templates/setting/index.html.twig +++ b/templates/setting/index.html.twig @@ -36,13 +36,20 @@ - +

Access Token? {% if settings.flickrToken %}✓{% else %}✗{% endif %} Access Token Secret? {% if settings.flickrTokenSecret %}✓{% else %}✗{% endif %}

+

+ {% if settings.flickrToken %} + Disconnect from Flickr + {% else %} + Connect to Flickr + {% endif %} +

diff --git a/translations/messages.en.yaml b/translations/messages.en.yaml index 8f00633..2c0d51d 100644 --- a/translations/messages.en.yaml +++ b/translations/messages.en.yaml @@ -12,6 +12,14 @@ posts: save_tooltip: 'Save the full version of this file' delete: gone-will-be-added: 'An HTTP status of "410 Gone" will be added for this post. See %redirects_link% for more information.' + flickr: + copy_to: 'Copy to Flickr' + logged_in: 'You are logged in as %username_link%.' + title: 'Title:' + description: 'Description:' + is_public: 'Public' + is_friend: 'Friend' + is_family: 'Famiy' settings: title: 'Site Settings' location_legend: 'GPS tracking'