Compare commits

...

85 Commits
0.1.12 ... main

Author SHA1 Message Date
c74fc25a2f
Update README.md 2024-02-16 15:38:06 +09:00
a2773e2705
Update README.md 2023-08-16 20:53:08 +09:00
f1e37c9ff5
Update README.md 2023-08-16 20:50:35 +09:00
56bf8b0293
Update README.md 2023-08-16 18:57:11 +09:00
e2f616df73
Update README.md 2023-08-16 18:46:24 +09:00
2f94ed4305
Update README.md 2023-08-16 18:19:22 +09:00
21abc54ccd
Update README.md 2023-08-16 18:18:37 +09:00
5b0f184ea6
Update activitypub.extend.php 2023-08-08 20:41:02 +09:00
8f5aed806c
Update README.md 2023-08-08 20:40:33 +09:00
641a9cd40e
Update activitypub.extend.php 2023-08-08 20:39:37 +09:00
c510019165
Update activitypub.extend.php 2023-08-08 19:53:48 +09:00
6bd734d50b
Update activitypub.extend.php 2023-08-08 18:25:03 +09:00
b201e9d789
Update activitypub.extend.php 2023-08-08 15:36:17 +09:00
99af00d0d7
Update activitypub.extend.php 2023-08-08 14:59:04 +09:00
ffe384916d
Update activitypub.extend.php 2023-08-08 14:57:47 +09:00
91c355ccde
Update activitypub.extend.php 2023-08-08 14:57:06 +09:00
131329c95a
Update activitypub.extend.php 2023-08-06 03:02:54 +09:00
bdb295b207
Update README.md 2023-07-29 22:47:32 +09:00
c3b7c9824d
Update README.md 2023-07-29 22:47:21 +09:00
2e8a090f53
Update activitypub.extend.php 2023-07-26 18:26:09 +09:00
0337c40a05
Update activitypub.extend.php 2023-07-26 18:22:31 +09:00
b3b8527746
Update README.md 2023-07-11 15:44:05 +09:00
edbfc8dd62
Update activitypub.extend.php 2023-07-11 15:37:06 +09:00
51c51ea9ed
Update README.md 2023-07-11 15:28:54 +09:00
af010ddd55
Update activitypub.extend.php 2023-07-11 15:27:28 +09:00
21b35d489b
Update activitypub.extend.php 2023-07-11 15:25:00 +09:00
76022bc3e1
Update activitypub.extend.php 2023-07-11 14:38:49 +09:00
59a1248bf6
Update activitypub.extend.php 2023-07-11 14:35:47 +09:00
ec972bc5a1
Update activitypub.extend.php 2023-07-11 14:11:07 +09:00
4190a21ba2
Update activitypub.extend.php 2023-04-18 17:25:23 +09:00
835200e5e6
Update activitypub.extend.php 2023-03-03 02:13:52 +09:00
7565b29a37
Update activitypub.extend.php 2023-02-16 19:38:37 +09:00
b43467459b
Update activitypub.extend.php 2023-02-16 19:18:22 +09:00
3823ba32b0
Update activitypub.extend.php 2023-02-16 19:18:07 +09:00
142b91685b
Update activitypub.extend.php 2023-02-16 17:13:30 +09:00
7691f6f820
Update README.md 2023-02-16 17:03:42 +09:00
41d93d08ec
Rename chatgpt.activitypub.extend.php to chatgpt.activitypub.lib.php 2023-02-16 16:46:22 +09:00
4e7b20e593
Create chatgpt.activitypub.extend.php 2023-02-16 16:46:07 +09:00
ac50961dde
Merge pull request #8 from gnh1201/add-genrsa
Update activitypub.extend.php
2023-02-16 15:04:08 +09:00
a1b851fd3d
Update activitypub.extend.php 2023-02-16 15:03:43 +09:00
ea3b0e1e86
Merge pull request #7 from gnh1201/add-genrsa
Add genrsa
2023-02-16 14:24:41 +09:00
45244d7188
Update activitypub.extend.php 2023-02-16 14:20:21 +09:00
a9da7f91c3
Update activitypub.extend.php 2023-02-16 13:53:24 +09:00
d3fcaf352d
Update activitypub.extend.php 2023-02-16 13:50:29 +09:00
25ff6427ff
Update activitypub.extend.php 2023-02-16 11:54:38 +09:00
d3825ce466
Update activitypub.extend.php 2023-02-16 11:44:19 +09:00
65a4a527eb
Merge pull request #6 from gnh1201/add-genrsa
Add genrsa
2023-02-16 11:38:04 +09:00
9f4cf82142
Update activitypub.extend.php 2023-02-16 11:37:35 +09:00
637bf4d95b
Update activitypub.extend.php 2023-02-16 11:23:56 +09:00
4ecd66ec34
Merge pull request #5 from gnh1201/add-genrsa
Add genrsa
2023-02-16 10:55:13 +09:00
58fb822d6f
Update activitypub.extend.php 2023-02-16 10:54:59 +09:00
001b585bb0
Update README.md 2023-02-15 18:42:21 +09:00
71cac1fcda
Update activitypub.extend.php 2023-02-15 18:37:21 +09:00
45883d6f21
Update activitypub.extend.php 2023-02-15 18:01:50 +09:00
caefc2a88f
Update activitypub.extend.php 2023-02-15 17:58:30 +09:00
bfc6ea5939
Update activitypub.extend.php 2023-02-15 17:57:57 +09:00
86ab1be93c
Update activitypub.extend.php 2023-02-15 17:28:20 +09:00
599bd71e7b
Update activitypub.extend.php 2023-02-15 17:02:46 +09:00
9b21a9ebff
Update README.md 2023-02-15 16:48:07 +09:00
dee1f090a7
Update activitypub.extend.php 2022-12-20 11:26:45 +09:00
28ec9d0751
Update activitypub.extend.php 2022-12-20 11:17:45 +09:00
4c26ef6485
Update README.md 2022-12-04 14:33:18 +09:00
fe3077cb55 Add the email contact to report abuse 2022-11-25 23:17:08 +09:00
3e62896e31
Update activitypub.extend.php 2022-10-13 13:35:52 +09:00
709ab3ca78
Update activitypub.extend.php 2022-10-13 13:20:25 +09:00
d207cd20b9
Update README.md 2022-10-13 13:13:13 +09:00
86b3fc8029
Update activitypub.extend.php 2022-09-28 19:27:32 +09:00
4c980beb90
Update README.md 2022-09-28 19:11:13 +09:00
9a4bf1c641
Update activitypub.extend.php 2022-09-28 19:10:56 +09:00
7d098d3595
Update activitypub.extend.php 2022-09-28 19:05:09 +09:00
b65b417db6
Update activitypub.extend.php 2022-09-28 19:02:58 +09:00
95814b7b7c
Update activitypub.extend.php 2022-09-28 17:51:45 +09:00
b53a512d3a
Update activitypub.extend.php 2022-09-28 17:28:17 +09:00
7a38f1513f
Update activitypub.extend.php 2022-09-28 17:27:27 +09:00
a524395ec2
Update README.md 2022-09-28 11:04:44 +09:00
e223fb3dd4
Update README.md 2022-09-28 10:59:04 +09:00
eb90fb5909
Update activitypub.extend.php 2022-09-28 10:56:49 +09:00
1a11510354
Update activitypub.extend.php 2022-09-28 10:45:06 +09:00
8bb9c0ed0b
Update README.md 2022-07-07 23:48:56 +09:00
00e5ed84b7
Update README.md 2022-07-07 23:40:00 +09:00
c0212858be
Update activitypub.extend.php 2022-07-07 23:39:27 +09:00
3e8b7b063a
Update README.md 2022-07-07 22:09:30 +09:00
46b8c3843f
Update README.md 2022-07-07 18:46:38 +09:00
2b32524063
Update README.md 2022-07-07 18:45:14 +09:00
85702ae349
Update webhook.activitypub.lib.php 2022-07-07 15:29:55 +09:00
4 changed files with 661 additions and 191 deletions

