Skip to content

Commit

Permalink
「SNSに共有する」ボタンのThreads対応。
Browse files Browse the repository at this point in the history
  • Loading branch information
satopian committed Dec 16, 2024
1 parent a222260 commit d15dbfa
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
9 changes: 5 additions & 4 deletions petitnote/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@

["X","https://x.com"],
["Bluesky","https://bsky.app"],
["Threads","https://www.threads.net"],
["pawoo.net","https://pawoo.net"],
["fedibird.com","https://fedibird.com"],
["misskey.io","https://misskey.io"],
Expand All @@ -508,11 +509,11 @@
];
// SNS共有の時に開くWindowsの幅と高さ

//windowの幅 初期値 350
$sns_window_width = 350;
//windowの幅 初期値 600
$sns_window_width = 600;

//windowの高さ 初期値 490
$sns_window_height = 490;
//windowの高さ 初期値 600
$sns_window_height = 600;

//Misskey投稿機能設定

Expand Down
16 changes: 10 additions & 6 deletions petitnote/functions.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
$functions_ver=20241209;
$functions_ver=20241216;
//編集モードログアウト
function logout(){
$resno=(int)filter_input(INPUT_GET,'resno',FILTER_VALIDATE_INT);
Expand Down Expand Up @@ -1390,18 +1390,22 @@ function post_share_server(){
setcookie("sns_server_radio_cookie",$sns_server_radio_for_cookie, time()+(86400*30),"","",false,true);
setcookie("sns_server_direct_input_cookie",$sns_server_direct_input, time()+(86400*30),"","",false,true);
$share_url='';
if(in_array($sns_server_radio,["https://x.com","https://twitter.com"])){
$share_url="https://x.com/intent/post?text=";
}elseif($sns_server_radio){
if($sns_server_radio){
$share_url=$sns_server_radio."/share?text=";
}elseif($sns_server_direct_input){
$share_url=$sns_server_direct_input."/share?text=";
}
$share_url.=$encoded_t.'&url='.$encoded_u;
if(in_array($sns_server_radio,["https://x.com","https://twitter.com"])){
// $share_url="https://x.com/intent/post?text=";
$share_url="https://twitter.com/intent/tweet?text=";
}
if($sns_server_radio === "https://bsky.app"||!$sns_server_radio && ($sns_server_direct_input === "https://bsky.app")){
$share_url="https://bsky.app/intent/compose?text=";
$share_url.=$encoded_t.'%20'.$encoded_u;
}
if($sns_server_radio === "https://www.threads.net"||!$sns_server_radio && ($sns_server_direct_input === "https://www.threads.net")){
$share_url="https://www.threads.net/intent/post?text=";
}
$share_url.=$encoded_t.'%20'.$encoded_u;
$share_url = filter_var($share_url, FILTER_VALIDATE_URL) ? $share_url : '';
if(!$share_url){
error($en ? "Please select an SNS sharing destination.":"SNSの共有先を選択してください。");
Expand Down
11 changes: 6 additions & 5 deletions petitnote/index.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
//Petit Note (c)さとぴあ @satopian 2021-2024
//1スレッド1ログファイル形式のスレッド式画像掲示板
$petit_ver='v1.63.5';
$petit_lot='lot.20241211';
$petit_ver='v1.63.7';
$petit_lot='lot.20241216';

$lang = ($http_langs = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : '')
? explode( ',', $http_langs )[0] : '';
Expand All @@ -17,7 +17,7 @@
return die(__DIR__.'/functions.php'.($en ? ' does not exist.':'がありません。'));
}
require_once(__DIR__.'/functions.php');
if(!isset($functions_ver)||$functions_ver<20241209){
if(!isset($functions_ver)||$functions_ver<20241216){
return die($en?'Please update functions.php to the latest version.':'functions.phpを最新版に更新してください。');
}
check_file(__DIR__.'/misskey_note.inc.php');
Expand Down Expand Up @@ -86,8 +86,8 @@
$subject_input_required = isset($subject_input_required) ? $subject_input_required : false;
$display_search_nav = isset($display_search_nav) ? $display_search_nav : false;
$switch_sns = isset($switch_sns) ? $switch_sns : true;
$sns_window_width = isset($sns_window_width) ? (int)$sns_window_width : 350;
$sns_window_height = isset($sns_window_height) ? (int)$sns_window_height : 490;
$sns_window_width = isset($sns_window_width) ? (int)$sns_window_width : 800;
$sns_window_height = isset($sns_window_height) ? (int)$sns_window_height : 800;
$use_misskey_note = isset($use_misskey_note) ? $use_misskey_note : true;
$sort_comments_by_newest = isset($sort_comments_by_newest) ? $sort_comments_by_newest : false;
$pmin_w = isset($pmin_w) ? $pmin_w : 300;//幅
Expand Down Expand Up @@ -2079,6 +2079,7 @@ function set_share_server(){

["X","https://x.com"],
["Bluesky","https://bsky.app"],
["Threads","https://www.threads.net"],
["pawoo.net","https://pawoo.net"],
["fedibird.com","https://fedibird.com"],
["misskey.io","https://misskey.io"],
Expand Down

0 comments on commit d15dbfa

Please sign in to comment.