2 コミット 86c00b3922 ... f5833d6003

作者 SHA1 メッセージ 日付
  Daisuke f5833d6003 220422 Notification filtering 2 年 前
  Daisuke f31bacc8a4 220422 Notification filtering 2 年 前
10 ファイル変更64 行追加27 行削除
  1. 26 6
      action.php
  2. 9 5
      css/color.css
  3. 5 3
      css/mobile.css
  4. 6 2
      css/style.css
  5. BIN
      img/aud.png
  6. BIN
      img/doc.png
  7. BIN
      img/vid.png
  8. 16 11
      include/functions.php
  9. 2 0
      include/init.php
  10. 0 0
      js/scripts.js

+ 26 - 6
action.php

@@ -55,6 +55,10 @@ if (isset($_POST['action']) && $_POST['action'] == "settings"){
 				$cookie[$index]['explicit'] = htmlentities($value);
 				break;
 				
+			case "unrollcw":
+				$cookie[$index]['unrollcw'] = htmlentities($value);
+				break;
+				
 			case "emoji":
 				$cookie[$index]['emoji'] = intval($value);
 				break;
@@ -76,10 +80,18 @@ if (isset($_POST['action']) && $_POST['action'] == "settings"){
 				break;
 				
 			
-			case "reblog":
-				$cookie[$index]['reblog'] = ($value == "on" ? "on" : "off");
+			case "theme":
+				$cookie[$index]['theme'] = sanitize($value);
 				break;
 
+			case "notif":
+				$cookie[$index]['notif'] = "";
+				$cookie[$index]['notif'] .= (isset($value['fav']) ? "1" : "0");
+				$cookie[$index]['notif'] .= (isset($value['rt']) ? "1" : "0");
+				$cookie[$index]['notif'] .= (isset($value['mnt']) ? "1" : "0");
+				$cookie[$index]['notif'] .= (isset($value['follow']) ? "1" : "0");
+				break;					
+
 			case "videoloop":
 				$cookie[$index]['videoloop'] = ($value == "on" ? "on" : "off");
 				break;	
@@ -136,6 +148,10 @@ if (isset($_POST['action']) && $_POST['action'] == "settings"){
 
 			case "bw":
 				$theme['bw'] = sanitize($value);
+				break;		
+
+			case "dr":
+				$theme['dr'] = sanitize($value);
 				break;					
 		}
 	}
@@ -272,10 +288,12 @@ foreach($_GET as $key => $value){
 			if(in_array($value,$user_settings['nsfw'])){
 				$key = array_search($value, $user_settings['nsfw']);
 				unset($user_settings['nsfw'][$key]);
-				setrawcookie("user_settings",base64_encode(json_encode($user_settings)),time()+60*60*24*30,'/'); 
+				$cookie[$index]['nsfw'] = $user_settings['nsfw'];
+				setrawcookie("user_settings", base64_encode(json_encode($cookie)) , time() + 60 * 60 * 24 * 30, '/');
 			} else {
 				$user_settings['nsfw'][] = htmlentities($value);
-				setrawcookie("user_settings",base64_encode(json_encode($user_settings)),time()+60*60*24*30,'/'); 
+				$cookie[$index]['nsfw'] = $user_settings['nsfw'];
+				setrawcookie("user_settings", base64_encode(json_encode($cookie)) , time() + 60 * 60 * 24 * 30, '/');
 			}
 			echo "1";
 			die();
@@ -288,10 +306,12 @@ foreach($_GET as $key => $value){
 			if(in_array($value,$user_settings['hide'])){
 				$key = array_search($value, $user_settings['hide']);
 				unset($user_settings['hide'][$key]);
-				setrawcookie("user_settings",base64_encode(json_encode($user_settings)),time()+60*60*24*30,'/'); 
+				$cookie[$index]['hide'] = $user_settings['hide'];
+				setrawcookie("user_settings", base64_encode(json_encode($cookie)) , time() + 60 * 60 * 24 * 30, '/');
 			} else {
 				$user_settings['hide'][] = htmlentities($value);
-				setrawcookie("user_settings",base64_encode(json_encode($user_settings)),time()+60*60*24*30,'/'); 
+				$cookie[$index]['hide'] = $user_settings['hide'];
+				setrawcookie("user_settings", base64_encode(json_encode($cookie)) , time() + 60 * 60 * 24 * 30, '/');
 			}
 			echo "1";
 			die();

+ 9 - 5
css/color.css

@@ -142,11 +142,15 @@ input[type="submit"] {
 	background-color: white;
 	box-shadow: 1px 1px 2px black;
 }
-/*
-.menu div{
-	box-shadow: 1px 1px 2px black;
+
+.mobilemenu {
+	box-shadow: -1px -1px 2px black;
 }
-*/
+
+.mobilemenu .appname a{
+	color: #001935 !important;
+}
+
 .menu li:hover {
 	background-color:#203960 !important;
 }
@@ -317,7 +321,7 @@ input[type="submit"] {
 	box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);
 }
 
-.setting input[type="radio"]:checked+label {
+.setting input[type="radio"]:checked+label,.setting input[type="checkbox"]:checked+label {
 	background-color: #305792;
 	box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
 	color: white;

+ 5 - 3
css/mobile.css

@@ -303,7 +303,7 @@ aside {
 }
 
 .element {
-	width: 100% !important;
+	width: 90% !important;
 	clear: both;
 	display: inline-block;
 	margin-top: 3px;
@@ -311,9 +311,7 @@ aside {
 
 .profile {
 	float:left; 
-	background-color:white; 
 	border-radius:5px; 
-	//width:650px;
 	width:100%;
 }
 
@@ -726,3 +724,7 @@ aside {
 .disabled {
 	background-color: black;
 }
+
+.hidden {
+	display:none;
+}

+ 6 - 2
css/style.css

@@ -635,7 +635,7 @@ aside {
 
 .setting label {
 	display: block;
-	width: 40px;
+	min-width: 40px;
 	height: 20px;
 	padding: 5px;
 	float: left;
@@ -644,7 +644,7 @@ aside {
 	transition: all 0.3s ease-in-out;
 }
 
-.setting input[type="radio"]:checked+label {
+.setting input[type="radio"]:checked+label,.setting input[type="checkbox"]:checked+label {
 	font-weight: bold;
 }
 
@@ -715,3 +715,7 @@ aside {
 .disabled {
 	background-color: black;
 }
+
+.hidden {
+	display:none;
+}

BIN
img/aud.png


BIN
img/doc.png


BIN
img/vid.png


+ 16 - 11
include/functions.php

@@ -372,6 +372,7 @@ function sendpost($text, $media, $reply = null, $markdown = false, $scope = "pub
 function uploadpic($file) {
 	global $srv;
 	global $token;
+
 	if (!is_null($token)) {
 		$mime = get_mime($file);
 		$info = pathinfo($file);
@@ -395,16 +396,13 @@ function uploadpic($file) {
 		$ext = end($ext);
 		$ext = explode("?", $ext) [0];
 
-		if (in_array($ext, array(
-			'jpg',
-			'jpeg',
-			'gif',
-			'png',
-			'svg'
-		))) {
+		if (in_array($ext, array('jpg','jpeg','gif','png','svg','webm'))) {
 			$file = $array['url'];
-		}
-		else {
+		} elseif (in_array($ext, array('mp4','webp','ogv'))) {
+			$file = "img/vid.png";
+		} elseif (in_array($ext, array('mp3','ogg','oga','opus'))) {
+			$file = "img/aud.png";
+		} else {
 			$file = "img/doc.png";
 		}
 		return json_encode(array(
@@ -852,7 +850,14 @@ function getnotif($id = false, $max = false) {
 	global $token;
 	global $user_settings;
 	$n = "";
-	$notif = api_get("notifications?" . ($id == false ? "limit=9&" : "") . ($id != false ? ($max == true ? "max_id=$id" : "since_id=$id") : ""));
+	
+	$exclude = "";
+	$exclude .= (str_split($user_settings['notif'])[0] == 0 ? "&exclude_types[]=favourite" : "");
+	$exclude .= (str_split($user_settings['notif'])[1] == 0 ? "&exclude_types[]=reblog" : "");
+	$exclude .= (str_split($user_settings['notif'])[2] == 0 ? "&exclude_types[]=mention" : "");
+	$exclude .= (str_split($user_settings['notif'])[3] == 0 ? "&exclude_types[]=follow" : "");
+	
+	$notif = api_get("notifications?" . ($id == false ? "limit=9&" : "") . ($id != false ? ($max == true ? "max_id=$id" : "since_id=$id") : "").$exclude);
 	if (!empty($notif)) {
 		foreach ($notif as $post) {
 			if (!isset($post["type"])){
@@ -863,7 +868,7 @@ function getnotif($id = false, $max = false) {
 			$buttons = "";
 			$media = "";
 
-			if ($post["type"] == "pleroma:emoji_reaction"){
+			if (!in_array($post["type"],array("mention","favourite","reblog","follow"))){
 				continue;
 			}
 

+ 2 - 0
include/init.php

@@ -27,6 +27,8 @@
 			$user_settings[0]['videoloop'] = "off";
 			$user_settings[0]['theme'] = "default";
 			$user_settings[0]['nsfw'] = array();	
+			$user_settings[0]['unrollcw'] = "on";
+			$user_settings[0]['notif'] = "1111";
 		if (isset($_COOKIE[0]['token'])) {
 			$user_settings[0]['explicit'] = "blur";
 		} else {

+ 0 - 0
js/scripts.js


この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません