最初コミット

このコミットが含まれているのは:
守矢諏訪子 2023-05-02 21:19:47 +09:00
コミット 67d5d60a2b
16個のファイルの変更334行の追加0行の削除

1
.gitignore vendored ノーマルファイル
ファイルの表示

@ -0,0 +1 @@
/config.php

2
README.md ノーマルファイル
ファイルの表示

@ -0,0 +1,2 @@
# vixip
pixiv向けプライバシーUI。

29
api.php ノーマルファイル
ファイルの表示

@ -0,0 +1,29 @@
<?php
require_once("config.php");
$gurl = str_replace("/?id=", "", htmlspecialchars($_SERVER["REQUEST_URI"]));
$psize = 18;
$rpsize = $psize * 2;
$mrpsize = 161;
function get (string $url = "", bool $prx = false, bool $embed = false): stdClass {
$res = [];
$ch = curl_init();
if ($prx) curl_setopt($ch, CURLOPT_URL, "https://".$url);
else curl_setopt($ch, CURLOPT_URL, ($prx ? $url : "https://".($embed ? "embed.pixiv.net" : "www.pixiv.net/ajax")."/".$url));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Cookie: PHPSESSID=".SESSION_ID,
"User-Agent: Mozilla/5.0",
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$res = mb_convert_encoding(curl_exec($ch), "UTF-8", "EUC-JP");
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if (!$res || $httpCode != 200) {
echo "エラー ".$httpCode;
die();
}
return json_decode($res);
}
?>

3
config.example.php ノーマルファイル
ファイルの表示