View File

@ -1,21 +1,14 @@
# gnuboard5-activitypub
ActivityPub implementation for GNUBOARD 5
GNUBOARD5-ActivityPub: ActivityPub (Fediverse) implementation for GNUBOARD5
## References
* https://www.w3.org/TR/activitypub/
* https://www.w3.org/TR/activitystreams-core/
* https://www.w3.org/TR/activitystreams-vocabulary/
* https://github.com/w3c/activitypub/issues/194
* https://docs.joinmastodon.org/spec/webfinger/
* https://organicdesign.nz/ActivityPub_Code
* https://socialhub.activitypub.rocks/t/posting-to-pleroma-inbox/1184
* https://github.com/broidHQ/integrations/tree/master/broid-schemas#readme
* https://sir.kr/g5_plugin/10381
* https://codeberg.org/fediverse/delightful-activitypub-development
## 사용 전 설정
* `apstreams` 게시판 추가
* `apstreams` 사용자 추가
## 작업진행
## 지원현황
- [x] WebFinger
- [x] User
- [x] Inbox
@ -23,14 +16,24 @@ ActivityPub implementation for GNUBOARD 5
- [x] Followers
- [x] Following
- [x] Liked
- [x] (Added) Geolocation
- [ ] (Added) File attachment
- [ ] ~~Shares~~ (Altered to inbound/outbound)
- [x] Geolocation
- [x] File attachment
- [ ] File attachment - Automatically download a remote file to the local server
- [x] Digest/Signature - Outbound
- [ ] ~~Digest/Signature - Inbound~~ (No required)
- [x] w3id.org (e.g. the `publicKey` field of an actor)
- [ ] OAuth 2.0
- [ ] Message Queue Compatible (e.g. Redis, RebbitMQ, Kafka)
## 부가기능 (옵션)
- [x] 아바타 (gravatar.com)
- [x] 날씨 (openweathermap.org)
- [x] 환율 (koreaexim.go.kr)
- [x] 국내 Geolocation (Naver Cloud)
- [x] 국외 Geolocation (IP2Location)
## 전문 예시
## 전문(메시지) 예시
```json
{
@ -108,5 +111,21 @@ ActivityPub implementation for GNUBOARD 5
}
```
## References
* https://www.w3.org/TR/activitypub/
* https://www.w3.org/TR/activitystreams-core/
* https://www.w3.org/TR/activitystreams-vocabulary/
* https://github.com/w3c/activitypub/issues/194
* https://docs.joinmastodon.org/spec/webfinger/
* https://organicdesign.nz/ActivityPub_Code
* https://socialhub.activitypub.rocks/t/posting-to-pleroma-inbox/1184
* https://github.com/broidHQ/integrations/tree/master/broid-schemas#readme
* https://github.com/autogestion/pubgate-telegram
* https://docs.joinmastodon.org/spec/security/
* https://chat.openai.com/share/4fda7974-cc0b-439a-b0f2-dc828f8acfef
* https://codeberg.org/mro/activitypub/src/commit/4b1319d5363f4a836f23c784ef780b81bc674013/like.sh#L101
* https://socialhub.activitypub.rocks/t/problems-posting-to-mastodon-inbox/801/10
## 문의
* gnh1201@gmail.com
* abuse@catswords.net
* ActivityPub [@gnh1201@catswords.social](https://catswords.social/@gnh1201)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,112 @@
<?php
// GhatGPT-ActivityPub implementation for GNUBOARD 5
// Go Namhyeon <abuse@catswords.net>
// MIT License
// 2023-02-16
if (!defined('_GNUBOARD_') || !defined("ACTIVITYPUB_INSTANCE_ID")) exit; // 개별 페이지 접근 불가
// ChatGPT API 키 발급: https://platform.openai.com/account/api-keys
define("CHATGPT_API_KEY", "YOUR_API_KEY"); // API 키 입력
define("CHATGPT_API_URL", "https://api.openai.com/v1/completions"); // GhatGPT API 주소 입력
define("LINGVA_API_URL", "https://lingva.ml/api/v1"); // Lingva Translate (구글 번역기 프론트엔드) API 주소 입력
function lingva_translate($content, $source = 'ko', $target = 'en') {
$handle = curl_init();
curl_setopt($handle, CURLOPT_URL, LINGVA_API_URL . '/' . $source . '/' . $target . '/' . urlencode($content));
curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false);
$response = json_decode(curl_exec($handle), true);
curl_close($handle);
return $response['translation'];
}
function lingva_ko2en($content) {
return lingva_translate($content, 'ko', 'en');
}
function lingva_en2ko($content) {
return lingva_translate($content, 'en', 'ko');
}
function chatgpt_request($content, $mb) {
// "What is the capital of France?"
$prompt = lingva_ko2en(filter_var($content, FILTER_SANITIZE_STRING));
$prompt = filter_var($content, FILTER_SANITIZE_STRING);
$data = array(
"model" => "text-davinci-003",
"prompt" => $prompt,
"max_tokens" => 3000,
"temperature" => 0.5,
);
$data_string = json_encode($data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, CHATGPT_API_URL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type: application/json",
"Authorization: Bearer " . CHATGPT_API_KEY,
"Content-Length: " . strlen($data_string))
);
$output = curl_exec($ch);
curl_close($ch);
// print_r($output);
$output_json = json_decode($output, true);
$response = $output_json["choices"][0]["text"];
// echo $response;
return lingva_en2ko($response);
}
function chatgpt_send_conversation($content) {
global $member;
// 로그인 상태인 경우 해당 회원, 아닌 경우 ActivityPub 공통 계정
$mb = isset($member['mb_id']) ? $member : get_member(ACTIVITYPUB_G5_USERNAME);
// 수신자 목록
$to = array();
// 참고: 아래에 기술된 역할은 외부 프로그램이 담당하게 할 수도 있음 (service:chatgpt)
if (!empty(CHATGPT_API_KEY)) {
$response = chatgpt_request($content, $mb);
$to[] = "service:chatgpt";
}
// Activity 발행 (발신: 그누보드5 -> ChatGPT)
activitypub_publish_content(
$content,
activitypub_get_url("user", array("mb_id" => $mb['mb_id'])),
get_member(ACTIVITYPUB_G5_USERNAME),
array(),
$to
);
// Activity 발행 (수신: ChatGPT -> 그누보드5)
activitypub_publish_content(
$response,
"service:chatgpt",
get_member(ACTIVITYPUB_G5_USERNAME),
array(),
array(
activitypub_get_url("user", array("mb_id" => $mb['mb_id']))
)
);
}
function _chatgpt_memo_form_update_after($member_list, $str_nick_list, $redirect_url, $me_memo) {
// 수신자에 'apstreams' 계정이 있는지 확인
if (!in_array(ACTIVITYPUB_G5_USERNAME, $member_list['id'])) return;
// ChatGPT에게 대화 걸기
chatgpt_send_conversation($me_memo);
}
add_event("memo_form_update_after", "_chatgpt_memo_form_update_after", 1, 4);

View File

@ -2,7 +2,7 @@
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// ActivityPub/WebHook implementation for GNUBOARD 5
// Go Namhyeon <gnh1201@gmail.com>
// Go Namhyeon <abuse@catswords.net>
// MIT License
// 2022-07-07
@ -17,8 +17,8 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
if (!defined("ACTIVITYPUB_INSTANCE_ID")) return;
define("NATEON_WEBHOOK_URL", "");
define("DISCORD_WEBHOOK_URL", "https://discord.com/api/webhooks/994470705125134347/ZQUe-LZYDED6MVFSIJb5A_u0kin2hyI26c_LP5lcFje3DpmeVF1AvLB7ap0wFjNrTmNN");
define("SLACK_WEBHOOK_URL", "https://hooks.slack.com/services/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");
define("DISCORD_WEBHOOK_URL", "");
define("SLACK_WEBHOOK_URL", "");
define("SLACK_WEBHOOK_CHANNEL", "#webhook");
function nateon_send_webhook($content, $mb) {