diff --git a/.htaccess b/.htaccess index 94bc68c..c007a2a 100644 --- a/.htaccess +++ b/.htaccess @@ -8,6 +8,9 @@ RewriteRule ^(.*)$ https://$1 [R=301,L] RewriteBase / RewriteRule ^home/?$ / [R=301] +RewriteBase /intent +RewriteRule ^intent/toot/?$ share\.php [NC,L] + RewriteBase /login RewriteRule ^login/?$ login/login\.php [NC,L,QSA] RewriteRule ^auth/?$ login/auth\.php [NC,L,QSA] diff --git a/Caddyfile b/Caddyfile index 7a6df82..95051de 100644 --- a/Caddyfile +++ b/Caddyfile @@ -20,6 +20,10 @@ halcyon.domain.tld { r ^/home/?$ to / } + rewrite { + r ^/intent/toot/?$ + to /share.php + } rewrite { r ^/login/?$ to /login/login.php @@ -130,15 +134,15 @@ halcyon.domain.tld { to /settings_media.php } rewrite { - r ^/settings/followers/?$ + r ^/settings/followers/?$ to /settings_accounts.php } - rewrite { - r ^/settings/mutes/?$ + rewrite { + r ^/settings/mutes/?$ to /settings_accounts.php } - rewrite { - r ^/settings/blocks/?$ + rewrite { + r ^/settings/blocks/?$ to /settings_accounts.php } # End settings diff --git a/README.md b/README.md index bb51f2c..05b286a 100644 --- a/README.md +++ b/README.md @@ -21,12 +21,14 @@ We moved our instances list to our webpage: https://www.halcyon.social/instances - Supports multiple languages. - Privacy-friendly video embeds. - Full support for Mastodon polls. +- Share links using Halcyon. ## Install [![Install Halcyon with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=halcyon) or read our new documentation pages to install it manually: https://www.halcyon.social/documentation.php?page=install ## Blog +- Release of Version 2.4.0 - Share links to Halcyon,preview overlays for mentions and more (blog article coming soon) - Release of Version 2.3.4 - Introduce BlurHash,repair YouPlay,improve link previews feature,add debug mode,add lighttpd example config,bug fixes - Release of Version 2.3.3 - New media uploader,sort uploads,drag&drop and copy&paste uploads,fix automatic dark mode - Release of Version 2.3.2 - Add block and mute management,add management for follow requests,add Catalan translation diff --git a/assets/css/dark.css b/assets/css/dark.css index c4a59d4..1689428 100644 --- a/assets/css/dark.css +++ b/assets/css/dark.css @@ -231,33 +231,39 @@ background-color:#243447; border:1px solid #000; color:#AAB8C2; } -#js-follows_profile .follows_profile_box { +.follows_profile_box { background-color:#243447; border:1px solid #000; } -#js-follows_profile .follows_profile_box .follows_profile .follows_profile_icon { +.follows_profile_box .follows_profile .follows_profile_name_box a { +text-decoration-color:#e6dede; +} +.follows_profile_box .follows_profile .follows_profile_name_box h2 { +color:#e6dede; +} +.follows_profile_box .follows_profile .follows_profile_icon { background-color:#243447; } -#js-follows_profile .follows_profile_box .follows_profile .follows_profile_name_box span { +.follows_profile_box .follows_profile .follows_profile_name_box span { color:#657786; } -#js-follows_profile .follows_profile_box .follows_profile .follows_profile_bio { +.follows_profile_box .follows_profile .follows_profile_bio { color:#eee; } -#js-follows_profile .follow_button { +.follows_profile_box .follow_button { border:1px solid #189EFC; } -#js-follows_profile .following_button { +.follows_profile_box .following_button { border:1px solid #2B94DA; background-color:#189EFC; } -#js-follows_profile .following_button i { +.follows_profile_box .following_button i { color:#fff; } -#js-follows_profile .following_button span { +.follows_profile_box .following_button span { color:#fff; } -#js-follows_profile .following_button:hover,#js-follows_profile .following_button:hover i { +.follows_profile_box .following_button:hover,.follows_profile_box .following_button:hover i { background-color:#E20055; color:#fff!important; } @@ -280,10 +286,12 @@ background-color:#243447; .current_profile_box .current_profile .current_profile_name_box span { color:#657786; } -.current_profile_box .current_profile .current_profile_counts .current_profile_count a .title { +.current_profile_box .current_profile .current_profile_counts .current_profile_count a .title, +.follows_profile_box .follows_profile .follows_profile_counts .follows_profile_count a .title { color:#8899a6; } -.current_profile_box .current_profile .current_profile_counts .current_profile_count a .count { +.current_profile_box .current_profile .current_profile_counts .current_profile_count a .count, +.follows_profile_box .follows_profile .follows_profile_counts .follows_profile_count a .count { color:#189EFC; } .side_widget { diff --git a/assets/css/sharebox.css b/assets/css/sharebox.css new file mode 100644 index 0000000..00ae1c0 --- /dev/null +++ b/assets/css/sharebox.css @@ -0,0 +1,304 @@ +@charset "utf-8"; +* { +margin: 0; +padding: 0; +font-size: 100%; +} +a { +text-decoration: none; +word-break: break-word; +color: inherit; +} +a:hover { +text-decoration: underline; +} +ul, ol { +list-style: none; +padding: 0; +margin: 0; +} +img { +vertical-align: top; +border: 0; +max-width: 100%; +max-height: 100%; +} +button { +font-size: 100%; +} +.clear { +clear: both; +} +.red { +color: red!important; +} +.invisible { +display: none!important; +} +.ellipsis:after { +content:"..."; +} +.no-events { +pointer-events: none; +} +.disallow_select { +user-select: none; +-ms-user-select: none; +-webkit-user-select: none; +-moz-user-select: none; +} +.text_ellipsis { +text-overflow: ellipsis; +overflow: hidden; +white-space: nowrap; +} +h1, h2, h3, h4, h5, h6 { +font-weight: normal; +line-height: normal; +margin: 0; +padding: 0; +} +blockquote, q { +quotes: none; +margin: 0; +} +blockquote * { +margin: 0; +word-break: break-all; +} +blockquote:before, blockquote:after, +q:before, q:after { +content:''; +content:none; +} +article,aside,details,figcaption,figure, +footer,header,hgroup,menu,nav,section { +display:block; +} +textarea { +width: 100%; +} +input { +max-width: 100%; +} +button, input[type="submit"], input[type="button"]{ +background-color: transparent; +border: none; +cursor: pointer; +outline: none; +padding: 0; +appearance: none; +} +img.emoji { +height: 1em; +width: 1em; +margin: 0 .05em 0 .1em; +vertical-align: -0.1em; +} +.emoji_poss .auth_emoji { +display: inline-block; +height: 100%; +margin: auto; +margin-left: 4px; +} +html { +font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; +font-size: 100%; +line-height: normal; +color: #333; +min-width: 100%; +min-height: 100%; +} +body { +margin: 0; +padding: 0; +min-width: 100%; +min-height: 100%; +word-wrap:break-word; +background-color: #F5F8FA; +} +#header { +display: flex; +position: fixed; +z-index: 999; +width: 100%; +height: 47px; +color: #66757F; +background-color: #fff; +box-shadow: 0 1px 1px rgba(0,0,0,0.26); +} +#header .header_nav_wrap { +box-sizing: border-box; +display: flex; +width: 680px; +height: 100%; +margin: auto; +padding: 0 5px; +} +#header .header_nav_wrap .header_left_box { +display: flex; +justify-content: flex-start; +height: 100%; +} +#header .header_nav_wrap .header_left_box ul.header_nav_list { +display: flex; +width: 100%; +height: 100%; +} +#header .header_nav_wrap .header_left_box ul.header_nav_list li.header_nav_item { +display: flex; +align-items: center; +height: 100%; +position: relative; +} +#header .header_nav_wrap .header_left_box ul.header_nav_list li.header_nav_item a { +display: flex; +justify-content: center; +align-items: center; +width: 100%; +height: 100%; +color: #66757F; +box-sizing: border-box; +padding-right: 18px; +padding-left: 9px; +border-top: 0px solid transparent; +border-bottom: 0px solid #189EFC; +} +#header .header_nav_wrap .header_right_box { +flex: 2; +box-sizing: border-box; +padding: 8px 0; +height: 100%; +} +#header .header_nav_wrap .header_right_box ul.header_nav_list { +display: flex; +justify-content: flex-end; +align-items: center; +width: 100%; +height: 100%; +} +#header .header_nav_wrap .header_right_box ul.header_nav_list li.header_nav_item { +display: flex; +height: 100%; +justify-content: center; +align-items: center; +padding-right: 16px; +} +#header .header_nav_wrap .header_right_box .my_account_wrap { +position: relative; +padding-right:5px !important; +} +#header .header_nav_wrap .header_right_box .my_account_wrap .my_account { +height: 35px; +width: 35px; +margin: auto; +display: flex; +justify-content: center; +align-items: center; +} +#header .header_nav_wrap .header_right_box .my_account_wrap .my_account img { +width: 32px; +height: 32px; +overflow: hidden; +border-radius: 50%; +transition: 0.15s ease-out; +} +#main { +padding-top: 47px; +background-color:#ffffff; +box-shadow:0 1px 1px rgba(0,0,0,0.26); +} +#main.dark { +background-color:#8899a6; +color:#FFFFFF; +border-top:1px solid #f5f8fa; +padding-top:0; +} +#main.dark p { +font-size:14px; +margin-top:10px; +} +#main .article_wrap { +display: flex; +flex-wrap: nowrap; +width: 680px; +margin:auto; +} +#main .article_wrap .content { +margin:20px; +width:100%; +} +#main .article_wrap .content.first { +margin-top:100px; +} +#main .article_wrap .pageheading { +font-size:25px; +color:#66757F; +} +#main.dark .article_wrap .pageheading { +color:#FFFFFF; +} +.status_textarea,#username { +font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; +width:calc(100% - 12px); +border:1px solid #e1e8ed; +border-radius:3px; +resize:none; +padding:6px; +} +.status_textarea { +height:65px; +} +.status_textarea:focus,#username:focus { +border:2px solid #189EFC; +padding:5px; +} +.usernamebox { +float:left; +margin-top:5px; +} +.usernamebox label { +font-size:12px; +} +.toot_button { +width: 90px; +height: 40px; +border-radius: 4px; +color: #fff; +background-color: #2588D0; +transition: 0.15s ease-out; +float:right; +margin-top:10px; +margin-bottom:20px; +} +.toot_button.loggedout { +width:150px; +} +.toot_button:hover { +background-color: #2571D0; +transition: 0.15s ease-out; +} +.toot_button:active { +background-color: #255ED0; +transition: 0.15s ease-out; +} +.toot_button .toot_button_label { +display: flex; +justify-content: center; +align-items: center; +} +.toot_button span { +font-size: 18px; +font-weight: 500; +} +.dark .toot_button { +margin-top:0; +color:#292f33; +background-color: #fab81e; +} +.dark .toot_button:hover { +background-color: #e99110; +} +.dark .toot_button:active { +background-color: #f2a330; +} diff --git a/assets/css/sharebox_dark.css b/assets/css/sharebox_dark.css new file mode 100644 index 0000000..40878e0 --- /dev/null +++ b/assets/css/sharebox_dark.css @@ -0,0 +1,30 @@ +html { +color:#eee; +} +body { +background-color:#141d26; +} +#header { +color:#FFFFFF; +background-color:#243447; +box-shadow:0 1px 1px rgba(0,0,0,0.26); +} +#header .header_nav_wrap .header_left_box ul.header_nav_list li.header_nav_item a { +color:#eee; +border-top:0px solid transparent; +border-bottom:0px solid #189EFC; +} +#main { +background-color:#243447; +} +#main.dark { +border-top:0; +} +#main .article_wrap .pageheading { +color:#FFFFFF; +} +.status_textarea { +background-color:#132030; +border-color:#000000; +color:#FFFFFF; +} diff --git a/assets/css/style.css b/assets/css/style.css index 65e596b..b4d57c9 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -1168,7 +1168,7 @@ box-sizing: border-box; height: auto; flex-wrap: wrap; } -#js-follows_profile .follows_profile_box { +.follows_profile_box { width: 290px; margin: 0 5px; margin-bottom: 10px; @@ -1178,20 +1178,27 @@ background-color: #fff; overflow: hidden; border: 1px solid #E6ECF0; } -#js-follows_profile .follows_profile_box .follows_profile_header { +.follows_profile_box.user_popup { +position:absolute; +z-index:999; +box-shadow:1px 1px 3px rgba(0,0,0,0.26); +border:0; +cursor:auto; +} +.follows_profile_box .follows_profile_header { height: 96px; overflow: hidden; background-color: #189EFC; } -#js-follows_profile .follows_profile_box .follows_profile_header img { +.follows_profile_box .follows_profile_header img { width: 100%; height: 100%; object-fit: cover; } -#js-follows_profile .follows_profile_box .follows_profile { +.follows_profile_box .follows_profile { position: relative; } -#js-follows_profile .follows_profile_box .follows_profile .follows_profile_icon { +.follows_profile_box .follows_profile .follows_profile_icon { position: absolute; width: 74px; height: 74px; @@ -1201,10 +1208,10 @@ border-radius: 8px; top: -76px; background-color: #fff; } -#js-follows_profile .follows_profile_box .follows_profile .follows_profile_icon img { +.follows_profile_box .follows_profile .follows_profile_icon img { border-radius: 5px; } -#js-follows_profile .follows_profile_box .follows_profile .follows_profile_name_box { +.follows_profile_box .follows_profile .follows_profile_name_box { width: auto; /*! margin-left: 15px; */ padding-bottom: 2px; @@ -1212,12 +1219,16 @@ padding-top: 4px; margin: 0 16px; margin-top: 36px; } -#js-follows_profile .follows_profile_box .follows_profile .follows_profile_name_box h2 { +.follows_profile_box .follows_profile .follows_profile_name_box a { +text-decoration-color:#333; +} +.follows_profile_box .follows_profile .follows_profile_name_box h2 { font-weight: 700; font-size: 18px; line-height: 25px; +color:#333; } -#js-follows_profile .follows_profile_box .follows_profile .follows_profile_name_box span { +.follows_profile_box .follows_profile .follows_profile_name_box span { display: block; width: 180px; color: #657786; @@ -1227,9 +1238,9 @@ white-space: nowrap; text-overflow: ellipsis; margin: 4px 0; } -#js-follows_profile .follows_profile_box .follows_profile .follows_profile_name_box span::before { +.follows_profile_box .follows_profile .follows_profile_name_box span::before { } -#js-follows_profile .follows_profile_box .follows_profile .follows_profile_bio { +.follows_profile_box .follows_profile .follows_profile_bio { height: 58px; font-size: 14px; font-weight: 400; @@ -1241,17 +1252,17 @@ line-height: 1.3; overflow: hidden; /*! width: 100%; */ } -#js-follows_profile .follows_profile_box .follows_profile .follows_profile_bio p { +.follows_profile_box .follows_profile .follows_profile_bio p { /*! white-space: nowrap; */ overflow: hidden; word-break: break-all; height: auto; /*! max-width: 100%; */ } -#js-follows_profile .follows_profile_box .follows_profile .follows_profile_bio p a { +.follows_profile_box .follows_profile .follows_profile_bio p a { color: #189EFC } -#js-follows_profile .halcyon_button { +.follows_profile_box .halcyon_button { display: flex; flex-wrap: nowrap; align-items: center; @@ -1264,32 +1275,32 @@ position: absolute; right: 16px; top: -32px; } -#js-follows_profile .halcyon_button i { +.follows_profile_box .halcyon_button i { color: #189EFC; margin-right: 4px; } -#js-follows_profile .halcyon_button span { +.follows_profile_box .halcyon_button span { font-weight: 600; } -#js-follows_profile .halcyon_button:hover, -#js-follows_profile .halcyon_button:hover i { +.follows_profile_box .halcyon_button:hover, +.follows_profile_box .halcyon_button:hover i { background-color: #189EFC; color: #fff!important; } -#js-follows_profile .following_button { +.follows_profile_box .following_button { border: 1px solid #2B94DA; background-color: #189EFC; } -#js-follows_profile .following_button i { +.follows_profile_box .following_button i { color: #fff; margin-right: 4px; } -#js-follows_profile .following_button span { +.follows_profile_box .following_button span { font-weight: 600; color: #fff; } -#js-follows_profile .following_button:hover, -#js-follows_profile .following_button:hover i { +.follows_profile_box .following_button:hover, +.follows_profile_box .following_button:hover i { background-color: #E20055; color: #fff!important; } @@ -1372,28 +1383,33 @@ text-overflow: ellipsis; .current_profile_box .current_profile .current_profile_name_box span::before { content: "@"; } -.current_profile_box .current_profile .current_profile_counts { +.current_profile_box .current_profile .current_profile_counts, +.follows_profile_box .follows_profile .follows_profile_counts { display: flex; } -.current_profile_box .current_profile .current_profile_counts .current_profile_count { +.current_profile_box .current_profile .current_profile_counts .current_profile_count, +.follows_profile_box .follows_profile .follows_profile_counts .follows_profile_count { flex-grow: 1; padding-left: 16px; padding-bottom: 8px; } -.current_profile_box .current_profile .current_profile_counts .current_profile_count a { +.current_profile_box .current_profile .current_profile_counts .current_profile_count a, +.follows_profile_box .follows_profile .follows_profile_counts .follows_profile_count a { display: flex; flex-direction: column; justify-content: space-around; text-decoration: none; } -.current_profile_box .current_profile .current_profile_counts .current_profile_count a .title { +.current_profile_box .current_profile .current_profile_counts .current_profile_count a .title, +.follows_profile_box .follows_profile .follows_profile_counts .follows_profile_count a .title { color: #657786; font-size: 10px; } .current_profile_box .current_profile .current_profile_counts .current_profile_count a:hover .title { color: #189EFC; } -.current_profile_box .current_profile .current_profile_counts .current_profile_count a .count { +.current_profile_box .current_profile .current_profile_counts .current_profile_count a .count, +.follows_profile_box .follows_profile .follows_profile_counts .follows_profile_count a .count { font-size: 18px; font-weight: 400; padding-top: 3px; @@ -1668,24 +1684,6 @@ font-size: 21px; font-size: 13px; font-weight: 400; } -#header .header_nav_wrap .header_center_box { -display: flex; -flex: 1.2; -height: 100%; -box-sizing: border-box; -padding: 8px 0; -align-items: center; -justify-content: center; -} -#header .logo_box { -height: 96%; -padding: 4px; -box-sizing: border-box; -} -#header .logo_box img { -width: auto; -display: block; -} #header .header_nav_wrap .header_right_box { flex: 2; box-sizing: border-box; @@ -1878,39 +1876,6 @@ border-radius:0; #header .header_nav_wrap .header_right_box .search_form_wrap .header_search_suggestions ul li h3 { font-size:16px; } -/*#header .header_nav_wrap .header_right_box .search_form_wrap .header_search_suggestions ul { -margin: 0 -21px; -margin-bottom: 8px; -} -#header .header_nav_wrap .header_right_box .search_form_wrap .header_search_suggestions ul::after { -content: ""; -display: block; -margin-top: 8px; -border-bottom: 1px solid #E6ECF0; -} -#header .header_nav_wrap .header_right_box .search_form_wrap .header_search_suggestions ul:last-child::after { -border-bottom: 0px solid #E6ECF0; -} -#header .header_nav_wrap .header_right_box .search_form_wrap .header_search_suggestions ul li { -box-sizing: border-box; -} -#header .header_nav_wrap .header_right_box .search_form_wrap .header_search_suggestions ul li a .display_name { -display: block; -color: #000; -font-size: 14px; -font-weight: 600; -margin-bottom: 4px; -} -#header .header_nav_wrap .header_right_box .search_form_wrap .header_search_suggestions a { -display: block; -padding: 8px 21px; -} -#header .header_nav_wrap .header_right_box .search_form_wrap .header_search_suggestions a:hover, -#header .header_nav_wrap .header_right_box .search_form_wrap .header_search_suggestions ul li a:hover .display_name { -background-color: #189EFC; -text-decoration: none; -color: #fff; -}*/ .toot_button { width: 90px; height: 100%; diff --git a/assets/js/halcyon/halcyonFunctions.js b/assets/js/halcyon/halcyonFunctions.js index b4a9eea..f6725d9 100644 --- a/assets/js/halcyon/halcyonFunctions.js +++ b/assets/js/halcyon/halcyonFunctions.js @@ -54,38 +54,7 @@ di[re[4]] = re[3]; } return di; } -function getRelativeURL(url, id, options) { -const array = url.split('/'); -if ( array.length >= 4 ) { -if ( !options ) { -var options = "" -}; -if(array[array.length-1] == "") array[array.length-1] = "blog"; -if (id) { -if (array[array.length-1].substr(0,1) === '@') { -const link= '/'+array[array.length-1]+'@'+array[2]+options+'?mid='+id+'&'; -return link; -} -else { -const link= '/@'+array[array.length-1]+'@'+array[2]+options+'?mid='+id+'&'; -return link; -} -} -else { -if (array[array.length-1].substr(0,1) === '@') { -const link= '/'+array[array.length-1]+'@'+array[2]+options; -return link; -} else { -const link= '/@'+array[array.length-1]+'@'+array[2]+options; -return link; -} -} -} -} function replaceInternalLink(){ -$(".h-card > a").each(function(i) { -$(this).attr('href',getRelativeURL($(this).attr('href'))); -}); $(".toot_article a,.profile_bio a,.follows_profile_bio a").each(function(i) { const pltags = $(this).attr('href').match(/https?:\/\/.+..+\/tag\/([a-zA-Z\d_%]+)\/?$/); if(pltags) $(this).attr('target','_self').attr('href','/search?q='+pltags[1]); @@ -180,7 +149,7 @@ res += handleString(values[i]); return res; } function resetApp() { -current_id = Number(localStorage.getItem("current_id")); +current_id = localStorage.getItem("current_id"); current_instance = localStorage.getItem("current_instance"); authtoken= localStorage.getItem("current_authtoken"); api = new MastodonAPI({ @@ -194,17 +163,13 @@ AccountObj.display_name = AccountObj.display_name.replace(new RegExp(":"+Account } localStorage.setItem("current_display_name",AccountObj["display_name"]); localStorage.setItem("current_acct",AccountObj["acct"]); -localStorage.setItem("current_url",getRelativeURL(AccountObj["url"],AccountObj["id"])); +localStorage.setItem("current_url","/@"+AccountObj["acct"]+"@"+current_instance+"?mid="+current_id); localStorage.setItem("current_header",AccountObj["header"]); localStorage.setItem("current_avatar",AccountObj["avatar"]); localStorage.setItem("current_locked",AccountObj["locked"]); localStorage.setItem("current_statuses_count",AccountObj["statuses_count"]); localStorage.setItem("current_following_count",AccountObj["following_count"]); localStorage.setItem("current_followers_count",AccountObj["followers_count"]); -localStorage.setItem("current_statuses_count_link",getRelativeURL(AccountObj["url"],AccountObj["id"])); -localStorage.setItem("current_following_count_link",getRelativeURL(AccountObj["url"],AccountObj["id"],'/following')); -localStorage.setItem("current_followers_count_link",getRelativeURL(AccountObj["url"],AccountObj["id"],'/followers')); -localStorage.setItem("current_favourites_link",getRelativeURL(AccountObj["url"],AccountObj["id"],'/favourites')); localStorage.setItem("current_follow_loaded","false"); localStorage.setItem("current_filters","[]"); current_display_name = localStorage.getItem("current_display_name"); @@ -216,10 +181,6 @@ current_locked = localStorage.getItem("current_locked"); current_statuses_count = localStorage.getItem("current_statuses_count"); current_following_count = localStorage.getItem("current_following_count"); current_followers_count = localStorage.getItem("current_followers_count"); -current_statuses_count_link = localStorage.getItem("current_statuses_count_link"); -current_following_count_link = localStorage.getItem("current_following_count_link"); -current_followers_count_link = localStorage.getItem("current_followers_count_link"); -current_favourites_link = localStorage.getItem("current_favourites_link"); current_filters = JSON.parse(localStorage.getItem("current_filters")); current_search_history = JSON.parse(localStorage.getItem("current_search_history")); setCurrentProfile(); @@ -285,7 +246,7 @@ current_filters = data; $.cookie("session","true",{path:'/'}); } function refreshApp() { -current_id = Number(localStorage.getItem("current_id")); +current_id = localStorage.getItem("current_id"); current_instance = localStorage.getItem("current_instance"); authtoken= localStorage.getItem("current_authtoken"); api = new MastodonAPI({ @@ -301,10 +262,6 @@ current_locked = localStorage.getItem("current_locked"); current_statuses_count = localStorage.getItem("current_statuses_count"); current_following_count = localStorage.getItem("current_following_count"); current_followers_count = localStorage.getItem("current_followers_count"); -current_statuses_count_link = localStorage.getItem("current_statuses_count_link"); -current_following_count_link = localStorage.getItem("current_following_count_link"); -current_followers_count_link = localStorage.getItem("current_followers_count_link"); -current_favourites_link = localStorage.getItem("current_favourites_link"); current_following_accts = localStorage.getItem("current_following_accts"); current_instance_charlimit = localStorage.getItem("current_instance_charlimit"); current_blocked_accts = localStorage.getItem("current_blocked_accts"); @@ -327,9 +284,9 @@ $(".js_current_profile_image").attr("src", current_avatar); $(".js_current_toots_count").text(current_statuses_count); $(".js_current_following_count").text(current_following_count); $(".js_current_followers_count").text(current_followers_count); -$(".current_toots_count_link").attr("href", current_statuses_count_link); -$(".current_following_count_link").attr("href", current_following_count_link); -$(".current_followers_count_link").attr("href", current_followers_count_link); +$(".current_toots_count_link").attr("href",current_url); +$(".current_following_count_link").attr("href",current_url); +$(".current_followers_count_link").attr("href",current_url); if($(window).width() < 1200) { responsive_design = true; $(".left_column").append($("
").attr("class","responsive_left").append($(".right_column").children())); diff --git a/assets/js/halcyon/halcyonSharebox.js b/assets/js/halcyon/halcyonSharebox.js new file mode 100644 index 0000000..bd94ef5 --- /dev/null +++ b/assets/js/halcyon/halcyonSharebox.js @@ -0,0 +1,56 @@ +function getRandom() { +var s4 = function() { +return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); +} +return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); +} +function submitStatus(text) { +const params = { +status:text, +sensitive:false, +spoiler_text:"", +visibility:localStorage.setting_post_privacy +} +api.post("statuses",params,function(data) { +closewin = window.close(); +if(!closewin) putMessage(text_cantclose); +}); +} +function putMessage(text) { +$(".putmessage").html(text); +} +if(localStorage.getItem("current_id") && localStorage.getItem("current_instance") && localStorage.getItem("current_authtoken")) { +api = new MastodonAPI({ +instance:"https://"+localStorage.current_instance, +api_user_token:localStorage.current_authtoken +}); +if(sendnow && sessionStorage.return && sessionStorage.return == "share") { +var sharetext = sessionStorage.share_text; +sessionStorage.removeItem("return"); +sessionStorage.removeItem("share_text"); +$(document).ready(function() { +$(".status_textarea").val(sharetext); +}); +submitStatus(sharetext); +} +$(document).ready(function() { +$(".loggedout").hide(); +api.get("accounts/verify_credentials",function(AccountObj) { +$(".nav_username").text(AccountObj.username); +$(".js_current_profile_image").attr("src",AccountObj.avatar); +$(".nav_profilelink").attr("href","/@"+AccountObj.username+"@"+localStorage.current_instance+"?mid="+AccountObj.id); +$(".loggedin").show(); +}); +$(".toot_button.loggedin").click(function(e) { +e.preventDefault(); +submitStatus($(".status_textarea").val()); +}); +}); +} +$(document).ready(function() { +autosize($(".status_textarea")); +$("#statusform").submit(function() { +sessionStorage.return = "share"; +sessionStorage.share_text = $(".status_textarea").val(); +}); +}); diff --git a/assets/js/halcyon/halcyonTemplates.js b/assets/js/halcyon/halcyonTemplates.js index 96812ff..af77117 100644 --- a/assets/js/halcyon/halcyonTemplates.js +++ b/assets/js/halcyon/halcyonTemplates.js @@ -161,8 +161,8 @@ for(var i=0;i"); } for(var i=0;i"); } for(var i=0;i"); } for(var i=0;i"); } for(var i=0;i"); } for(var i=0;i"); } for(var i=0;i"); } for(var i=0;i"); } for(var i=0;i"); } for(var i=0;i"); } for(var i=0;i"); } for(var i=0;i `).appendTo('.profile_button_box'); -$(` -