@ -0,0 +1,3 @@
<?php
define("SESSION_ID", "XXXXXXXX_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
?>

7
include/footer.php ノーマルファイル
ファイルの表示

@ -0,0 +1,7 @@
</div>
<p class="footer">
<a href="https://gitler.moe/suwako/vixip"><img src="/git.png" alt="Git"></a> |
<a href="https://owacon.moe/">オワコンテック</a>
</p>
</body>
</html>

24
include/header.php ノーマルファイル
ファイルの表示

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="ja">
<head>
<meta content="text/html; charset=euc-jp" http-equiv="content-type" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<?php if (isset($out["desc"])) { ?>
<meta property="og:title" content="vixip 〜 <?= htmlspecialchars($out["title"]) ?>" />
<meta property="og:type" content="article" />
<meta property="og:description" content="<?= htmlspecialchars($out["desc"]) ?>" />
<meta property="og:url" content="<?= $gurl ?>" />
<?php } ?>
<?php if (isset($out["img"])) { ?><meta name="thumbnail" content="<?= $out["img"] ?>" /><?php } ?>
<title>vixip <?= htmlspecialchars($out["title"]) ?></title>
<link rel="stylesheet" type="text/css" href="/style.css" />
</head>
<body>
<div class="header">
<form action="/search" method="get">
<a href="/" style="padding-right: 12px;">vixip</a>
<input type="text" value="" class="searchbar" name="q" placeholder="商品を検索" />
<button class="searchbtn">検索</button>
</form>
</div>
<div class="container">

バイナリ
logo.png ノーマルファイル

バイナリファイルは表示されません。

変更後

幅:  |  高さ:  |  サイズ: 1.7 KiB

6
www/404.php ノーマルファイル
ファイルの表示

@ -0,0 +1,6 @@
<?php $out = ["title" => "見つけられない"]; ?>
<?php include("../include/header.php"); ?>
<h1>見つけられなかった</h1>
<p>ごめんね!</p>
<?php include("../include/footer.php"); ?>

80
www/artworks/index.php ノーマルファイル
ファイルの表示

@ -0,0 +1,80 @@
<?php
require_once("../../api.php");
$id = (int)$_GET["id"];
$res = get("illust/".$id);
if (!isset($res->body)) {
header("Location: /404.php");
die();
}
$res = $res->body;
if ($res->commentCount > 0) {
$com = get("illusts/comments/roots?illust_id=".$id);
}
$rec = get("illust/".$id."/recommend/init?limit=".$rpsize);
$out = ["title" => $res->alt, "desc" => $res->description];
$icon = "";
foreach ($res->userIllusts as $k => $v) {
if (is_null($v)) continue;
if (isset($v->profileImageUrl)) $icon = str_replace("https://", "", $v->profileImageUrl);
}
?>
<?php include("../../include/header.php"); ?>
<div style="text-align: center;">
<a href="/proxy.php?url=<?= str_replace("https://", "", $res->urls->original) ?>">
<img src="/proxy.php?url=<?= str_replace("https://", "", $res->urls->regular) ?>" alt="<?= $res->illustTitle ?>" />
</a>
</div>
<h1><?= $res->illustTitle ?></h1>
<p>
好:<?= $res->likeCount ?> 保:<?= $res->bookmarkCount ?> 視:<?= $res->viewCount ?><br />
<img src="/proxy.php?url=<?= $icon ?>" alt="<?= $res->userName ?>" /> <a href="/users?id=<?= $res->userId ?>"><?= $res->userName ?></a>
</p>
<h2>コメント (<?= $res->commentCount ?>)</h2>
<table>
<?php
if (!$com->error) {
foreach ($com->body->comments as $c) {
?>
<tr>
<td rowspan="2" style="vertical-align: top;"><img src="/proxy.php?url=<?= str_replace("https://", "", $c->img) ?>" alt="<?= $c->userName ?>" style="width: 40px; height: 40px;" /></td>
<td style="padding-left: 12px;"><a href="/users/?id=<?= $c->userId ?>"><?= $c->userName ?></a> <?= $c->commentDate ?></td>
</tr>
<tr>
<td style="padding-left: 12px;">
<?php
if (is_null($c->stampId)) {
echo $c->comment;
}
else {
?>
<img src="/proxy.php?url=s.pximg.net/common/images/stamp/generated-stamps/<?= $c->stampId ?>_s.jpg" alt="<?= $c->stampId ?>" />
<?php
}
?>
</td>
</tr>
<?php
}
}
else {
echo $com->message;
}
?>
</table>
<h2>関連作品</h2>
<?php
if (!$rec->error) {
foreach ($rec->body->illusts as $r) {
?>
<a href="/artworks/?id=<?= $r->id ?>">
<img src="/proxy.php?url=<?= str_replace("https://", "", $r->url) ?>" alt="<?= $r->alt ?>" />
</a>
<?php
}
}
else {
echo $rec->message;
}
?>
<?php include("../../include/footer.php"); ?>

バイナリ
www/favicon.ico ノーマルファイル

バイナリファイルは表示されません。

変更後

幅:  |  高さ:  |  サイズ: 15 KiB

バイナリ
www/git.png ノーマルファイル

バイナリファイルは表示されません。

変更後

幅:  |  高さ:  |  サイズ: 8.3 KiB

17
www/index.php ノーマルファイル
ファイルの表示

@ -0,0 +1,17 @@
<?php
require_once("../api.php");
$res = (array)get("top/illust");
$out = ["title" => "トップ", "desc" => ""];
?>
<?php include("../include/header.php"); ?>
<div class="page">
<?php
foreach ($res["body"]->thumbnails->illust as $o) {
?>
<a href="/artworks?id=<?= $o->id ?>"><img src="/proxy.php?url=<?= str_replace("https://", "", $o->url) ?>" alt="<?= $o->alt ?>" /></a>
<?php
}
?>
</div>
<?php include("../include/footer.php"); ?>

16
www/proxy.php ノーマルファイル
ファイルの表示

@ -0,0 +1,16 @@
<?php
require_once("../config.php");
$url = htmlspecialchars($_GET["url"]);
$ext = explode(".", $url);
$ext = $ext[array_key_last($ext)];
if ($ext == "jpg") $ext = "jpeg";
header("Content-type: image/".$ext);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://".$url);
curl_setopt($ch, CURLOPT_REFERER, "https://www.pixiv.net/");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_exec($ch);
curl_close($ch);
?>

46
www/search/index.php ノーマルファイル
ファイルの表示

@ -0,0 +1,46 @@
<?php
require_once("../../api.php");
$q = htmlspecialchars($_GET["q"]);
if (!isset($q) || $q == "" || is_null($q)) {
header("Location: /");
die();
}
$res = get("search/artworks/".$q);
if ($res->error) die();
if (!isset($res->body)) {
header("Location: /404.php");
die();
}
$res = $res->body;
$out = ["title" => $res->alt, "desc" => $res->description];
?>
<?php include("../../include/header.php"); ?>
<?php
foreach ($res->relatedTags as $t) {
?>
<a href="/search/?q=<?= $t ?>">#<?= $t ?></a>
<?php
}
?>
<h2>結果</h2>
<?php
foreach ($res->illustManga->data as $r) {
if (is_null($r->id)) continue;
?>
<div class="searchres">
<a href="/artworks/?id=<?= $r->id ?>">
<img src="/proxy.php?url=<?= str_replace("https://", "", $r->url) ?>" alt="<?= $r->alt ?>" />
<?= $r->title ?>
</a>
<br />
<a href="/users/?id=<?= $r->userId ?>">
<img src="/proxy.php?url=<?= str_replace("https://", "", $r->profileImageUrl) ?>" alt="<?= $r->userName ?>" style="width: 24px; height: 24px;" />
<?= $r->userName ?>
</a>
</div>
<?php
}
?>
<?php include("../../include/footer.php"); ?>

82
www/style.css ノーマルファイル
ファイルの表示

@ -0,0 +1,82 @@
html {
margin: 0;
}
body {
background: #232629;
color: #fcfcfc;
letter-spacing: 0.05em;
}
a {
color: #ea5fea;
}
h2 {
clear: left;
line-height: 1.5;
margin: 15px 0 10px;
padding: 0 0 0 15px;
border-left: 6px solid #f976de;
font-weight: bold;
font-size: 166%;
}
.container {
width: calc(100% - 20px);
max-width: 1200px;
background: #31363b;
border: 2px solid #4d4d4d;
border-radius: 10px;
margin: auto;
padding: 8px;
}
.header {
width: calc(100% - 20px);
max-width: 1200px;
background: #67717b;
border: 2px solid #8f8f8f;
border-radius: 10px;
margin: auto;
padding: 8px;
margin-bottom: 24px;
}
.searchbar, .searchbtn {
color: #fcfcfc;
font-size: 20px;
width: 100%;
}
.searchbar {
background: #31363b;
border: 1px solid #ababab;
max-width: 900px;
}
.searchbtn {
background: #ee7fec;
border: 1px solid #800467;
max-width: 60px;
}
.searchres {
max-width: 260px;
width: 100%;
background: #512651;
border: 1px solid #ee7fec;
padding: 8px;
border-radius: 4px;
display: inline-block;
font-size: 12px;
}
.searchres > a > img {
margin: auto;
}
.footer {
text-align: center;
margin-top: 32px;
}

21
www/users/index.php ノーマルファイル
ファイルの表示

@ -0,0 +1,21 @@
<?php
require_once("../../api.php");
$id = (int)$_GET["id"];
$res = get("user/".$id."/profile/all");
if (!isset($res->body)) {
header("Location: /404.php");
die();
}
$top = get("user/".$id."/profile/top");
$res = $res->body;
$top = $top->body;
//print_r($top->extraData->meta);exit;
$out = ["title" => $top->extraData->meta->title, "desc" => $top->extraData->meta->description];
?>
<?php include("../../include/header.php"); ?>
<img src="<?= $top->extraData->meta->ogp->image ?>" alt="<?= $top->extraData->meta->ogp->title ?>" />
<p>
<?= nl2br($top->extraData->meta->ogp->description) ?>
</p>
<?php include("../../include/footer.php"); ?>