Convert public directory from submodule to normal directory
- Remove public from git submodule tracking - Add all public directory contents as regular files - Fixes GitHub Actions error: "No url found for submodule path 'public' in .gitmodules" 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,698 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>ai · hello world! bluesky</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="@gitbook-ng/gitbook 3.3.6">
|
||||
<meta name="author" content="syui">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-codeblock-filename/block.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="1.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="./" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
hello world! bluesky
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../card/">
|
||||
|
||||
<a href="../card/">
|
||||
|
||||
|
||||
card
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../c1/">
|
||||
|
||||
<a href="../c1/">
|
||||
|
||||
|
||||
part 1
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../c1/1.html">
|
||||
|
||||
<a href="../c1/1.html">
|
||||
|
||||
|
||||
quick start
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../c1/2.html">
|
||||
|
||||
<a href="../c1/2.html">
|
||||
|
||||
|
||||
example
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../c2/">
|
||||
|
||||
<a href="../c2/">
|
||||
|
||||
|
||||
part 2
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="../c2/1.html">
|
||||
|
||||
<a href="../c2/1.html">
|
||||
|
||||
|
||||
bluesky
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="../c2/2.html">
|
||||
|
||||
<a href="../c2/2.html">
|
||||
|
||||
|
||||
terminal
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="../c2/3.html">
|
||||
|
||||
<a href="../c2/3.html">
|
||||
|
||||
|
||||
shell
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.4" data-path="../c2/4.html">
|
||||
|
||||
<a href="../c2/4.html">
|
||||
|
||||
|
||||
rust
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" data-path="../c3/">
|
||||
|
||||
<a href="../c3/">
|
||||
|
||||
|
||||
part 3
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.5.1" data-path="../c3/1.html">
|
||||
|
||||
<a href="../c3/1.html">
|
||||
|
||||
|
||||
hello world
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.2" data-path="../c3/2.html">
|
||||
|
||||
<a href="../c3/2.html">
|
||||
|
||||
|
||||
seahorse
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.3" data-path="../c3/3.html">
|
||||
|
||||
<a href="../c3/3.html">
|
||||
|
||||
|
||||
reqwest
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
part 4
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter active" data-level="1.6.1" data-path="0.html">
|
||||
|
||||
<a href="0.html">
|
||||
|
||||
|
||||
ai
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6.2" data-path="1.html">
|
||||
|
||||
<a href="1.html">
|
||||
|
||||
|
||||
config
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6.3" data-path="2.html">
|
||||
|
||||
<a href="2.html">
|
||||
|
||||
|
||||
mention
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6.4" data-path="3.html">
|
||||
|
||||
<a href="3.html">
|
||||
|
||||
|
||||
base64
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7" data-path="../c5/">
|
||||
|
||||
<a href="../c5/">
|
||||
|
||||
|
||||
part 5
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.7.1" data-path="../c5/1.html">
|
||||
|
||||
<a href="../c5/1.html">
|
||||
|
||||
|
||||
notify
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.2" data-path="../c5/2.html">
|
||||
|
||||
<a href="../c5/2.html">
|
||||
|
||||
|
||||
timeline
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.3" data-path="../c5/3.html">
|
||||
|
||||
<a href="../c5/3.html">
|
||||
|
||||
|
||||
refresh
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.8" data-path="../end/">
|
||||
|
||||
<a href="../end/">
|
||||
|
||||
|
||||
end
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >ai</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h3 id="ai">ai</h3>
|
||||
<p>ここでは、遊び要素を交えて、オリジナリティを追求します。各自、好きなものに設定してください。</p>
|
||||
<p>まずコマンドアプリの名前ですね。今までは<code>rust</code>を使っていました。なぜなら<code>cargo init</code>で作成されたプログラム名が<code>rust</code>だからです。これは自動でフォルダ名が付けられます。</p>
|
||||
<p>これを<code>ai</code>に変更してみます。</p>
|
||||
<div><p class="code-filename">Cargo.toml</p></div>
|
||||
<pre><code class="lang-toml"><span class="hljs-section">[package]</span>
|
||||
<span class="hljs-attr">name</span> = <span class="hljs-string">"ai"</span>
|
||||
</code></pre>
|
||||
<p>なお、好きな名前を設定した場合、以降の解説ではコマンド名などを読みかえてください。</p>
|
||||
<pre><code class="lang-sh">$ cargo build
|
||||
$ ./target/debug/ai -h
|
||||
|
||||
Name:
|
||||
ai
|
||||
Flags:
|
||||
-h, --help : Show <span class="hljs-built_in">help</span>
|
||||
Commands:
|
||||
y, yes :
|
||||
n, no :
|
||||
t, <span class="hljs-built_in">test</span> :
|
||||
b, bluesky :
|
||||
</code></pre>
|
||||
<h4 id="cleanup">cleanup</h4>
|
||||
<p>次に名残惜しいですが、いらないコマンドオプションを減らしましょう。</p>
|
||||
<pre><code class="lang-src/main.rs">use seahorse::{App, Context, Command};
|
||||
use std::env;
|
||||
|
||||
fn main() {
|
||||
let args: Vec<String> = env::args().collect();
|
||||
let app = App::new(env!("CARGO_PKG_NAME"))
|
||||
.action(c_list_records)
|
||||
.command(
|
||||
Command::new("bluesky")
|
||||
.alias("b")
|
||||
.action(c_list_records),
|
||||
)
|
||||
|
||||
;
|
||||
app.run(args);
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn list_records() -> reqwest::Result<()> {
|
||||
let client = reqwest::Client::new();
|
||||
let handle= "support.bsky.team";
|
||||
let col = "app.bsky.feed.post";
|
||||
let body = client.get("https://bsky.social/xrpc/com.atproto.repo.listRecords")
|
||||
.query(&[("repo", &handle),("collection", &col),("limit", &"1"),("revert", &"true")])
|
||||
.send()
|
||||
.await?
|
||||
.text()
|
||||
.await?;
|
||||
println!("{}", body);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn c_list_records(_c: &Context) {
|
||||
list_records().unwrap();
|
||||
}
|
||||
</code></pre>
|
||||
<h4 id="ascii">ascii</h4>
|
||||
<p>いわゆる<code>ascii art</code>を入れてみます。</p>
|
||||
<p><a href="https://github.com/TheZoraiz/ascii-image-converter" target="_blank">TheZoraiz/ascii-image-converter</a>を使って生成します。</p>
|
||||
<pre><code class="lang-sh">$ ascii-image-converter ai.png -H 50
|
||||
</code></pre>
|
||||
<p><code>src/main.rs</code>の<code>.action(c_list_records)</code>を<code>.action(c_ascii_art)</code>に変更します。</p>
|
||||
<div><p class="code-filename">src/main.rs</p></div>
|
||||
<pre><code class="lang-rust"><span class="hljs-comment">//.action(c_list_records)</span>
|
||||
.action(c_ascii_art)
|
||||
</code></pre>
|
||||
<p>なお、rustでは文頭の<code>//</code>がコメントになります。</p>
|
||||
<p>コメントというのは、コードとして解釈されません。したがって、なにかメモを書くとき、これを使いましょう。</p>
|
||||
<div><p class="code-filename">src/main.rs</p></div>
|
||||
<pre><code class="lang-rust"><span class="hljs-comment">// これはアイのアスキーアートです</span>
|
||||
<span class="hljs-comment">// 内容は関数の"c_ascii_art"を見てください</span>
|
||||
.action(c_ascii_art)
|
||||
</code></pre>
|
||||
<p>そして、<code>src/main.rs</code>の最後の行に以下のコード(関数)を追加します。</p>
|
||||
<div><p class="code-filename">src/main.rs</p></div>
|
||||
<pre><code class="lang-rust"><span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">c_ascii_art</span></span>(_c: &Context) {
|
||||
<span class="hljs-keyword">let</span> body = <span class="hljs-string">"
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠉⣁⠉⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠟⠛⠋⣉⣉⠡⠤⠤⠤⠤⠤⠤⠤⠤⠬⠤⣁⣉⡉⠛⠻⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢉⣤⡖⠚⣉⣡⣤⣦⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣴⣤⣤⠉⠑⣦⣌⠙⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⣾⣿⣦⣄⣅⣌⣄⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣶⣾⣿⣿⣁⣘⡙⠻⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⢃⣤⣨⣿⡿⡿⠟⠟⠛⠻⠚⠛⠛⠛⠛⠛⠛⠋⡋⡋⠛⠛⠉⠉⠼⠿⠿⠿⠿⠿⠷⢶⢤⣈⠙⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⢋⡡⠞⠛⣉⣉⣤⣤⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣶⣶⣶⣶⣶⣶⣦⣦⣦⣦⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⢁⣀⣤⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠟⠛⠋⡉⣉⣉⣁⣨⣀⣅⣉⣉⢉⠛⠛⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠋⣁⡤⣴⣲⢯⢯⡯⣗⡯⣞⡾⣺⣺⢵⢯⢯⣟⢶⢦⣤⣀⡉⠛⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠉⣠⣔⡯⣗⡯⣗⡯⡯⣟⣞⣗⡯⣗⡯⣗⡯⡯⣟⣽⣺⢽⢽⣺⣳⢯⣟⡦⣌⡙⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁⣠⣻⣺⣺⢽⣳⢯⣗⡯⡯⣗⡯⡾⣝⣗⡯⣗⡯⡯⣗⣗⡯⣟⣽⣺⣺⢽⣺⢽⣳⣻⢦⣈⠛⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⢠⣺⣳⢽⣺⣺⢽⣺⢽⣺⢽⣫⣗⡯⡯⣗⣗⡯⣗⡯⡯⣗⣗⡯⣗⣗⡯⡾⣽⣺⢽⡽⣾⣽⣺⢵⡀⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠁⣔⣟⣞⡾⣽⣺⣺⢽⣺⢽⣺⢽⣺⣺⢽⣫⣗⣗⡯⣗⡯⡯⣗⣗⡯⣗⣗⡯⡯⣗⡯⣟⣞⣗⡿⣾⣽⢽⢦⠈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⡮⣗⡯⡾⣝⡷⣽⣺⢽⣺⢽⣺⢽⣺⣺⢽⣺⣺⢵⢯⣗⡯⡯⣗⣗⡯⣗⣗⡯⡯⣗⡯⣗⣟⡾⣽⣻⣿⣯⣟⢷⡀⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢀⡾⣝⣗⡯⡯⣗⡯⣗⡯⣟⡾⣽⣺⢽⣺⣺⢽⣺⣺⢽⢽⣺⢽⣫⣗⣗⡯⣗⣗⡯⡯⣗⡯⣗⡷⣻⣗⡷⣿⣟⣿⣽⣳⠈⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠁⣼⢽⣳⢗⡯⡯⣗⡯⣗⡯⣗⡯⣗⡯⠛⣞⡾⣽⣺⣺⢽⢽⣺⢽⣺⣺⢵⢯⣗⣗⡏⠙⣗⡯⣗⣯⢯⣷⢿⣽⣿⣿⡾⡽⣇⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⢸⣳⢽⣺⢽⢽⣫⣗⡯⣗⡯⣗⣯⡓⢡⡂⢵⢯⣗⡯⡾⣽⢽⣺⢽⣺⣺⢽⢽⣺⡞⢀⢇⠸⣽⣳⢽⣯⢿⣿⣿⣽⣷⣿⢯⢿⠀⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⣞⡾⣽⣺⢽⢽⣺⣺⢽⣳⢯⣗⠇⢠⣿⠆⢸⢽⣺⢽⢽⣳⣻⣺⢽⣺⣺⢽⢽⡺⠁⡬⣿⡀⢳⡽⡽⣾⡯⢿⣯⣿⣽⣿⣻⢽⡃⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⠠⣗⡯⣗⡯⣟⣽⣺⣺⢽⣺⢽⡺⢀⣿⣿⢅⠈⣟⡾⣽⢽⣺⢵⢯⣻⣺⣺⢽⢽⠃⡰⣽⣿⡇⢸⡽⡽⣿⢝⣽⣿⣿⣺⣿⡯⣯⡇⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣳⢯⣗⡯⣗⣗⡯⡾⣽⣺⢽⠂⣸⣿⣾⡕⡀⢗⡯⣗⣟⡾⡽⣽⣺⣳⢽⢽⠃⢰⣱⣿⣷⡇⢸⡯⣟⠟⠀⣿⡿⣞⣾⣻⣽⡳⡇⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣺⢽⣺⢽⣳⢗⡯⡯⣗⡯⡏⢀⣿⢿⣾⣗⠆⠸⣽⡳⣗⡯⡯⣗⣗⡯⣯⠏⢠⢣⣿⣿⣾⡇⢸⢯⠏⣰⠀⣿⣻⣳⣳⣿⣺⢽⠅⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠸⣺⢽⣺⢽⣺⢽⢽⣫⢷⠉⡇⠰⣿⣿⣻⣽⣎⠀⢗⡯⡗⢙⣽⡳⣗⡯⡏⢀⣗⣿⣿⣷⣿⠂⣺⠋⣠⣿⠀⣿⣺⢵⣫⣿⣺⢽⠀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠈⣗⣟⡾⣽⣺⢽⢽⣺⠍⠀⡇⠘⣉⣤⣬⣈⣑⣅⠘⣽⠂⠘⣮⢯⣗⠏⢠⡟⣉⣡⠤⢤⠄⢠⠃⢴⡟⣯⠀⣗⡯⠟⡾⣗⡯⡇⢰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡀⢸⣳⢯⣗⡯⣟⣽⡺⢀⠃⠀⠸⠋⢡⢡⡉⠻⣷⡄⠸⢀⡆⢹⣳⠃⣴⣿⣿⠋⣠⠐⡔⠀⠂⢳⡄⢰⣟⠀⠉⣠⣦⠘⣷⡻⠀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢡⡀⢯⣗⣗⡯⣗⣷⡃⠀⣼⠀⠀⠓⠀⠓⢽⠄⢹⣿⡄⢐⣧⠘⢁⣾⣿⣯⡯⢐⢌⠀⠁⣜⠆⢸⣿⡀⢟⠀⢨⣄⠙⡇⢹⠃⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣌⠣⡈⢾⢵⢯⣗⢷⡃⢰⣿⡧⠈⣟⡀⠀⡸⡅⢸⡿⣿⣦⣹⣶⣻⣿⣷⣿⣇⠨⣫⢀⢀⢎⠃⣼⡿⣇⡾⠀⡢⠘⣨⠇⠈⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡐⠈⢫⣟⢾⢽⡂⢹⣿⣿⡄⠱⢕⢵⠝⢀⣾⣿⣿⣻⣿⣻⣿⣻⣾⣟⣿⣆⠑⡕⠗⣁⣴⣿⡿⣿⠃⠄⣾⣵⡟⠀⢰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠫⣟⡽⡃⢸⣿⣾⣿⡷⣾⣴⣻⡿⣯⣷⣿⣿⣻⣿⣽⣿⣟⣿⣻⣿⣟⣷⡿⣿⣽⣾⣿⡏⢠⠴⠟⠁⠄⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡈⢯⢧⠈⢿⣿⣾⣿⣿⣾⣿⢿⣿⣟⣿⣾⣿⣼⣿⣾⢿⣻⣿⣽⣿⣻⣿⣿⣻⣯⡿⠀⡄⡔⡔⠅⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠙⢆⠈⠻⣾⣿⣾⢿⣾⣿⣿⣽⠻⢷⣿⣻⣾⠿⠟⢿⣻⣽⣾⣿⢿⣾⡿⠋⡁⡜⠌⠈⣠⠪⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⡂⠀⣤⡈⠻⣾⣿⢿⣷⡿⣯⣷⣤⣤⣤⣤⣶⣾⣿⣿⢿⣻⠽⠛⢉⢠⠸⠈⡠⣰⠀⣿⡀⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⠀⢨⣗⡯⣖⡄⢈⠉⠓⠻⠿⢿⣟⣿⣻⣿⠽⠟⠞⠋⢉⢠⠀⡰⠑⢁⢰⠀⡯⣪⠀⣳⣇⠸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡗⠨⠀⣻⢮⡯⢺⠀⢜⠈⡊⢐⢶⢔⡤⡤⣤⢤⢖⣖⢷⠅⢸⠀⠐⢁⡴⡇⡘⢠⡫⡎⡇⢸⣺⡄⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⡯⣗⠇⡪⠀⡃⠠⡃⠨⣿⣷⣯⣿⣾⣽⣷⣯⣿⠂⠀⡠⠀⣻⣺⡇⠀⢸⡂⢝⢦⠐⣗⣧⠈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠁⣜⠀⡯⡿⠀⠆⢐⠁⢜⠌⢨⣿⣾⣿⣽⣯⣿⣷⣿⢿⡁⢌⠐⠀⣳⣳⡃⠀⡪⡇⢸⢕⠄⢳⢽⡆⠸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠁⡰⢱⠀⡯⡏⠨⠂⢀⡈⢈⡄⢸⣷⣿⣷⢿⣯⣷⣿⣾⣿⣆⠙⠅⠀⣞⣾⠀⢀⢯⡢⠘⣎⢇⠘⡽⣽⡀⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠀⠀⣰⡹⠀⢯⠇⢘⠀⠍⣴⣿⣤⣿⡿⣷⣿⢿⣻⣽⣷⣿⡿⣿⣷⡂⢀⣗⣿⠀⠰⠣⢯⡀⢗⡝⡄⠹⣳⢧⠈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⢁⠔⢁⠞⣈⣴⠀⣫⠃⡐⢀⢞⣿⡿⣾⣟⣿⣿⣽⣿⡿⣟⣿⣾⡿⣿⣽⡂⢐⣗⡗⢀⣶⣦⣦⣤⣄⣉⠘⠀⠹⡽⣆⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⡠⠃⡔⢁⣼⣿⡿⠀⢸⠀⡂⢸⢸⣿⡿⣟⣿⢿⣞⡿⣾⣿⢿⣟⣷⢿⣿⣷⠁⢰⢯⡇⢰⣿⣯⣿⣟⣿⡿⣿⣷⣤⣈⠛⢆⠘⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢠⠊⡠⢊⣰⣿⣿⠟⣰⠀⢸⠀⠀⡎⣾⠿⠟⠛⣉⢉⠚⢮⢿⣾⢿⣝⠮⢋⣠⣈⠂⣸⢽⠀⢼⣟⣯⣷⣿⣟⣿⣿⣽⣿⣿⡷⡌⢣⡈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠁⡔⢁⡔⢡⣾⣿⣿⣧⡐⢿⠀⣞⠀⠀⣏⢦⡶⣞⣿⣽⣳⣳⣽⣿⢿⣻⣾⣴⣳⣷⣿⠀⣺⡝⠀⣽⣿⢿⣻⣽⣿⣽⣾⡿⣯⣿⣿⣿⡀⢳⡀⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⢀⠎⢠⠎⣠⣿⣿⣿⣿⣿⣿⣦⠀⡯⠀⠐⠧⠻⠛⠛⢋⢋⠋⠙⠛⠿⣿⢿⣷⡿⣿⣽⡿⠀⣷⠃⠀⣿⡿⣿⡿⣿⣽⣯⣷⣿⣿⡿⣿⣻⡇⢀⠹⣆⠘⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
"</span>;
|
||||
<span class="hljs-built_in">println!</span>(<span class="hljs-string">"{}"</span>, body);
|
||||
}
|
||||
</code></pre>
|
||||
<p>できました。これで<code>ai</code>を実行すると、<a href="https://bsky.app/profile/did:plc:4hqjfn7m6n5hno3doamuhgef" target="_blank">ai</a>が表示されます。</p>
|
||||
<pre><code class="lang-sh">$ cargo build
|
||||
$ ./target/debug/ai
|
||||
</code></pre>
|
||||
<p><img src="../img/ascii.png" alt></p>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="./" class="navigation navigation-prev " aria-label="Previous page: part 4">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="1.html" class="navigation navigation-next " aria-label="Next page: config">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"ai","level":"1.6.1","depth":2,"next":{"title":"config","level":"1.6.2","depth":2,"path":"c4/1.md","ref":"c4/1.md","articles":[]},"previous":{"title":"part 4","level":"1.6","depth":1,"path":"c4/README.md","ref":"c4/README.md","articles":[{"title":"ai","level":"1.6.1","depth":2,"path":"c4/0.md","ref":"c4/0.md","articles":[]},{"title":"config","level":"1.6.2","depth":2,"path":"c4/1.md","ref":"c4/1.md","articles":[]},{"title":"mention","level":"1.6.3","depth":2,"path":"c4/2.md","ref":"c4/2.md","articles":[]},{"title":"base64","level":"1.6.4","depth":2,"path":"c4/3.md","ref":"c4/3.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["-sharing","codeblock-filename","mermaid-gb3","diff"],"root":"./","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"codeblock-filename":{},"mermaid-gb3":{},"diff":{"type":"markdown","method":"diffChars","options":{}},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"syui","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"hello world! bluesky","gitbook":"*","description":"This is a bluesky ai-card example, and first rust"},"file":{"path":"c4/0.md","mtime":"2023-07-25T11:05:46.444Z","type":"markdown"},"gitbook":{"version":"3.3.6","time":"2023-09-16T08:55:27.618Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-mermaid-gb3/book/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.min.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -0,0 +1,727 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>config · hello world! bluesky</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="@gitbook-ng/gitbook 3.3.6">
|
||||
<meta name="author" content="syui">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-codeblock-filename/block.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="2.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="0.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
hello world! bluesky
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../card/">
|
||||
|
||||
<a href="../card/">
|
||||
|
||||
|
||||
card
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../c1/">
|
||||
|
||||
<a href="../c1/">
|
||||
|
||||
|
||||
part 1
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../c1/1.html">
|
||||
|
||||
<a href="../c1/1.html">
|
||||
|
||||
|
||||
quick start
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../c1/2.html">
|
||||
|
||||
<a href="../c1/2.html">
|
||||
|
||||
|
||||
example
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../c2/">
|
||||
|
||||
<a href="../c2/">
|
||||
|
||||
|
||||
part 2
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="../c2/1.html">
|
||||
|
||||
<a href="../c2/1.html">
|
||||
|
||||
|
||||
bluesky
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="../c2/2.html">
|
||||
|
||||
<a href="../c2/2.html">
|
||||
|
||||
|
||||
terminal
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="../c2/3.html">
|
||||
|
||||
<a href="../c2/3.html">
|
||||
|
||||
|
||||
shell
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.4" data-path="../c2/4.html">
|
||||
|
||||
<a href="../c2/4.html">
|
||||
|
||||
|
||||
rust
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" data-path="../c3/">
|
||||
|
||||
<a href="../c3/">
|
||||
|
||||
|
||||
part 3
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.5.1" data-path="../c3/1.html">
|
||||
|
||||
<a href="../c3/1.html">
|
||||
|
||||
|
||||
hello world
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.2" data-path="../c3/2.html">
|
||||
|
||||
<a href="../c3/2.html">
|
||||
|
||||
|
||||
seahorse
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.3" data-path="../c3/3.html">
|
||||
|
||||
<a href="../c3/3.html">
|
||||
|
||||
|
||||
reqwest
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
part 4
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.6.1" data-path="0.html">
|
||||
|
||||
<a href="0.html">
|
||||
|
||||
|
||||
ai
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.6.2" data-path="1.html">
|
||||
|
||||
<a href="1.html">
|
||||
|
||||
|
||||
config
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6.3" data-path="2.html">
|
||||
|
||||
<a href="2.html">
|
||||
|
||||
|
||||
mention
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6.4" data-path="3.html">
|
||||
|
||||
<a href="3.html">
|
||||
|
||||
|
||||
base64
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7" data-path="../c5/">
|
||||
|
||||
<a href="../c5/">
|
||||
|
||||
|
||||
part 5
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.7.1" data-path="../c5/1.html">
|
||||
|
||||
<a href="../c5/1.html">
|
||||
|
||||
|
||||
notify
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.2" data-path="../c5/2.html">
|
||||
|
||||
<a href="../c5/2.html">
|
||||
|
||||
|
||||
timeline
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.3" data-path="../c5/3.html">
|
||||
|
||||
<a href="../c5/3.html">
|
||||
|
||||
|
||||
refresh
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.8" data-path="../end/">
|
||||
|
||||
<a href="../end/">
|
||||
|
||||
|
||||
end
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >config</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h3 id="config">config</h3>
|
||||
<p>blueskyの認証系のコードを追加します。</p>
|
||||
<p>具体的には<code>~/.config/ai/config.toml</code>に情報を書いておくと、<code>~/.config/ai/token.toml</code>に認証情報を置くコマンドオプションを作成します。</p>
|
||||
<div><p class="code-filename">~/.config/ai/config.toml</p></div>
|
||||
<pre><code class="lang-toml"><span class="hljs-attr">handle</span> = <span class="hljs-string">"yui.syui.ai"</span>
|
||||
<span class="hljs-attr">pass</span> = <span class="hljs-string">"xxx"</span>
|
||||
<span class="hljs-attr">host</span> = <span class="hljs-string">"bsky.social"</span>
|
||||
</code></pre>
|
||||
<div><p class="code-filename">Cargo.toml</p></div>
|
||||
<pre><code class="lang-toml"><span class="hljs-section">[package]</span>
|
||||
<span class="hljs-attr">name</span> = <span class="hljs-string">"ai"</span>
|
||||
<span class="hljs-attr">version</span> = <span class="hljs-string">"0.1.0"</span>
|
||||
<span class="hljs-attr">edition</span> = <span class="hljs-string">"2021"</span>
|
||||
<span class="hljs-section">
|
||||
[dependencies]</span>
|
||||
<span class="hljs-attr">seahorse</span> = <span class="hljs-string">"*"</span>
|
||||
<span class="hljs-attr">reqwest</span> = { version = <span class="hljs-string">"*"</span>, features = [<span class="hljs-string">"blocking"</span>, <span class="hljs-string">"json"</span>] }
|
||||
<span class="hljs-attr">tokio</span> = { version = <span class="hljs-string">"1"</span>, features = [<span class="hljs-string">"full"</span>] }
|
||||
<span class="hljs-attr">serde_derive</span> = <span class="hljs-string">"1.0"</span>
|
||||
<span class="hljs-attr">serde_json</span> = <span class="hljs-string">"1.0"</span>
|
||||
<span class="hljs-attr">serde</span> = <span class="hljs-string">"*"</span>
|
||||
<span class="hljs-attr">config</span> = { git = <span class="hljs-string">"https://github.com/mehcode/config-rs"</span>, branch = <span class="hljs-string">"master"</span> }
|
||||
<span class="hljs-attr">shellexpand</span> = <span class="hljs-string">"*"</span>
|
||||
<span class="hljs-attr">toml</span> = <span class="hljs-string">"*"</span>
|
||||
</code></pre>
|
||||
<div><p class="code-filename">src/data.rs</p></div>
|
||||
<pre><code class="lang-rust"><span class="hljs-keyword">use</span> config::{Config, ConfigError, File};
|
||||
<span class="hljs-keyword">use</span> serde_derive::{Deserialize, Serialize};
|
||||
|
||||
<span class="hljs-meta">#[derive(Debug, Deserialize)]</span>
|
||||
<span class="hljs-meta">#[allow(unused)]</span>
|
||||
<span class="hljs-keyword">pub</span> <span class="hljs-class"><span class="hljs-keyword">struct</span> <span class="hljs-title">Data</span></span> {
|
||||
<span class="hljs-keyword">pub</span> host: <span class="hljs-built_in">String</span>,
|
||||
<span class="hljs-keyword">pub</span> pass: <span class="hljs-built_in">String</span>,
|
||||
<span class="hljs-keyword">pub</span> handle: <span class="hljs-built_in">String</span>,
|
||||
}
|
||||
|
||||
<span class="hljs-meta">#[derive(Serialize, Deserialize)]</span>
|
||||
<span class="hljs-meta">#[allow(non_snake_case)]</span>
|
||||
<span class="hljs-keyword">pub</span> <span class="hljs-class"><span class="hljs-keyword">struct</span> <span class="hljs-title">Token</span></span> {
|
||||
<span class="hljs-keyword">pub</span> did: <span class="hljs-built_in">String</span>,
|
||||
<span class="hljs-keyword">pub</span> accessJwt: <span class="hljs-built_in">String</span>,
|
||||
<span class="hljs-keyword">pub</span> refreshJwt: <span class="hljs-built_in">String</span>,
|
||||
<span class="hljs-keyword">pub</span> handle: <span class="hljs-built_in">String</span>,
|
||||
}
|
||||
|
||||
<span class="hljs-meta">#[derive(Serialize, Deserialize)]</span>
|
||||
<span class="hljs-meta">#[allow(non_snake_case)]</span>
|
||||
<span class="hljs-keyword">pub</span> <span class="hljs-class"><span class="hljs-keyword">struct</span> <span class="hljs-title">Tokens</span></span> {
|
||||
<span class="hljs-keyword">pub</span> did: <span class="hljs-built_in">String</span>,
|
||||
<span class="hljs-keyword">pub</span> access: <span class="hljs-built_in">String</span>,
|
||||
<span class="hljs-keyword">pub</span> refresh: <span class="hljs-built_in">String</span>,
|
||||
<span class="hljs-keyword">pub</span> handle: <span class="hljs-built_in">String</span>,
|
||||
}
|
||||
|
||||
<span class="hljs-keyword">impl</span> Data {
|
||||
<span class="hljs-keyword">pub</span> <span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">new</span></span>() -> <span class="hljs-built_in">Result</span><<span class="hljs-keyword">Self</span>, ConfigError> {
|
||||
<span class="hljs-keyword">let</span> d = shellexpand::tilde(<span class="hljs-string">"~"</span>) + <span class="hljs-string">"/.config/ai/config.toml"</span>;
|
||||
<span class="hljs-keyword">let</span> s = Config::builder()
|
||||
.add_source(File::with_name(&d))
|
||||
.add_source(config::Environment::with_prefix(<span class="hljs-string">"APP"</span>))
|
||||
.build()?;
|
||||
s.try_deserialize()
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
<div><p class="code-filename">src/main.rs</p></div>
|
||||
<pre><code class="lang-rust"><span class="hljs-keyword">pub</span> <span class="hljs-keyword">mod</span> data;
|
||||
<span class="hljs-keyword">use</span> seahorse::{App, Context, Command};
|
||||
<span class="hljs-keyword">use</span> std::env;
|
||||
<span class="hljs-keyword">use</span> std::fs;
|
||||
<span class="hljs-keyword">use</span> std::io::Write;
|
||||
<span class="hljs-keyword">use</span> std::collections::HashMap;
|
||||
|
||||
<span class="hljs-keyword">use</span> data::Data <span class="hljs-keyword">as</span> Datas;
|
||||
<span class="hljs-keyword">use</span> crate::data::Token;
|
||||
<span class="hljs-keyword">use</span> crate::data::Tokens;
|
||||
|
||||
<span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">main</span></span>() {
|
||||
<span class="hljs-keyword">let</span> args: <span class="hljs-built_in">Vec</span><<span class="hljs-built_in">String</span>> = env::args().collect();
|
||||
<span class="hljs-keyword">let</span> app = App::new(<span class="hljs-built_in">env!</span>(<span class="hljs-string">"CARGO_PKG_NAME"</span>))
|
||||
<span class="hljs-comment">//.action(c_ascii_art)</span>
|
||||
.command(
|
||||
Command::new(<span class="hljs-string">"bluesky"</span>)
|
||||
.alias(<span class="hljs-string">"b"</span>)
|
||||
.action(c_list_records),
|
||||
)
|
||||
.command(
|
||||
Command::new(<span class="hljs-string">"login"</span>)
|
||||
.alias(<span class="hljs-string">"l"</span>)
|
||||
.action(c_access_token),
|
||||
)
|
||||
|
||||
;
|
||||
app.run(args);
|
||||
}
|
||||
|
||||
<span class="hljs-meta">#[tokio::main]</span>
|
||||
async <span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">list_records</span></span>() -> reqwest::<span class="hljs-built_in">Result</span><()> {
|
||||
<span class="hljs-keyword">let</span> client = reqwest::Client::new();
|
||||
<span class="hljs-keyword">let</span> handle= <span class="hljs-string">"support.bsky.team"</span>;
|
||||
<span class="hljs-keyword">let</span> col = <span class="hljs-string">"app.bsky.feed.post"</span>;
|
||||
<span class="hljs-keyword">let</span> body = client.get(<span class="hljs-string">"https://bsky.social/xrpc/com.atproto.repo.listRecords"</span>)
|
||||
.query(&[(<span class="hljs-string">"repo"</span>, &handle),(<span class="hljs-string">"collection"</span>, &col),(<span class="hljs-string">"limit"</span>, &<span class="hljs-string">"1"</span>),(<span class="hljs-string">"revert"</span>, &<span class="hljs-string">"true"</span>)])
|
||||
.send()
|
||||
.await?
|
||||
.text()
|
||||
.await?;
|
||||
<span class="hljs-built_in">println!</span>(<span class="hljs-string">"{}"</span>, body);
|
||||
<span class="hljs-literal">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">c_list_records</span></span>(_c: &Context) {
|
||||
list_records().unwrap();
|
||||
}
|
||||
|
||||
<span class="hljs-meta">#[tokio::main]</span>
|
||||
async <span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">access_token</span></span>() -> reqwest::<span class="hljs-built_in">Result</span><()> {
|
||||
<span class="hljs-keyword">let</span> file = <span class="hljs-string">"/.config/ai/token.toml"</span>;
|
||||
<span class="hljs-keyword">let</span> <span class="hljs-keyword">mut</span> f = shellexpand::tilde(<span class="hljs-string">"~"</span>).to_string();
|
||||
f.push_str(&file);
|
||||
|
||||
<span class="hljs-keyword">let</span> data = Datas::new().unwrap();
|
||||
<span class="hljs-keyword">let</span> data = Datas {
|
||||
host: data.host,
|
||||
handle: data.handle,
|
||||
pass: data.pass,
|
||||
};
|
||||
<span class="hljs-keyword">let</span> url = <span class="hljs-string">"https://"</span>.to_owned() + &data.host + &<span class="hljs-string">"/xrpc/com.atproto.server.createSession"</span>;
|
||||
|
||||
<span class="hljs-keyword">let</span> <span class="hljs-keyword">mut</span> map = HashMap::new();
|
||||
map.insert(<span class="hljs-string">"identifier"</span>, &data.handle);
|
||||
map.insert(<span class="hljs-string">"password"</span>, &data.pass);
|
||||
|
||||
<span class="hljs-keyword">let</span> client = reqwest::Client::new();
|
||||
<span class="hljs-keyword">let</span> res = client
|
||||
.post(url)
|
||||
.json(&map)
|
||||
.send()
|
||||
.await?
|
||||
.text()
|
||||
.await?;
|
||||
|
||||
<span class="hljs-keyword">let</span> json: Token = serde_json::from_str(&res).unwrap();
|
||||
<span class="hljs-keyword">let</span> tokens = Tokens {
|
||||
did: json.did.to_string(),
|
||||
access: json.accessJwt.to_string(),
|
||||
refresh: json.refreshJwt.to_string(),
|
||||
handle: json.handle.to_string(),
|
||||
};
|
||||
|
||||
<span class="hljs-keyword">let</span> toml = toml::to_string(&tokens).unwrap();
|
||||
<span class="hljs-keyword">let</span> <span class="hljs-keyword">mut</span> f = fs::File::create(f.clone()).unwrap();
|
||||
f.write_all(&toml.as_bytes()).unwrap();
|
||||
|
||||
<span class="hljs-literal">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">c_access_token</span></span>(_c: &Context) {
|
||||
access_token().unwrap();
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="0.html" class="navigation navigation-prev " aria-label="Previous page: ai">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="2.html" class="navigation navigation-next " aria-label="Next page: mention">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"config","level":"1.6.2","depth":2,"next":{"title":"mention","level":"1.6.3","depth":2,"path":"c4/2.md","ref":"c4/2.md","articles":[]},"previous":{"title":"ai","level":"1.6.1","depth":2,"path":"c4/0.md","ref":"c4/0.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-sharing","codeblock-filename","mermaid-gb3","diff"],"root":"./","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"codeblock-filename":{},"mermaid-gb3":{},"diff":{"type":"markdown","method":"diffChars","options":{}},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"syui","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"hello world! bluesky","gitbook":"*","description":"This is a bluesky ai-card example, and first rust"},"file":{"path":"c4/1.md","mtime":"2023-07-22T09:43:24.685Z","type":"markdown"},"gitbook":{"version":"3.3.6","time":"2023-09-16T08:55:27.618Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-mermaid-gb3/book/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.min.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -0,0 +1,928 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>mention · hello world! bluesky</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="@gitbook-ng/gitbook 3.3.6">
|
||||
<meta name="author" content="syui">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-codeblock-filename/block.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="3.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="1.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
hello world! bluesky
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../card/">
|
||||
|
||||
<a href="../card/">
|
||||
|
||||
|
||||
card
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../c1/">
|
||||
|
||||
<a href="../c1/">
|
||||
|
||||
|
||||
part 1
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../c1/1.html">
|
||||
|
||||
<a href="../c1/1.html">
|
||||
|
||||
|
||||
quick start
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../c1/2.html">
|
||||
|
||||
<a href="../c1/2.html">
|
||||
|
||||
|
||||
example
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../c2/">
|
||||
|
||||
<a href="../c2/">
|
||||
|
||||
|
||||
part 2
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="../c2/1.html">
|
||||
|
||||
<a href="../c2/1.html">
|
||||
|
||||
|
||||
bluesky
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="../c2/2.html">
|
||||
|
||||
<a href="../c2/2.html">
|
||||
|
||||
|
||||
terminal
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="../c2/3.html">
|
||||
|
||||
<a href="../c2/3.html">
|
||||
|
||||
|
||||
shell
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.4" data-path="../c2/4.html">
|
||||
|
||||
<a href="../c2/4.html">
|
||||
|
||||
|
||||
rust
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" data-path="../c3/">
|
||||
|
||||
<a href="../c3/">
|
||||
|
||||
|
||||
part 3
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.5.1" data-path="../c3/1.html">
|
||||
|
||||
<a href="../c3/1.html">
|
||||
|
||||
|
||||
hello world
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.2" data-path="../c3/2.html">
|
||||
|
||||
<a href="../c3/2.html">
|
||||
|
||||
|
||||
seahorse
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.3" data-path="../c3/3.html">
|
||||
|
||||
<a href="../c3/3.html">
|
||||
|
||||
|
||||
reqwest
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
part 4
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.6.1" data-path="0.html">
|
||||
|
||||
<a href="0.html">
|
||||
|
||||
|
||||
ai
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6.2" data-path="1.html">
|
||||
|
||||
<a href="1.html">
|
||||
|
||||
|
||||
config
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.6.3" data-path="2.html">
|
||||
|
||||
<a href="2.html">
|
||||
|
||||
|
||||
mention
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6.4" data-path="3.html">
|
||||
|
||||
<a href="3.html">
|
||||
|
||||
|
||||
base64
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7" data-path="../c5/">
|
||||
|
||||
<a href="../c5/">
|
||||
|
||||
|
||||
part 5
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.7.1" data-path="../c5/1.html">
|
||||
|
||||
<a href="../c5/1.html">
|
||||
|
||||
|
||||
notify
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.2" data-path="../c5/2.html">
|
||||
|
||||
<a href="../c5/2.html">
|
||||
|
||||
|
||||
timeline
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.3" data-path="../c5/3.html">
|
||||
|
||||
<a href="../c5/3.html">
|
||||
|
||||
|
||||
refresh
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.8" data-path="../end/">
|
||||
|
||||
<a href="../end/">
|
||||
|
||||
|
||||
end
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >mention</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h3 id="mention">mention</h3>
|
||||
<p>いよいよ、blueskyに<code>post</code>するコマンドを作成します。正確には<code>mention</code>です。</p>
|
||||
<p>今度は、新しいファイルを作成し、そのファイルを<code>src/main.rs</code>で読み込む方式で書いてみます。</p>
|
||||
<div><p class="code-filename">Cargo.toml</p></div>
|
||||
<pre><code class="lang-toml"><span class="hljs-section">[package]</span>
|
||||
<span class="hljs-attr">name</span> = <span class="hljs-string">"ai"</span>
|
||||
<span class="hljs-attr">version</span> = <span class="hljs-string">"0.1.0"</span>
|
||||
<span class="hljs-attr">edition</span> = <span class="hljs-string">"2021"</span>
|
||||
<span class="hljs-section">
|
||||
[dependencies]</span>
|
||||
<span class="hljs-attr">seahorse</span> = <span class="hljs-string">"*"</span>
|
||||
<span class="hljs-attr">reqwest</span> = { version = <span class="hljs-string">"*"</span>, features = [<span class="hljs-string">"blocking"</span>, <span class="hljs-string">"json"</span>] }
|
||||
<span class="hljs-attr">tokio</span> = { version = <span class="hljs-string">"1"</span>, features = [<span class="hljs-string">"full"</span>] }
|
||||
<span class="hljs-attr">serde_derive</span> = <span class="hljs-string">"1.0"</span>
|
||||
<span class="hljs-attr">serde_json</span> = <span class="hljs-string">"1.0"</span>
|
||||
<span class="hljs-attr">serde</span> = <span class="hljs-string">"*"</span>
|
||||
<span class="hljs-attr">config</span> = { git = <span class="hljs-string">"https://github.com/mehcode/config-rs"</span>, branch = <span class="hljs-string">"master"</span> }
|
||||
<span class="hljs-attr">shellexpand</span> = <span class="hljs-string">"*"</span>
|
||||
<span class="hljs-attr">toml</span> = <span class="hljs-string">"*"</span>
|
||||
<span class="hljs-attr">iso8601-timestamp</span> = <span class="hljs-string">"0.2.10"</span>
|
||||
</code></pre>
|
||||
<div><p class="code-filename">src/data.rs</p></div>
|
||||
<pre><code class="lang-rust"><span class="hljs-keyword">use</span> config::{Config, ConfigError, File};
|
||||
<span class="hljs-keyword">use</span> serde_derive::{Deserialize, Serialize};
|
||||
|
||||
<span class="hljs-meta">#[derive(Debug, Deserialize)]</span>
|
||||
<span class="hljs-meta">#[allow(unused)]</span>
|
||||
<span class="hljs-keyword">pub</span> <span class="hljs-class"><span class="hljs-keyword">struct</span> <span class="hljs-title">Data</span></span> {
|
||||
<span class="hljs-keyword">pub</span> host: <span class="hljs-built_in">String</span>,
|
||||
<span class="hljs-keyword">pub</span> pass: <span class="hljs-built_in">String</span>,
|
||||
<span class="hljs-keyword">pub</span> handle: <span class="hljs-built_in">String</span>,
|
||||
}
|
||||
|
||||
<span class="hljs-meta">#[derive(Serialize, Deserialize)]</span>
|
||||
<span class="hljs-meta">#[allow(non_snake_case)]</span>
|
||||
<span class="hljs-keyword">pub</span> <span class="hljs-class"><span class="hljs-keyword">struct</span> <span class="hljs-title">Token</span></span> {
|
||||
<span class="hljs-keyword">pub</span> did: <span class="hljs-built_in">String</span>,
|
||||
<span class="hljs-keyword">pub</span> accessJwt: <span class="hljs-built_in">String</span>,
|
||||
<span class="hljs-keyword">pub</span> refreshJwt: <span class="hljs-built_in">String</span>,
|
||||
<span class="hljs-keyword">pub</span> handle: <span class="hljs-built_in">String</span>,
|
||||
}
|
||||
|
||||
<span class="hljs-meta">#[derive(Serialize, Deserialize)]</span>
|
||||
<span class="hljs-meta">#[allow(non_snake_case)]</span>
|
||||
<span class="hljs-keyword">pub</span> <span class="hljs-class"><span class="hljs-keyword">struct</span> <span class="hljs-title">Tokens</span></span> {
|
||||
<span class="hljs-keyword">pub</span> did: <span class="hljs-built_in">String</span>,
|
||||
<span class="hljs-keyword">pub</span> access: <span class="hljs-built_in">String</span>,
|
||||
<span class="hljs-keyword">pub</span> refresh: <span class="hljs-built_in">String</span>,
|
||||
<span class="hljs-keyword">pub</span> handle: <span class="hljs-built_in">String</span>,
|
||||
}
|
||||
|
||||
<span class="hljs-meta">#[derive(Serialize, Deserialize)]</span>
|
||||
<span class="hljs-meta">#[allow(non_snake_case)]</span>
|
||||
<span class="hljs-keyword">pub</span> <span class="hljs-class"><span class="hljs-keyword">struct</span> <span class="hljs-title">Labels</span></span> {
|
||||
}
|
||||
|
||||
<span class="hljs-meta">#[derive(Serialize, Deserialize)]</span>
|
||||
<span class="hljs-meta">#[allow(non_snake_case)]</span>
|
||||
<span class="hljs-keyword">pub</span> <span class="hljs-class"><span class="hljs-keyword">struct</span> <span class="hljs-title">Declaration</span></span> {
|
||||
<span class="hljs-keyword">pub</span> actorType: <span class="hljs-built_in">String</span>,
|
||||
<span class="hljs-keyword">pub</span> cid: <span class="hljs-built_in">String</span>,
|
||||
}
|
||||
|
||||
<span class="hljs-meta">#[derive(Serialize, Deserialize)]</span>
|
||||
<span class="hljs-meta">#[allow(non_snake_case)]</span>
|
||||
<span class="hljs-keyword">pub</span> <span class="hljs-class"><span class="hljs-keyword">struct</span> <span class="hljs-title">Viewer</span></span> {
|
||||
<span class="hljs-keyword">pub</span> muted: <span class="hljs-keyword">bool</span>,
|
||||
}
|
||||
|
||||
<span class="hljs-meta">#[derive(Serialize, Deserialize)]</span>
|
||||
<span class="hljs-meta">#[allow(non_snake_case)]</span>
|
||||
<span class="hljs-keyword">pub</span> <span class="hljs-class"><span class="hljs-keyword">struct</span> <span class="hljs-title">Profile</span></span> {
|
||||
<span class="hljs-keyword">pub</span> did: <span class="hljs-built_in">String</span>,
|
||||
<span class="hljs-keyword">pub</span> handle: <span class="hljs-built_in">String</span>,
|
||||
<span class="hljs-keyword">pub</span> followsCount: <span class="hljs-built_in">Option</span><<span class="hljs-keyword">i32</span>>,
|
||||
<span class="hljs-keyword">pub</span> followersCount: <span class="hljs-built_in">Option</span><<span class="hljs-keyword">i32</span>>,
|
||||
<span class="hljs-keyword">pub</span> postsCount: <span class="hljs-keyword">i32</span>,
|
||||
<span class="hljs-keyword">pub</span> indexedAt: <span class="hljs-built_in">Option</span><<span class="hljs-built_in">String</span>>,
|
||||
<span class="hljs-keyword">pub</span> avatar: <span class="hljs-built_in">Option</span><<span class="hljs-built_in">String</span>>,
|
||||
<span class="hljs-keyword">pub</span> banner: <span class="hljs-built_in">Option</span><<span class="hljs-built_in">String</span>>,
|
||||
<span class="hljs-keyword">pub</span> displayName: <span class="hljs-built_in">Option</span><<span class="hljs-built_in">String</span>>,
|
||||
<span class="hljs-keyword">pub</span> description: <span class="hljs-built_in">Option</span><<span class="hljs-built_in">String</span>>,
|
||||
<span class="hljs-keyword">pub</span> viewer: Viewer,
|
||||
<span class="hljs-keyword">pub</span> labels: Labels,
|
||||
}
|
||||
|
||||
<span class="hljs-keyword">impl</span> Data {
|
||||
<span class="hljs-keyword">pub</span> <span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">new</span></span>() -> <span class="hljs-built_in">Result</span><<span class="hljs-keyword">Self</span>, ConfigError> {
|
||||
<span class="hljs-keyword">let</span> d = shellexpand::tilde(<span class="hljs-string">"~"</span>) + <span class="hljs-string">"/.config/ai/config.toml"</span>;
|
||||
<span class="hljs-keyword">let</span> s = Config::builder()
|
||||
.add_source(File::with_name(&d))
|
||||
.add_source(config::Environment::with_prefix(<span class="hljs-string">"APP"</span>))
|
||||
.build()?;
|
||||
s.try_deserialize()
|
||||
}
|
||||
}
|
||||
|
||||
<span class="hljs-keyword">impl</span> Tokens {
|
||||
<span class="hljs-keyword">pub</span> <span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">new</span></span>() -> <span class="hljs-built_in">Result</span><<span class="hljs-keyword">Self</span>, ConfigError> {
|
||||
<span class="hljs-keyword">let</span> d = shellexpand::tilde(<span class="hljs-string">"~"</span>) + <span class="hljs-string">"/.config/ai/token.toml"</span>;
|
||||
<span class="hljs-keyword">let</span> s = Config::builder()
|
||||
.add_source(File::with_name(&d))
|
||||
.add_source(config::Environment::with_prefix(<span class="hljs-string">"APP"</span>))
|
||||
.build()?;
|
||||
s.try_deserialize()
|
||||
}
|
||||
}
|
||||
|
||||
<span class="hljs-keyword">pub</span> <span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">token_toml</span></span>(s: &<span class="hljs-keyword">str</span>) -> <span class="hljs-built_in">String</span> {
|
||||
<span class="hljs-keyword">let</span> s = <span class="hljs-built_in">String</span>::from(s);
|
||||
<span class="hljs-keyword">let</span> tokens = Tokens::new().unwrap();
|
||||
<span class="hljs-keyword">let</span> tokens = Tokens {
|
||||
did: tokens.did,
|
||||
access: tokens.access,
|
||||
refresh: tokens.refresh,
|
||||
handle: tokens.handle,
|
||||
};
|
||||
<span class="hljs-keyword">match</span> &*s {
|
||||
<span class="hljs-string">"did"</span> => tokens.did,
|
||||
<span class="hljs-string">"access"</span> => tokens.access,
|
||||
<span class="hljs-string">"refresh"</span> => tokens.refresh,
|
||||
<span class="hljs-string">"handle"</span> => tokens.handle,
|
||||
_ => s,
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
<div><p class="code-filename">src/profile.rs</p></div>
|
||||
<pre><code class="lang-rust"><span class="hljs-keyword">extern</span> <span class="hljs-keyword">crate</span> reqwest;
|
||||
<span class="hljs-keyword">use</span> crate::token_toml;
|
||||
|
||||
<span class="hljs-keyword">pub</span> async <span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">get_request</span></span>(handle: <span class="hljs-built_in">String</span>) -> <span class="hljs-built_in">String</span> {
|
||||
|
||||
<span class="hljs-keyword">let</span> token = token_toml(&<span class="hljs-string">"access"</span>);
|
||||
<span class="hljs-keyword">let</span> url = <span class="hljs-string">"https://bsky.social/xrpc/app.bsky.actor.getProfile"</span>.to_owned() + &<span class="hljs-string">"?actor="</span> + &handle;
|
||||
<span class="hljs-keyword">let</span> client = reqwest::Client::new();
|
||||
<span class="hljs-keyword">let</span> res = client
|
||||
.get(url)
|
||||
.header(<span class="hljs-string">"Authorization"</span>, <span class="hljs-string">"Bearer "</span>.to_owned() + &token)
|
||||
.send()
|
||||
.await
|
||||
.unwrap()
|
||||
.text()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
<span class="hljs-keyword">return</span> res
|
||||
}
|
||||
</code></pre>
|
||||
<div><p class="code-filename">src/mention.rs</p></div>
|
||||
<pre><code class="lang-rust"><span class="hljs-keyword">extern</span> <span class="hljs-keyword">crate</span> reqwest;
|
||||
<span class="hljs-keyword">use</span> crate::token_toml;
|
||||
<span class="hljs-keyword">use</span> serde_json::json;
|
||||
<span class="hljs-keyword">use</span> iso8601_timestamp::Timestamp;
|
||||
|
||||
<span class="hljs-keyword">pub</span> async <span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">post_request</span></span>(text: <span class="hljs-built_in">String</span>, at: <span class="hljs-built_in">String</span>, udid: <span class="hljs-built_in">String</span>, s: <span class="hljs-keyword">i32</span>, e: <span class="hljs-keyword">i32</span>) -> <span class="hljs-built_in">String</span> {
|
||||
|
||||
<span class="hljs-keyword">let</span> token = token_toml(&<span class="hljs-string">"access"</span>);
|
||||
<span class="hljs-keyword">let</span> did = token_toml(&<span class="hljs-string">"did"</span>);
|
||||
<span class="hljs-keyword">let</span> handle = token_toml(&<span class="hljs-string">"handle"</span>);
|
||||
|
||||
<span class="hljs-keyword">let</span> url = <span class="hljs-string">"https://bsky.social/xrpc/com.atproto.repo.createRecord"</span>;
|
||||
<span class="hljs-keyword">let</span> col = <span class="hljs-string">"app.bsky.feed.post"</span>.to_string();
|
||||
|
||||
<span class="hljs-keyword">let</span> d = Timestamp::now_utc();
|
||||
<span class="hljs-keyword">let</span> d = d.to_string();
|
||||
|
||||
<span class="hljs-keyword">let</span> post = <span class="hljs-literal">Some</span>(json!({
|
||||
<span class="hljs-string">"did"</span>: did.to_string(),
|
||||
<span class="hljs-string">"repo"</span>: handle.to_string(),
|
||||
<span class="hljs-string">"collection"</span>: col.to_string(),
|
||||
<span class="hljs-string">"record"</span>: {
|
||||
<span class="hljs-string">"text"</span>: at.to_string() + &<span class="hljs-string">" "</span>.to_string() + &text.to_string(),
|
||||
<span class="hljs-string">"$type"</span>: <span class="hljs-string">"app.bsky.feed.post"</span>,
|
||||
<span class="hljs-string">"createdAt"</span>: d.to_string(),
|
||||
<span class="hljs-string">"facets"</span>: [
|
||||
{
|
||||
<span class="hljs-string">"$type"</span>: <span class="hljs-string">"app.bsky.richtext.facet"</span>,
|
||||
<span class="hljs-string">"index"</span>: {
|
||||
<span class="hljs-string">"byteEnd"</span>: e,
|
||||
<span class="hljs-string">"byteStart"</span>: s
|
||||
},<span class="hljs-string">"features"</span>: [
|
||||
{
|
||||
<span class="hljs-string">"did"</span>: udid.to_string(),
|
||||
<span class="hljs-string">"$type"</span>: <span class="hljs-string">"app.bsky.richtext.facet#mention"</span>
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
}));
|
||||
|
||||
<span class="hljs-keyword">let</span> client = reqwest::Client::new();
|
||||
<span class="hljs-keyword">let</span> res = client
|
||||
.post(url)
|
||||
.json(&post)
|
||||
.header(<span class="hljs-string">"Authorization"</span>, <span class="hljs-string">"Bearer "</span>.to_owned() + &token)
|
||||
.send()
|
||||
.await
|
||||
.unwrap()
|
||||
.text()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
<span class="hljs-keyword">return</span> res
|
||||
}
|
||||
</code></pre>
|
||||
<div><p class="code-filename">src/main.rs</p></div>
|
||||
<pre><code class="lang-rust"><span class="hljs-keyword">pub</span> <span class="hljs-keyword">mod</span> data;
|
||||
<span class="hljs-keyword">pub</span> <span class="hljs-keyword">mod</span> mention;
|
||||
<span class="hljs-keyword">pub</span> <span class="hljs-keyword">mod</span> profile;
|
||||
|
||||
<span class="hljs-keyword">use</span> seahorse::{App, Command, Context, Flag, FlagType};
|
||||
<span class="hljs-keyword">use</span> std::env;
|
||||
<span class="hljs-keyword">use</span> std::fs;
|
||||
<span class="hljs-keyword">use</span> std::io::Write;
|
||||
<span class="hljs-keyword">use</span> std::collections::HashMap;
|
||||
|
||||
<span class="hljs-keyword">use</span> data::Data <span class="hljs-keyword">as</span> Datas;
|
||||
<span class="hljs-keyword">use</span> crate::data::Token;
|
||||
<span class="hljs-keyword">use</span> crate::data::Tokens;
|
||||
<span class="hljs-keyword">use</span> crate::data::Profile;
|
||||
<span class="hljs-keyword">use</span> crate::data::token_toml;
|
||||
|
||||
<span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">main</span></span>() {
|
||||
<span class="hljs-keyword">let</span> args: <span class="hljs-built_in">Vec</span><<span class="hljs-built_in">String</span>> = env::args().collect();
|
||||
<span class="hljs-keyword">let</span> app = App::new(<span class="hljs-built_in">env!</span>(<span class="hljs-string">"CARGO_PKG_NAME"</span>))
|
||||
<span class="hljs-comment">//.action(c_ascii_art)</span>
|
||||
.command(
|
||||
Command::new(<span class="hljs-string">"bluesky"</span>)
|
||||
.alias(<span class="hljs-string">"b"</span>)
|
||||
.action(c_list_records),
|
||||
)
|
||||
.command(
|
||||
Command::new(<span class="hljs-string">"login"</span>)
|
||||
.alias(<span class="hljs-string">"l"</span>)
|
||||
.action(c_access_token),
|
||||
)
|
||||
.command(
|
||||
Command::new(<span class="hljs-string">"profile"</span>)
|
||||
.alias(<span class="hljs-string">"p"</span>)
|
||||
.action(c_profile),
|
||||
)
|
||||
.command(
|
||||
Command::new(<span class="hljs-string">"mention"</span>)
|
||||
.alias(<span class="hljs-string">"m"</span>)
|
||||
.action(c_mention)
|
||||
.flag(
|
||||
Flag::new(<span class="hljs-string">"post"</span>, FlagType::<span class="hljs-built_in">String</span>)
|
||||
.description(<span class="hljs-string">"post flag\n\t\t\t$ ai m syui.bsky.social -p text"</span>)
|
||||
.alias(<span class="hljs-string">"p"</span>),
|
||||
)
|
||||
)
|
||||
|
||||
;
|
||||
app.run(args);
|
||||
}
|
||||
|
||||
<span class="hljs-meta">#[tokio::main]</span>
|
||||
async <span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">list_records</span></span>() -> reqwest::<span class="hljs-built_in">Result</span><()> {
|
||||
<span class="hljs-keyword">let</span> client = reqwest::Client::new();
|
||||
<span class="hljs-keyword">let</span> handle= <span class="hljs-string">"support.bsky.team"</span>;
|
||||
<span class="hljs-keyword">let</span> col = <span class="hljs-string">"app.bsky.feed.post"</span>;
|
||||
<span class="hljs-keyword">let</span> body = client.get(<span class="hljs-string">"https://bsky.social/xrpc/com.atproto.repo.listRecords"</span>)
|
||||
.query(&[(<span class="hljs-string">"repo"</span>, &handle),(<span class="hljs-string">"collection"</span>, &col),(<span class="hljs-string">"limit"</span>, &<span class="hljs-string">"1"</span>),(<span class="hljs-string">"revert"</span>, &<span class="hljs-string">"true"</span>)])
|
||||
.send()
|
||||
.await?
|
||||
.text()
|
||||
.await?;
|
||||
<span class="hljs-built_in">println!</span>(<span class="hljs-string">"{}"</span>, body);
|
||||
<span class="hljs-literal">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">c_list_records</span></span>(_c: &Context) {
|
||||
list_records().unwrap();
|
||||
}
|
||||
|
||||
<span class="hljs-meta">#[tokio::main]</span>
|
||||
async <span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">access_token</span></span>() -> reqwest::<span class="hljs-built_in">Result</span><()> {
|
||||
<span class="hljs-keyword">let</span> file = <span class="hljs-string">"/.config/ai/token.toml"</span>;
|
||||
<span class="hljs-keyword">let</span> <span class="hljs-keyword">mut</span> f = shellexpand::tilde(<span class="hljs-string">"~"</span>).to_string();
|
||||
f.push_str(&file);
|
||||
|
||||
<span class="hljs-keyword">let</span> data = Datas::new().unwrap();
|
||||
<span class="hljs-keyword">let</span> data = Datas {
|
||||
host: data.host,
|
||||
handle: data.handle,
|
||||
pass: data.pass,
|
||||
};
|
||||
<span class="hljs-keyword">let</span> url = <span class="hljs-string">"https://"</span>.to_owned() + &data.host + &<span class="hljs-string">"/xrpc/com.atproto.server.createSession"</span>;
|
||||
|
||||
<span class="hljs-keyword">let</span> <span class="hljs-keyword">mut</span> map = HashMap::new();
|
||||
map.insert(<span class="hljs-string">"identifier"</span>, &data.handle);
|
||||
map.insert(<span class="hljs-string">"password"</span>, &data.pass);
|
||||
<span class="hljs-keyword">let</span> client = reqwest::Client::new();
|
||||
<span class="hljs-keyword">let</span> res = client
|
||||
.post(url)
|
||||
.json(&map)
|
||||
.send()
|
||||
.await?
|
||||
.text()
|
||||
.await?;
|
||||
<span class="hljs-keyword">let</span> json: Token = serde_json::from_str(&res).unwrap();
|
||||
<span class="hljs-keyword">let</span> tokens = Tokens {
|
||||
did: json.did.to_string(),
|
||||
access: json.accessJwt.to_string(),
|
||||
refresh: json.refreshJwt.to_string(),
|
||||
handle: json.handle.to_string(),
|
||||
};
|
||||
<span class="hljs-keyword">let</span> toml = toml::to_string(&tokens).unwrap();
|
||||
<span class="hljs-keyword">let</span> <span class="hljs-keyword">mut</span> f = fs::File::create(f.clone()).unwrap();
|
||||
f.write_all(&toml.as_bytes()).unwrap();
|
||||
|
||||
<span class="hljs-literal">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">c_access_token</span></span>(_c: &Context) {
|
||||
access_token().unwrap();
|
||||
}
|
||||
|
||||
<span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">profile</span></span>(c: &Context) {
|
||||
<span class="hljs-keyword">let</span> m = c.args[<span class="hljs-number">0</span>].to_string();
|
||||
<span class="hljs-keyword">let</span> h = async {
|
||||
<span class="hljs-keyword">let</span> <span class="hljs-keyword">str</span> = profile::get_request(m.to_string()).await;
|
||||
<span class="hljs-built_in">println!</span>(<span class="hljs-string">"{}"</span>,<span class="hljs-keyword">str</span>);
|
||||
};
|
||||
<span class="hljs-keyword">let</span> res = tokio::runtime::Runtime::new().unwrap().block_on(h);
|
||||
<span class="hljs-keyword">return</span> res
|
||||
}
|
||||
|
||||
<span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">c_profile</span></span>(c: &Context) {
|
||||
access_token().unwrap();
|
||||
profile(c);
|
||||
}
|
||||
|
||||
<span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">mention</span></span>(c: &Context) {
|
||||
<span class="hljs-keyword">let</span> m = c.args[<span class="hljs-number">0</span>].to_string();
|
||||
<span class="hljs-keyword">let</span> h = async {
|
||||
<span class="hljs-keyword">let</span> <span class="hljs-keyword">str</span> = profile::get_request(m.to_string()).await;
|
||||
<span class="hljs-built_in">println!</span>(<span class="hljs-string">"{}"</span>,<span class="hljs-keyword">str</span>);
|
||||
<span class="hljs-keyword">let</span> profile: Profile = serde_json::from_str(&<span class="hljs-keyword">str</span>).unwrap();
|
||||
<span class="hljs-keyword">let</span> udid = profile.did;
|
||||
<span class="hljs-keyword">let</span> handle = profile.handle;
|
||||
<span class="hljs-keyword">let</span> at = <span class="hljs-string">"@"</span>.to_owned() + &handle;
|
||||
<span class="hljs-keyword">let</span> e = at.chars().count();
|
||||
<span class="hljs-keyword">let</span> s = <span class="hljs-number">0</span>;
|
||||
<span class="hljs-keyword">if</span> <span class="hljs-keyword">let</span> <span class="hljs-literal">Ok</span>(post) = c.string_flag(<span class="hljs-string">"post"</span>) {
|
||||
<span class="hljs-keyword">let</span> <span class="hljs-keyword">str</span> = mention::post_request(post.to_string(), at.to_string(), udid.to_string(), s, e.try_into().unwrap()).await;
|
||||
<span class="hljs-built_in">println!</span>(<span class="hljs-string">"{}"</span>,<span class="hljs-keyword">str</span>);
|
||||
}
|
||||
};
|
||||
<span class="hljs-keyword">let</span> res = tokio::runtime::Runtime::new().unwrap().block_on(h);
|
||||
<span class="hljs-keyword">return</span> res
|
||||
}
|
||||
|
||||
<span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">c_mention</span></span>(c: &Context) {
|
||||
access_token().unwrap();
|
||||
mention(c);
|
||||
}
|
||||
</code></pre>
|
||||
<p>今回、面倒なので<code>bsky.social</code>以外のhostには対応していません。主に<code>profile.rs</code>, <code>mention.rs</code>です。その辺は注意してください。</p>
|
||||
<div><p class="code-filename">src/profile.rs</p></div>
|
||||
<pre><code class="lang-rust"><span class="hljs-keyword">let</span> url = <span class="hljs-string">"https://bsky.social/xrpc/app.bsky.actor.getProfile"</span>.to_owned() + &<span class="hljs-string">"?actor="</span> + &handle;
|
||||
</code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="1.html" class="navigation navigation-prev " aria-label="Previous page: config">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="3.html" class="navigation navigation-next " aria-label="Next page: base64">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"mention","level":"1.6.3","depth":2,"next":{"title":"base64","level":"1.6.4","depth":2,"path":"c4/3.md","ref":"c4/3.md","articles":[]},"previous":{"title":"config","level":"1.6.2","depth":2,"path":"c4/1.md","ref":"c4/1.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-sharing","codeblock-filename","mermaid-gb3","diff"],"root":"./","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"codeblock-filename":{},"mermaid-gb3":{},"diff":{"type":"markdown","method":"diffChars","options":{}},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"syui","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"hello world! bluesky","gitbook":"*","description":"This is a bluesky ai-card example, and first rust"},"file":{"path":"c4/2.md","mtime":"2023-07-22T11:05:21.851Z","type":"markdown"},"gitbook":{"version":"3.3.6","time":"2023-09-16T08:55:27.618Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-mermaid-gb3/book/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.min.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -0,0 +1,838 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>base64 · hello world! bluesky</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="@gitbook-ng/gitbook 3.3.6">
|
||||
<meta name="author" content="syui">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-codeblock-filename/block.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="../c5/" />
|
||||
|
||||
|
||||
<link rel="prev" href="2.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
hello world! bluesky
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../card/">
|
||||
|
||||
<a href="../card/">
|
||||
|
||||
|
||||
card
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../c1/">
|
||||
|
||||
<a href="../c1/">
|
||||
|
||||
|
||||
part 1
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../c1/1.html">
|
||||
|
||||
<a href="../c1/1.html">
|
||||
|
||||
|
||||
quick start
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../c1/2.html">
|
||||
|
||||
<a href="../c1/2.html">
|
||||
|
||||
|
||||
example
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../c2/">
|
||||
|
||||
<a href="../c2/">
|
||||
|
||||
|
||||
part 2
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="../c2/1.html">
|
||||
|
||||
<a href="../c2/1.html">
|
||||
|
||||
|
||||
bluesky
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="../c2/2.html">
|
||||
|
||||
<a href="../c2/2.html">
|
||||
|
||||
|
||||
terminal
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="../c2/3.html">
|
||||
|
||||
<a href="../c2/3.html">
|
||||
|
||||
|
||||
shell
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.4" data-path="../c2/4.html">
|
||||
|
||||
<a href="../c2/4.html">
|
||||
|
||||
|
||||
rust
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" data-path="../c3/">
|
||||
|
||||
<a href="../c3/">
|
||||
|
||||
|
||||
part 3
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.5.1" data-path="../c3/1.html">
|
||||
|
||||
<a href="../c3/1.html">
|
||||
|
||||
|
||||
hello world
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.2" data-path="../c3/2.html">
|
||||
|
||||
<a href="../c3/2.html">
|
||||
|
||||
|
||||
seahorse
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.3" data-path="../c3/3.html">
|
||||
|
||||
<a href="../c3/3.html">
|
||||
|
||||
|
||||
reqwest
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
part 4
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.6.1" data-path="0.html">
|
||||
|
||||
<a href="0.html">
|
||||
|
||||
|
||||
ai
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6.2" data-path="1.html">
|
||||
|
||||
<a href="1.html">
|
||||
|
||||
|
||||
config
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6.3" data-path="2.html">
|
||||
|
||||
<a href="2.html">
|
||||
|
||||
|
||||
mention
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.6.4" data-path="3.html">
|
||||
|
||||
<a href="3.html">
|
||||
|
||||
|
||||
base64
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7" data-path="../c5/">
|
||||
|
||||
<a href="../c5/">
|
||||
|
||||
|
||||
part 5
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.7.1" data-path="../c5/1.html">
|
||||
|
||||
<a href="../c5/1.html">
|
||||
|
||||
|
||||
notify
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.2" data-path="../c5/2.html">
|
||||
|
||||
<a href="../c5/2.html">
|
||||
|
||||
|
||||
timeline
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.3" data-path="../c5/3.html">
|
||||
|
||||
<a href="../c5/3.html">
|
||||
|
||||
|
||||
refresh
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.8" data-path="../end/">
|
||||
|
||||
<a href="../end/">
|
||||
|
||||
|
||||
end
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >base64</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h3 id="base64">base64</h3>
|
||||
<p>次は、コマンドオプションで指定した文字を<a href="https://uma0317.github.io/rust-cookbook-ja/encoding/strings.html" target="_blank">base64</a>に変換して<code>mention</code>するコードを書きます。</p>
|
||||
<p>これでプログラムの完成です。</p>
|
||||
<p>まずは<code>base64</code>のパッケージを追加します。</p>
|
||||
<div><p class="code-filename">Cargo.toml</p></div>
|
||||
<pre><code class="lang-toml"><span class="hljs-section">[package]</span>
|
||||
<span class="hljs-attr">name</span> = <span class="hljs-string">"ai"</span>
|
||||
<span class="hljs-attr">version</span> = <span class="hljs-string">"0.1.0"</span>
|
||||
<span class="hljs-attr">edition</span> = <span class="hljs-string">"2021"</span>
|
||||
<span class="hljs-section">
|
||||
[dependencies]</span>
|
||||
<span class="hljs-attr">seahorse</span> = <span class="hljs-string">"*"</span>
|
||||
<span class="hljs-attr">reqwest</span> = { version = <span class="hljs-string">"*"</span>, features = [<span class="hljs-string">"blocking"</span>, <span class="hljs-string">"json"</span>] }
|
||||
<span class="hljs-attr">tokio</span> = { version = <span class="hljs-string">"1"</span>, features = [<span class="hljs-string">"full"</span>] }
|
||||
<span class="hljs-attr">serde_derive</span> = <span class="hljs-string">"1.0"</span>
|
||||
<span class="hljs-attr">serde_json</span> = <span class="hljs-string">"1.0"</span>
|
||||
<span class="hljs-attr">serde</span> = <span class="hljs-string">"*"</span>
|
||||
<span class="hljs-attr">config</span> = { git = <span class="hljs-string">"https://github.com/mehcode/config-rs"</span>, branch = <span class="hljs-string">"master"</span> }
|
||||
<span class="hljs-attr">shellexpand</span> = <span class="hljs-string">"*"</span>
|
||||
<span class="hljs-attr">toml</span> = <span class="hljs-string">"*"</span>
|
||||
<span class="hljs-attr">iso8601-timestamp</span> = <span class="hljs-string">"0.2.10"</span>
|
||||
<span class="hljs-attr">base64</span> = <span class="hljs-string">"*"</span>
|
||||
</code></pre>
|
||||
<p>そして、<code>src/main.rs</code>のmentionのところに<code>did</code>をbase64に変換するコードを書いていきます。</p>
|
||||
<p>これらはサブオプションに設定します。</p>
|
||||
<p>要点をまとめるとこんな感じです。</p>
|
||||
<div><p class="code-filename">example</p></div>
|
||||
<pre><code class="lang-rust">.command(
|
||||
Command::new(<span class="hljs-string">"mention"</span>)
|
||||
.alias(<span class="hljs-string">"m"</span>)
|
||||
.action(c_mention)
|
||||
.flag(
|
||||
Flag::new(<span class="hljs-string">"base"</span>, FlagType::<span class="hljs-built_in">String</span>)
|
||||
.description(<span class="hljs-string">"base flag\n\t\t\t$ ai m syui.bsky.social -p text -b 123"</span>)
|
||||
.alias(<span class="hljs-string">"b"</span>),
|
||||
)
|
||||
.flag(
|
||||
Flag::new(<span class="hljs-string">"egg"</span>, FlagType::Bool)
|
||||
.description(<span class="hljs-string">"egg flag\n\t\t\t$ ai m syui.bsky.social -e"</span>)
|
||||
.alias(<span class="hljs-string">"e"</span>),
|
||||
)
|
||||
|
||||
<span class="hljs-keyword">let</span> did = token_toml(&<span class="hljs-string">"did"</span>);
|
||||
<span class="hljs-keyword">let</span> body = <span class="hljs-string">"/egg "</span>.to_owned() + &encode(did.as_bytes());
|
||||
</code></pre>
|
||||
<p><code>-b</code>で変換する文字列を指定できるようにします。必ず<code>-b "foo bar"</code>というようにダブルクオーテーションで囲ってください。<code>-e</code>で<code>did</code>を取ってきて自動変換してmentionするようにします。</p>
|
||||
<pre><code class="lang-sh"><span class="hljs-comment"># 指定してた文字列をbase64にしてmentionする</span>
|
||||
$ ai m yui.syui.ai -b <span class="hljs-string">"did:plc:4hqjfn7m6n5hno3doamuhgef"</span>
|
||||
@yui.syui.ai /egg ZGlkOnBsYzo0aHFqZm43bTZuNWhubzNkb2FtdWhnZWY=
|
||||
|
||||
<span class="hljs-comment"># 自分のdidをbase64にしてmentionする</span>
|
||||
$ ai m yui.syui.ai <span class="hljs-_">-e</span>
|
||||
@yui.syui.ai /egg ZGlkOnBsYzo0aHFqZm43bTZuNWhubzNkb2FtdWhnZWY=
|
||||
</code></pre>
|
||||
<p>では、全部のコードを書いていきます。</p>
|
||||
<div><p class="code-filename">src/main.rs</p></div>
|
||||
<pre><code class="lang-rust"><span class="hljs-keyword">pub</span> <span class="hljs-keyword">mod</span> data;
|
||||
<span class="hljs-keyword">pub</span> <span class="hljs-keyword">mod</span> mention;
|
||||
<span class="hljs-keyword">pub</span> <span class="hljs-keyword">mod</span> profile;
|
||||
<span class="hljs-comment">//pub mod ascii;</span>
|
||||
|
||||
<span class="hljs-keyword">use</span> seahorse::{App, Command, Context, Flag, FlagType};
|
||||
<span class="hljs-keyword">use</span> std::env;
|
||||
<span class="hljs-keyword">use</span> std::fs;
|
||||
<span class="hljs-keyword">use</span> std::io::Write;
|
||||
<span class="hljs-keyword">use</span> std::collections::HashMap;
|
||||
|
||||
<span class="hljs-keyword">use</span> data::Data <span class="hljs-keyword">as</span> Datas;
|
||||
<span class="hljs-keyword">use</span> crate::data::Token;
|
||||
<span class="hljs-keyword">use</span> crate::data::Tokens;
|
||||
<span class="hljs-keyword">use</span> crate::data::Profile;
|
||||
<span class="hljs-keyword">use</span> crate::data::token_toml;
|
||||
<span class="hljs-comment">//use crate::ascii::c_ascii;</span>
|
||||
|
||||
<span class="hljs-keyword">extern</span> <span class="hljs-keyword">crate</span> base64;
|
||||
<span class="hljs-keyword">use</span> base64::encode;
|
||||
|
||||
<span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">main</span></span>() {
|
||||
<span class="hljs-keyword">let</span> args: <span class="hljs-built_in">Vec</span><<span class="hljs-built_in">String</span>> = env::args().collect();
|
||||
<span class="hljs-keyword">let</span> app = App::new(<span class="hljs-built_in">env!</span>(<span class="hljs-string">"CARGO_PKG_NAME"</span>))
|
||||
<span class="hljs-comment">//.action(c_ascii_art)</span>
|
||||
.command(
|
||||
Command::new(<span class="hljs-string">"bluesky"</span>)
|
||||
.alias(<span class="hljs-string">"b"</span>)
|
||||
.action(c_list_records),
|
||||
)
|
||||
.command(
|
||||
Command::new(<span class="hljs-string">"login"</span>)
|
||||
.alias(<span class="hljs-string">"l"</span>)
|
||||
.action(c_access_token),
|
||||
)
|
||||
.command(
|
||||
Command::new(<span class="hljs-string">"profile"</span>)
|
||||
.alias(<span class="hljs-string">"p"</span>)
|
||||
.action(c_profile),
|
||||
)
|
||||
.command(
|
||||
Command::new(<span class="hljs-string">"mention"</span>)
|
||||
.alias(<span class="hljs-string">"m"</span>)
|
||||
.action(c_mention)
|
||||
.flag(
|
||||
Flag::new(<span class="hljs-string">"post"</span>, FlagType::<span class="hljs-built_in">String</span>)
|
||||
.description(<span class="hljs-string">"post flag\n\t\t\t$ ai m syui.bsky.social -p text"</span>)
|
||||
.alias(<span class="hljs-string">"p"</span>),
|
||||
)
|
||||
.flag(
|
||||
Flag::new(<span class="hljs-string">"base"</span>, FlagType::<span class="hljs-built_in">String</span>)
|
||||
.description(<span class="hljs-string">"base flag\n\t\t\t$ ai m syui.bsky.social -p text -b 123"</span>)
|
||||
.alias(<span class="hljs-string">"b"</span>),
|
||||
)
|
||||
.flag(
|
||||
Flag::new(<span class="hljs-string">"egg"</span>, FlagType::Bool)
|
||||
.description(<span class="hljs-string">"egg flag\n\t\t\t$ ai m syui.bsky.social -e"</span>)
|
||||
.alias(<span class="hljs-string">"e"</span>),
|
||||
)
|
||||
)
|
||||
|
||||
;
|
||||
app.run(args);
|
||||
}
|
||||
|
||||
<span class="hljs-meta">#[tokio::main]</span>
|
||||
async <span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">list_records</span></span>() -> reqwest::<span class="hljs-built_in">Result</span><()> {
|
||||
<span class="hljs-keyword">let</span> client = reqwest::Client::new();
|
||||
<span class="hljs-keyword">let</span> handle= <span class="hljs-string">"support.bsky.team"</span>;
|
||||
<span class="hljs-keyword">let</span> col = <span class="hljs-string">"app.bsky.feed.post"</span>;
|
||||
<span class="hljs-keyword">let</span> body = client.get(<span class="hljs-string">"https://bsky.social/xrpc/com.atproto.repo.listRecords"</span>)
|
||||
.query(&[(<span class="hljs-string">"repo"</span>, &handle),(<span class="hljs-string">"collection"</span>, &col),(<span class="hljs-string">"limit"</span>, &<span class="hljs-string">"1"</span>),(<span class="hljs-string">"revert"</span>, &<span class="hljs-string">"true"</span>)])
|
||||
.send()
|
||||
.await?
|
||||
.text()
|
||||
.await?;
|
||||
<span class="hljs-built_in">println!</span>(<span class="hljs-string">"{}"</span>, body);
|
||||
<span class="hljs-literal">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">c_list_records</span></span>(_c: &Context) {
|
||||
list_records().unwrap();
|
||||
}
|
||||
|
||||
<span class="hljs-meta">#[tokio::main]</span>
|
||||
async <span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">access_token</span></span>() -> reqwest::<span class="hljs-built_in">Result</span><()> {
|
||||
<span class="hljs-keyword">let</span> file = <span class="hljs-string">"/.config/ai/token.toml"</span>;
|
||||
<span class="hljs-keyword">let</span> <span class="hljs-keyword">mut</span> f = shellexpand::tilde(<span class="hljs-string">"~"</span>).to_string();
|
||||
f.push_str(&file);
|
||||
|
||||
<span class="hljs-keyword">let</span> data = Datas::new().unwrap();
|
||||
<span class="hljs-keyword">let</span> data = Datas {
|
||||
host: data.host,
|
||||
handle: data.handle,
|
||||
pass: data.pass,
|
||||
};
|
||||
<span class="hljs-keyword">let</span> url = <span class="hljs-string">"https://"</span>.to_owned() + &data.host + &<span class="hljs-string">"/xrpc/com.atproto.server.createSession"</span>;
|
||||
|
||||
<span class="hljs-keyword">let</span> <span class="hljs-keyword">mut</span> map = HashMap::new();
|
||||
map.insert(<span class="hljs-string">"identifier"</span>, &data.handle);
|
||||
map.insert(<span class="hljs-string">"password"</span>, &data.pass);
|
||||
<span class="hljs-keyword">let</span> client = reqwest::Client::new();
|
||||
<span class="hljs-keyword">let</span> res = client
|
||||
.post(url)
|
||||
.json(&map)
|
||||
.send()
|
||||
.await?
|
||||
.text()
|
||||
.await?;
|
||||
<span class="hljs-keyword">let</span> json: Token = serde_json::from_str(&res).unwrap();
|
||||
<span class="hljs-keyword">let</span> tokens = Tokens {
|
||||
did: json.did.to_string(),
|
||||
access: json.accessJwt.to_string(),
|
||||
refresh: json.refreshJwt.to_string(),
|
||||
handle: json.handle.to_string(),
|
||||
};
|
||||
<span class="hljs-keyword">let</span> toml = toml::to_string(&tokens).unwrap();
|
||||
<span class="hljs-keyword">let</span> <span class="hljs-keyword">mut</span> f = fs::File::create(f.clone()).unwrap();
|
||||
f.write_all(&toml.as_bytes()).unwrap();
|
||||
|
||||
<span class="hljs-literal">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">c_access_token</span></span>(_c: &Context) {
|
||||
access_token().unwrap();
|
||||
}
|
||||
|
||||
<span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">profile</span></span>(c: &Context) {
|
||||
<span class="hljs-keyword">let</span> m = c.args[<span class="hljs-number">0</span>].to_string();
|
||||
<span class="hljs-keyword">let</span> h = async {
|
||||
<span class="hljs-keyword">let</span> <span class="hljs-keyword">str</span> = profile::get_request(m.to_string()).await;
|
||||
<span class="hljs-built_in">println!</span>(<span class="hljs-string">"{}"</span>,<span class="hljs-keyword">str</span>);
|
||||
};
|
||||
<span class="hljs-keyword">let</span> res = tokio::runtime::Runtime::new().unwrap().block_on(h);
|
||||
<span class="hljs-keyword">return</span> res
|
||||
}
|
||||
|
||||
<span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">c_profile</span></span>(c: &Context) {
|
||||
access_token().unwrap();
|
||||
profile(c);
|
||||
}
|
||||
|
||||
<span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">mention</span></span>(c: &Context) {
|
||||
<span class="hljs-keyword">let</span> m = c.args[<span class="hljs-number">0</span>].to_string();
|
||||
<span class="hljs-keyword">let</span> h = async {
|
||||
<span class="hljs-keyword">let</span> <span class="hljs-keyword">str</span> = profile::get_request(m.to_string()).await;
|
||||
<span class="hljs-keyword">let</span> profile: Profile = serde_json::from_str(&<span class="hljs-keyword">str</span>).unwrap();
|
||||
<span class="hljs-keyword">let</span> udid = profile.did;
|
||||
<span class="hljs-keyword">let</span> handle = profile.handle;
|
||||
<span class="hljs-keyword">let</span> at = <span class="hljs-string">"@"</span>.to_owned() + &handle;
|
||||
<span class="hljs-keyword">let</span> e = at.chars().count();
|
||||
<span class="hljs-keyword">let</span> s = <span class="hljs-number">0</span>;
|
||||
<span class="hljs-keyword">if</span> <span class="hljs-keyword">let</span> <span class="hljs-literal">Ok</span>(base) = c.string_flag(<span class="hljs-string">"base"</span>) {
|
||||
<span class="hljs-keyword">let</span> body = <span class="hljs-string">"/egg "</span>.to_owned() + &encode(base.as_bytes());
|
||||
<span class="hljs-keyword">let</span> <span class="hljs-keyword">str</span> = mention::post_request(body.to_string(), at.to_string(), udid.to_string(), s, e.try_into().unwrap()).await;
|
||||
<span class="hljs-built_in">println!</span>(<span class="hljs-string">"{}"</span>,<span class="hljs-keyword">str</span>);
|
||||
}
|
||||
<span class="hljs-keyword">if</span> <span class="hljs-keyword">let</span> <span class="hljs-literal">Ok</span>(post) = c.string_flag(<span class="hljs-string">"post"</span>) {
|
||||
|
||||
<span class="hljs-keyword">let</span> <span class="hljs-keyword">str</span> = mention::post_request(post.to_string(), at.to_string(), udid.to_string(), s, e.try_into().unwrap()).await;
|
||||
<span class="hljs-built_in">println!</span>(<span class="hljs-string">"{}"</span>,<span class="hljs-keyword">str</span>);
|
||||
}
|
||||
<span class="hljs-keyword">if</span> c.bool_flag(<span class="hljs-string">"egg"</span>) {
|
||||
<span class="hljs-keyword">let</span> did = token_toml(&<span class="hljs-string">"did"</span>);
|
||||
<span class="hljs-keyword">let</span> body = <span class="hljs-string">"/egg "</span>.to_owned() + &encode(did.as_bytes());
|
||||
<span class="hljs-built_in">println!</span>(<span class="hljs-string">"{}"</span>, body);
|
||||
<span class="hljs-keyword">let</span> <span class="hljs-keyword">str</span> = mention::post_request(body.to_string(), at.to_string(), udid.to_string(), s, e.try_into().unwrap()).await;
|
||||
<span class="hljs-built_in">println!</span>(<span class="hljs-string">"{}"</span>,<span class="hljs-keyword">str</span>);
|
||||
}
|
||||
};
|
||||
<span class="hljs-keyword">let</span> res = tokio::runtime::Runtime::new().unwrap().block_on(h);
|
||||
<span class="hljs-keyword">return</span> res
|
||||
}
|
||||
|
||||
<span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">c_mention</span></span>(c: &Context) {
|
||||
access_token().unwrap();
|
||||
mention(c);
|
||||
}
|
||||
|
||||
<span class="hljs-comment">//fn c_ascii_art(_c: &Context) {</span>
|
||||
<span class="hljs-comment">// c_ascii();</span>
|
||||
<span class="hljs-comment">//}</span>
|
||||
</code></pre>
|
||||
<pre><code class="lang-sh">cargo build
|
||||
</code></pre>
|
||||
<p>できました。</p>
|
||||
<p>これでmentionを<code>yui.syui.ai</code>に指定して、<code>-e</code>のオプションを使うと、自分のdidをbase64に自動変換して送ってくれます。</p>
|
||||
<pre><code class="lang-sh">./target/debug/ai m yui.syui.ai <span class="hljs-_">-e</span>
|
||||
</code></pre>
|
||||
<p>しかし、これではコマンドが実行しづらい。</p>
|
||||
<p>このコマンドをどこにいても実行できるよう、binary、つまり、<code>cargo build</code>するとできる<code>./target/debug/ai</code>を<code>$PATH</code>に置いてみます。</p>
|
||||
<div><p class="code-filename">linux</p></div>
|
||||
<pre><code class="lang-sh">$ <span class="hljs-built_in">echo</span> <span class="hljs-variable">$PATH</span>|tr : <span class="hljs-string">'\n'</span>
|
||||
/usr/bin
|
||||
/usr/<span class="hljs-built_in">local</span>/bin
|
||||
|
||||
$ sudo cp -rf ./target/debug/ai /usr/<span class="hljs-built_in">local</span>/bin/
|
||||
$ ai -h
|
||||
|
||||
Name:
|
||||
ai
|
||||
Flags:
|
||||
-h, --help : Show <span class="hljs-built_in">help</span>
|
||||
Commands:
|
||||
b, bluesky :
|
||||
l, login :
|
||||
p, profile :
|
||||
m, mention :
|
||||
</code></pre>
|
||||
<div><p class="code-filename">windows</p></div>
|
||||
<pre><code class="lang-sh"><span class="hljs-variable">$ENV</span>:Path.Split(<span class="hljs-string">";"</span>)
|
||||
C:\Users\syui\scoop\apps\rust\current\bin
|
||||
|
||||
cp ~/scoop/rust/current/bin/
|
||||
ai -h
|
||||
</code></pre>
|
||||
<p>こんな感じで<code>rust</code>で自分のコマンドを作って遊んでみましょう。</p>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="2.html" class="navigation navigation-prev " aria-label="Previous page: mention">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="../c5/" class="navigation navigation-next " aria-label="Next page: part 5">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"base64","level":"1.6.4","depth":2,"next":{"title":"part 5","level":"1.7","depth":1,"path":"c5/README.md","ref":"c5/README.md","articles":[{"title":"notify","level":"1.7.1","depth":2,"path":"c5/1.md","ref":"c5/1.md","articles":[]},{"title":"timeline","level":"1.7.2","depth":2,"path":"c5/2.md","ref":"c5/2.md","articles":[]},{"title":"refresh","level":"1.7.3","depth":2,"path":"c5/3.md","ref":"c5/3.md","articles":[]}]},"previous":{"title":"mention","level":"1.6.3","depth":2,"path":"c4/2.md","ref":"c4/2.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-sharing","codeblock-filename","mermaid-gb3","diff"],"root":"./","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"codeblock-filename":{},"mermaid-gb3":{},"diff":{"type":"markdown","method":"diffChars","options":{}},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"syui","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"hello world! bluesky","gitbook":"*","description":"This is a bluesky ai-card example, and first rust"},"file":{"path":"c4/3.md","mtime":"2023-07-25T16:11:29.240Z","type":"markdown"},"gitbook":{"version":"3.3.6","time":"2023-09-16T08:55:27.618Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-mermaid-gb3/book/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.min.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -0,0 +1,569 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>part 4 · hello world! bluesky</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="@gitbook-ng/gitbook 3.3.6">
|
||||
<meta name="author" content="syui">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-codeblock-filename/block.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="0.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="../c3/3.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
hello world! bluesky
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../card/">
|
||||
|
||||
<a href="../card/">
|
||||
|
||||
|
||||
card
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../c1/">
|
||||
|
||||
<a href="../c1/">
|
||||
|
||||
|
||||
part 1
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../c1/1.html">
|
||||
|
||||
<a href="../c1/1.html">
|
||||
|
||||
|
||||
quick start
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../c1/2.html">
|
||||
|
||||
<a href="../c1/2.html">
|
||||
|
||||
|
||||
example
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../c2/">
|
||||
|
||||
<a href="../c2/">
|
||||
|
||||
|
||||
part 2
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="../c2/1.html">
|
||||
|
||||
<a href="../c2/1.html">
|
||||
|
||||
|
||||
bluesky
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="../c2/2.html">
|
||||
|
||||
<a href="../c2/2.html">
|
||||
|
||||
|
||||
terminal
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="../c2/3.html">
|
||||
|
||||
<a href="../c2/3.html">
|
||||
|
||||
|
||||
shell
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.4" data-path="../c2/4.html">
|
||||
|
||||
<a href="../c2/4.html">
|
||||
|
||||
|
||||
rust
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" data-path="../c3/">
|
||||
|
||||
<a href="../c3/">
|
||||
|
||||
|
||||
part 3
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.5.1" data-path="../c3/1.html">
|
||||
|
||||
<a href="../c3/1.html">
|
||||
|
||||
|
||||
hello world
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.2" data-path="../c3/2.html">
|
||||
|
||||
<a href="../c3/2.html">
|
||||
|
||||
|
||||
seahorse
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.3" data-path="../c3/3.html">
|
||||
|
||||
<a href="../c3/3.html">
|
||||
|
||||
|
||||
reqwest
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.6" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
part 4
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.6.1" data-path="0.html">
|
||||
|
||||
<a href="0.html">
|
||||
|
||||
|
||||
ai
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6.2" data-path="1.html">
|
||||
|
||||
<a href="1.html">
|
||||
|
||||
|
||||
config
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6.3" data-path="2.html">
|
||||
|
||||
<a href="2.html">
|
||||
|
||||
|
||||
mention
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6.4" data-path="3.html">
|
||||
|
||||
<a href="3.html">
|
||||
|
||||
|
||||
base64
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7" data-path="../c5/">
|
||||
|
||||
<a href="../c5/">
|
||||
|
||||
|
||||
part 5
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.7.1" data-path="../c5/1.html">
|
||||
|
||||
<a href="../c5/1.html">
|
||||
|
||||
|
||||
notify
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.2" data-path="../c5/2.html">
|
||||
|
||||
<a href="../c5/2.html">
|
||||
|
||||
|
||||
timeline
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.3" data-path="../c5/3.html">
|
||||
|
||||
<a href="../c5/3.html">
|
||||
|
||||
|
||||
refresh
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.8" data-path="../end/">
|
||||
|
||||
<a href="../end/">
|
||||
|
||||
|
||||
end
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >part 4</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h2 id="part-4">part 4</h2>
|
||||
<p>この章では、<code>seahorse</code>, <code>reqwest</code>を使いながらrustのコードを書き上げ、プログラムを完成へと導きます。</p>
|
||||
<p>blueskyの<a href="https://github.com/bluesky-social/atproto/tree/main/lexicons" target="_blank">lexicons</a>が重要になります。</p>
|
||||
<p>もしわからない場合は<a href="../c1/">part 1</a>をご参照ください。</p>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="../c3/3.html" class="navigation navigation-prev " aria-label="Previous page: reqwest">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="0.html" class="navigation navigation-next " aria-label="Next page: ai">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"part 4","level":"1.6","depth":1,"next":{"title":"ai","level":"1.6.1","depth":2,"path":"c4/0.md","ref":"c4/0.md","articles":[]},"previous":{"title":"reqwest","level":"1.5.3","depth":2,"path":"c3/3.md","ref":"c3/3.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-sharing","codeblock-filename","mermaid-gb3","diff"],"root":"./","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"codeblock-filename":{},"mermaid-gb3":{},"diff":{"type":"markdown","method":"diffChars","options":{}},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"syui","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"hello world! bluesky","gitbook":"*","description":"This is a bluesky ai-card example, and first rust"},"file":{"path":"c4/README.md","mtime":"2023-07-22T11:00:30.626Z","type":"markdown"},"gitbook":{"version":"3.3.6","time":"2023-09-16T08:55:27.618Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-mermaid-gb3/book/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.min.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user