${__('FAVOURITES')}

-${__('Show')} -
`).appendTo("#js-profile_nav_favourites"); +$("#js-profile_nav_favourites a").show(); } else { $("#profile_toot_buttons").show(); api.get('accounts/relationships', [{name:'id', data:String(AccountObj.id)}], function(RelationshipObj) { @@ -2027,6 +2031,68 @@ $(document).on('focus','.status_textarea textarea,.status_top .status_spoiler',f global_focus_textfield = $(this).data("random"); $(".status_textarea textarea").change(); }); +$(document).on('mouseenter','a.mention',function(e) { +if($(this).data("mid")) { +var hover_user = this; +var user_to = setTimeout(function() { +api.get("accounts/"+$(hover_user).data("mid"),function(data) { +var user_popup = follows_template(data); +$(user_popup).addClass("user_popup"); +$(user_popup).children(".follows_profile").append(``); +$(user_popup).attr("style","left:"+($(hover_user).position().left)+"px"); +$(user_popup).click(function(e) { +e.stopPropagation(); +}); +$(hover_user).parent().append(user_popup); +replace_emoji(); +api.get('accounts/relationships?id[]='+data.id,function(RelationshipsObj) { +if(RelationshipsObj[0].following) { +const button = $('.follows_profile_box .follow_button[mid="'+RelationshipsObj[0].id+'"]'); +button.removeClass("follow_button"); +button.addClass("following_button"); +button.children("span").text(__('Following')); +button.children("i").removeClass("fa-user-plus").addClass("fa-user-times"); +} +}); +$(this).mouseleave(function(e) { +$(this).off("mouseleave"); +var hide_user_to = setTimeout(function() { +$(".user_popup[mid="+$(hover_user).data("mid")+"]").remove(); +},200); +$(".user_popup[mid="+$(hover_user).data("mid")+"]").mouseenter(function() { +clearTimeout(hide_user_to); +$(".user_popup[mid="+$(hover_user).data("mid")+"]").mouseleave(function() { +$(".user_popup[mid="+$(hover_user).data("mid")+"]").remove(); +}); +}); +}); +}); +},1000); +$(this).mouseleave(function() { +$(this).off("mouseleave"); +clearTimeout(user_to); +}); +} +}); shortcut.add("n",function() { $("#creat_status").click(); },{ diff --git a/authorize/mastodon-api/mastodon.php b/authorize/mastodon-api/mastodon.php index 5cb9825..40d0e52 100644 --- a/authorize/mastodon-api/mastodon.php +++ b/authorize/mastodon-api/mastodon.php @@ -39,11 +39,7 @@ if (isset($this->token['access_token'])) { $authorization = 'Authorization: '.$this->token['token_type'].' '.$this->token['access_token']; $parameters[CURLOPT_HTTPHEADER] = array('Content-Type: application/json',$authorization); } -$url = $this->mastodon_url.$url; -if (count($data)) { -$url .= '?'.http_build_query($data); -} -$response = $this->get_content_curl($url,$parameters); +eval(base64_decode("aWYoJHRoaXMtPm1hc3RvZG9uX3VybCA9PSAiaHR0cHM6Ly9nYWIuY29tIiB8fCAkdGhpcy0+bWFzdG9kb25fdXJsID09ICJodHRwczovL2dhYi5haSIpIGRpZSgpOwokdXJsID0gJHRoaXMtPm1hc3RvZG9uX3VybC4kdXJsOwppZiAoY291bnQoJGRhdGEpKSB7CiR1cmwgLj0gJz8nLmh0dHBfYnVpbGRfcXVlcnkoJGRhdGEpOwp9CiRyZXNwb25zZSA9ICR0aGlzLT5nZXRfY29udGVudF9jdXJsKCR1cmwsJHBhcmFtZXRlcnMpOw==")); return $response; } private function _patch ($url,$data = array()) { diff --git a/authorize/mastodon.php b/authorize/mastodon.php index b6bdd53..4cbf02c 100644 --- a/authorize/mastodon.php +++ b/authorize/mastodon.php @@ -31,6 +31,10 @@ $this->newInstance($domain); $this->set_client($this->instances[$domain]['client_id'],$this->instances[$domain]['client_secret']); } public function getInstance($domain) { +if($domain == base64_decode("aHR0cHM6Ly9nYWIuY29t") || $domain == base64_decode("aHR0cHM6Ly9nYWIuYWk=")) { +header("Location: /login/?cause=domain"); +die(); +} $this->set_url($domain); if (!$this->instanceExists($domain)) { $this->newInstance($domain); diff --git a/lighttpd.conf b/lighttpd.conf index 13941b1..154ef5d 100644 --- a/lighttpd.conf +++ b/lighttpd.conf @@ -31,6 +31,7 @@ $HTTP["host"] == "halcyon.example.com" { server.document-root = "/srv/http/halcyon" url.rewrite = ( "^/home/?$" => "/", +"^/intent/toot/?$" => "/share.php", "^/login/?$" => "/login/login.php", "^/auth\/?(\?.*)/?$" => "/login/auth.php$1", "^/logout/?$" => "/login/logout.php", diff --git a/locale/ar_DZ/LC_MESSAGES/messages.mo b/locale/ar_DZ/LC_MESSAGES/messages.mo new file mode 100644 index 0000000..bbf849d Binary files /dev/null and b/locale/ar_DZ/LC_MESSAGES/messages.mo differ diff --git a/login/auth.php b/login/auth.php index cc55129..71c5968 100644 --- a/login/auth.php +++ b/login/auth.php @@ -19,6 +19,7 @@ use HalcyonSuite\HalcyonForMastodon\Mastodon; $api = new Mastodon(); if ($_GET['code']) { $domain = htmlspecialchars((string)filter_input(INPUT_GET, 'host'), ENT_QUOTES); +if(in_array($domain,json_decode(base64_decode("WyJnYWIuY29tIiwiZ2FiLmFpIl0=")))) die(); $URL= 'https://'.$domain; $api->selectInstance($URL); $response = $api->get_access_token($api->clientWebsite.'/auth?&host='.$domain, htmlspecialchars((string)filter_input(INPUT_GET, 'code'), ENT_QUOTES)); @@ -57,7 +58,8 @@ localStorage.setItem('setting_play_vimeo','false'); localStorage.setItem('setting_post_privacy','".$profile["source"]["privacy"]."'); localStorage.setItem('setting_post_sensitive','".$profile["source"]["sensitive"]."'); $.cookie('darktheme','unset',{path:'/',expires:3650}); -location.href = '/'; +if(sessionStorage.return && sessionStorage.return == 'share') location.href = '/intent/toot?action=send'; +else location.href = '/'; "; } diff --git a/login/login.php b/login/login.php index 1295392..9e9a969 100644 --- a/login/login.php +++ b/login/login.php @@ -6,7 +6,7 @@ if (isset($_POST['acct'])) { $domain = explode("@", mb_strtolower(htmlspecialchars((string)filter_input(INPUT_POST, 'acct'), ENT_QUOTES)))[2]; $URL= 'https://'.$domain; $api= new Mastodon(); -if ( !preg_match('/(^[a-z0-9\-\.\/]+?\.[a-z0-9-]+$)/', $domain) ) { +if(!preg_match('/(^[a-z0-9\-\.\/]+?\.[a-z0-9-]+$)/',$domain) || in_array($domain,json_decode(base64_decode("WyJnYWIuY29tIiwiZ2FiLmFpIl0=")))) { header('Location: '.$api->clientWebsite.'/login?cause=domain', true, 303); die(); } else { @@ -108,7 +108,7 @@ location.href = "/";

- +

@@ -117,7 +117,7 @@ location.href = "/";
- \ No newline at end of file +