Commit
·
e04cf41
1
Parent(s):
31d882e
⚗️
Browse files- package-lock.json +120 -1
- package.json +32 -31
- server.ts +32 -1
package-lock.json
CHANGED
|
@@ -15,7 +15,8 @@
|
|
| 15 |
"koa-compress": "^5.1.0",
|
| 16 |
"koa-morgan": "^1.0.1",
|
| 17 |
"koa-router": "^12.0.0",
|
| 18 |
-
"prettier": "^2.8.2"
|
|
|
|
| 19 |
},
|
| 20 |
"devDependencies": {
|
| 21 |
"@types/koa": "^2.13.5",
|
|
@@ -281,6 +282,17 @@
|
|
| 281 |
"@types/node": "*"
|
| 282 |
}
|
| 283 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 284 |
"node_modules/accepts": {
|
| 285 |
"version": "1.3.8",
|
| 286 |
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
|
@@ -519,6 +531,14 @@
|
|
| 519 |
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
| 520 |
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
|
| 521 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 522 |
"node_modules/fresh": {
|
| 523 |
"version": "0.5.2",
|
| 524 |
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
|
|
@@ -893,6 +913,25 @@
|
|
| 893 |
"node": ">= 0.6"
|
| 894 |
}
|
| 895 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 896 |
"node_modules/object-inspect": {
|
| 897 |
"version": "1.12.2",
|
| 898 |
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz",
|
|
@@ -1061,6 +1100,11 @@
|
|
| 1061 |
"node": ">=0.6"
|
| 1062 |
}
|
| 1063 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1064 |
"node_modules/ts-node": {
|
| 1065 |
"version": "10.9.1",
|
| 1066 |
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
|
|
@@ -1112,6 +1156,18 @@
|
|
| 1112 |
"node": ">=0.6.x"
|
| 1113 |
}
|
| 1114 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1115 |
"node_modules/type-is": {
|
| 1116 |
"version": "1.6.18",
|
| 1117 |
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
|
@@ -1159,6 +1215,20 @@
|
|
| 1159 |
"node": ">= 0.8"
|
| 1160 |
}
|
| 1161 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1162 |
"node_modules/ylru": {
|
| 1163 |
"version": "1.3.2",
|
| 1164 |
"resolved": "https://registry.npmjs.org/ylru/-/ylru-1.3.2.tgz",
|
|
@@ -1426,6 +1496,14 @@
|
|
| 1426 |
"@types/node": "*"
|
| 1427 |
}
|
| 1428 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1429 |
"accepts": {
|
| 1430 |
"version": "1.3.8",
|
| 1431 |
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
|
@@ -1602,6 +1680,11 @@
|
|
| 1602 |
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
| 1603 |
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
|
| 1604 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1605 |
"fresh": {
|
| 1606 |
"version": "0.5.2",
|
| 1607 |
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
|
|
@@ -1894,6 +1977,14 @@
|
|
| 1894 |
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
|
| 1895 |
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg=="
|
| 1896 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1897 |
"object-inspect": {
|
| 1898 |
"version": "1.12.2",
|
| 1899 |
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz",
|
|
@@ -2005,6 +2096,11 @@
|
|
| 2005 |
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
| 2006 |
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA=="
|
| 2007 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2008 |
"ts-node": {
|
| 2009 |
"version": "10.9.1",
|
| 2010 |
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
|
|
@@ -2031,6 +2127,15 @@
|
|
| 2031 |
"resolved": "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.6.tgz",
|
| 2032 |
"integrity": "sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA=="
|
| 2033 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2034 |
"type-is": {
|
| 2035 |
"version": "1.6.18",
|
| 2036 |
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
|
@@ -2062,6 +2167,20 @@
|
|
| 2062 |
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
| 2063 |
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg=="
|
| 2064 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2065 |
"ylru": {
|
| 2066 |
"version": "1.3.2",
|
| 2067 |
"resolved": "https://registry.npmjs.org/ylru/-/ylru-1.3.2.tgz",
|
|
|
|
| 15 |
"koa-compress": "^5.1.0",
|
| 16 |
"koa-morgan": "^1.0.1",
|
| 17 |
"koa-router": "^12.0.0",
|
| 18 |
+
"prettier": "^2.8.2",
|
| 19 |
+
"twitter-api-sdk": "^1.2.1"
|
| 20 |
},
|
| 21 |
"devDependencies": {
|
| 22 |
"@types/koa": "^2.13.5",
|
|
|
|
| 282 |
"@types/node": "*"
|
| 283 |
}
|
| 284 |
},
|
| 285 |
+
"node_modules/abort-controller": {
|
| 286 |
+
"version": "3.0.0",
|
| 287 |
+
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
|
| 288 |
+
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
|
| 289 |
+
"dependencies": {
|
| 290 |
+
"event-target-shim": "^5.0.0"
|
| 291 |
+
},
|
| 292 |
+
"engines": {
|
| 293 |
+
"node": ">=6.5"
|
| 294 |
+
}
|
| 295 |
+
},
|
| 296 |
"node_modules/accepts": {
|
| 297 |
"version": "1.3.8",
|
| 298 |
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
|
|
|
| 531 |
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
| 532 |
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
|
| 533 |
},
|
| 534 |
+
"node_modules/event-target-shim": {
|
| 535 |
+
"version": "5.0.1",
|
| 536 |
+
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
|
| 537 |
+
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
|
| 538 |
+
"engines": {
|
| 539 |
+
"node": ">=6"
|
| 540 |
+
}
|
| 541 |
+
},
|
| 542 |
"node_modules/fresh": {
|
| 543 |
"version": "0.5.2",
|
| 544 |
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
|
|
|
|
| 913 |
"node": ">= 0.6"
|
| 914 |
}
|
| 915 |
},
|
| 916 |
+
"node_modules/node-fetch": {
|
| 917 |
+
"version": "2.6.7",
|
| 918 |
+
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
|
| 919 |
+
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
|
| 920 |
+
"dependencies": {
|
| 921 |
+
"whatwg-url": "^5.0.0"
|
| 922 |
+
},
|
| 923 |
+
"engines": {
|
| 924 |
+
"node": "4.x || >=6.0.0"
|
| 925 |
+
},
|
| 926 |
+
"peerDependencies": {
|
| 927 |
+
"encoding": "^0.1.0"
|
| 928 |
+
},
|
| 929 |
+
"peerDependenciesMeta": {
|
| 930 |
+
"encoding": {
|
| 931 |
+
"optional": true
|
| 932 |
+
}
|
| 933 |
+
}
|
| 934 |
+
},
|
| 935 |
"node_modules/object-inspect": {
|
| 936 |
"version": "1.12.2",
|
| 937 |
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz",
|
|
|
|
| 1100 |
"node": ">=0.6"
|
| 1101 |
}
|
| 1102 |
},
|
| 1103 |
+
"node_modules/tr46": {
|
| 1104 |
+
"version": "0.0.3",
|
| 1105 |
+
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
| 1106 |
+
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
|
| 1107 |
+
},
|
| 1108 |
"node_modules/ts-node": {
|
| 1109 |
"version": "10.9.1",
|
| 1110 |
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
|
|
|
|
| 1156 |
"node": ">=0.6.x"
|
| 1157 |
}
|
| 1158 |
},
|
| 1159 |
+
"node_modules/twitter-api-sdk": {
|
| 1160 |
+
"version": "1.2.1",
|
| 1161 |
+
"resolved": "https://registry.npmjs.org/twitter-api-sdk/-/twitter-api-sdk-1.2.1.tgz",
|
| 1162 |
+
"integrity": "sha512-tNQ6DGYucFk94JlnUMsHCkHg5o1wnCdHh71Y2ukygNVssOdD1gNVjOpaojJrdwbEAhoZvcWdGHerCa55F8HKxQ==",
|
| 1163 |
+
"dependencies": {
|
| 1164 |
+
"abort-controller": "^3.0.0",
|
| 1165 |
+
"node-fetch": "^2.6.1"
|
| 1166 |
+
},
|
| 1167 |
+
"engines": {
|
| 1168 |
+
"node": ">=14"
|
| 1169 |
+
}
|
| 1170 |
+
},
|
| 1171 |
"node_modules/type-is": {
|
| 1172 |
"version": "1.6.18",
|
| 1173 |
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
|
|
|
| 1215 |
"node": ">= 0.8"
|
| 1216 |
}
|
| 1217 |
},
|
| 1218 |
+
"node_modules/webidl-conversions": {
|
| 1219 |
+
"version": "3.0.1",
|
| 1220 |
+
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
| 1221 |
+
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
|
| 1222 |
+
},
|
| 1223 |
+
"node_modules/whatwg-url": {
|
| 1224 |
+
"version": "5.0.0",
|
| 1225 |
+
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
| 1226 |
+
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
|
| 1227 |
+
"dependencies": {
|
| 1228 |
+
"tr46": "~0.0.3",
|
| 1229 |
+
"webidl-conversions": "^3.0.0"
|
| 1230 |
+
}
|
| 1231 |
+
},
|
| 1232 |
"node_modules/ylru": {
|
| 1233 |
"version": "1.3.2",
|
| 1234 |
"resolved": "https://registry.npmjs.org/ylru/-/ylru-1.3.2.tgz",
|
|
|
|
| 1496 |
"@types/node": "*"
|
| 1497 |
}
|
| 1498 |
},
|
| 1499 |
+
"abort-controller": {
|
| 1500 |
+
"version": "3.0.0",
|
| 1501 |
+
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
|
| 1502 |
+
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
|
| 1503 |
+
"requires": {
|
| 1504 |
+
"event-target-shim": "^5.0.0"
|
| 1505 |
+
}
|
| 1506 |
+
},
|
| 1507 |
"accepts": {
|
| 1508 |
"version": "1.3.8",
|
| 1509 |
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
|
|
|
| 1680 |
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
| 1681 |
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
|
| 1682 |
},
|
| 1683 |
+
"event-target-shim": {
|
| 1684 |
+
"version": "5.0.1",
|
| 1685 |
+
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
|
| 1686 |
+
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ=="
|
| 1687 |
+
},
|
| 1688 |
"fresh": {
|
| 1689 |
"version": "0.5.2",
|
| 1690 |
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
|
|
|
|
| 1977 |
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
|
| 1978 |
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg=="
|
| 1979 |
},
|
| 1980 |
+
"node-fetch": {
|
| 1981 |
+
"version": "2.6.7",
|
| 1982 |
+
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
|
| 1983 |
+
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
|
| 1984 |
+
"requires": {
|
| 1985 |
+
"whatwg-url": "^5.0.0"
|
| 1986 |
+
}
|
| 1987 |
+
},
|
| 1988 |
"object-inspect": {
|
| 1989 |
"version": "1.12.2",
|
| 1990 |
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz",
|
|
|
|
| 2096 |
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
| 2097 |
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA=="
|
| 2098 |
},
|
| 2099 |
+
"tr46": {
|
| 2100 |
+
"version": "0.0.3",
|
| 2101 |
+
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
| 2102 |
+
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
|
| 2103 |
+
},
|
| 2104 |
"ts-node": {
|
| 2105 |
"version": "10.9.1",
|
| 2106 |
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
|
|
|
|
| 2127 |
"resolved": "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.6.tgz",
|
| 2128 |
"integrity": "sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA=="
|
| 2129 |
},
|
| 2130 |
+
"twitter-api-sdk": {
|
| 2131 |
+
"version": "1.2.1",
|
| 2132 |
+
"resolved": "https://registry.npmjs.org/twitter-api-sdk/-/twitter-api-sdk-1.2.1.tgz",
|
| 2133 |
+
"integrity": "sha512-tNQ6DGYucFk94JlnUMsHCkHg5o1wnCdHh71Y2ukygNVssOdD1gNVjOpaojJrdwbEAhoZvcWdGHerCa55F8HKxQ==",
|
| 2134 |
+
"requires": {
|
| 2135 |
+
"abort-controller": "^3.0.0",
|
| 2136 |
+
"node-fetch": "^2.6.1"
|
| 2137 |
+
}
|
| 2138 |
+
},
|
| 2139 |
"type-is": {
|
| 2140 |
"version": "1.6.18",
|
| 2141 |
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
|
|
|
| 2167 |
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
| 2168 |
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg=="
|
| 2169 |
},
|
| 2170 |
+
"webidl-conversions": {
|
| 2171 |
+
"version": "3.0.1",
|
| 2172 |
+
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
| 2173 |
+
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
|
| 2174 |
+
},
|
| 2175 |
+
"whatwg-url": {
|
| 2176 |
+
"version": "5.0.0",
|
| 2177 |
+
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
| 2178 |
+
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
|
| 2179 |
+
"requires": {
|
| 2180 |
+
"tr46": "~0.0.3",
|
| 2181 |
+
"webidl-conversions": "^3.0.0"
|
| 2182 |
+
}
|
| 2183 |
+
},
|
| 2184 |
"ylru": {
|
| 2185 |
"version": "1.3.2",
|
| 2186 |
"resolved": "https://registry.npmjs.org/ylru/-/ylru-1.3.2.tgz",
|
package.json
CHANGED
|
@@ -1,33 +1,34 @@
|
|
| 1 |
{
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
|
|
|
| 33 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"name": "twitter-alt-image-bot",
|
| 3 |
+
"version": "1.0.0",
|
| 4 |
+
"description": "Twitter bot to generate alt text for images",
|
| 5 |
+
"scripts": {
|
| 6 |
+
"start": "ts-node -T server.ts",
|
| 7 |
+
"test": "echo \"Error: no test specified\" && exit 1"
|
| 8 |
+
},
|
| 9 |
+
"repository": {
|
| 10 |
+
"type": "git",
|
| 11 |
+
"url": "https://huggingface.co/spaces/huggingface-projects/twitter-alt-image-bot"
|
| 12 |
+
},
|
| 13 |
+
"author": "",
|
| 14 |
+
"license": "MIT",
|
| 15 |
+
"devDependencies": {
|
| 16 |
+
"@types/koa": "^2.13.5",
|
| 17 |
+
"@types/koa-bodyparser": "^4.3.10",
|
| 18 |
+
"@types/koa-compress": "^4.0.3",
|
| 19 |
+
"@types/koa-morgan": "^1.0.5",
|
| 20 |
+
"@types/koa-router": "^7.4.4",
|
| 21 |
+
"ts-node": "^10.9.1",
|
| 22 |
+
"typescript": "^4.9.4"
|
| 23 |
+
},
|
| 24 |
+
"dependencies": {
|
| 25 |
+
"dotenv": "^16.0.3",
|
| 26 |
+
"koa": "^2.14.1",
|
| 27 |
+
"koa-bodyparser": "^4.3.0",
|
| 28 |
+
"koa-compress": "^5.1.0",
|
| 29 |
+
"koa-morgan": "^1.0.1",
|
| 30 |
+
"koa-router": "^12.0.0",
|
| 31 |
+
"prettier": "^2.8.2",
|
| 32 |
+
"twitter-api-sdk": "^1.2.1"
|
| 33 |
+
}
|
| 34 |
}
|
server.ts
CHANGED
|
@@ -3,6 +3,7 @@ import bodyParser from "koa-bodyparser";
|
|
| 3 |
import compression from "koa-compress";
|
| 4 |
import morgan from "koa-morgan";
|
| 5 |
import Router from "koa-router";
|
|
|
|
| 6 |
import "dotenv/config";
|
| 7 |
|
| 8 |
const port = 7860;
|
|
@@ -13,13 +14,41 @@ app.use(morgan("dev"));
|
|
| 13 |
app.use(compression());
|
| 14 |
app.use(bodyParser());
|
| 15 |
|
| 16 |
-
const { API_KEY, API_SECRET, BEARER_TOKEN } = process.env;
|
| 17 |
|
| 18 |
const router = new Router();
|
| 19 |
|
| 20 |
app.use(router.routes());
|
| 21 |
app.use(router.allowedMethods());
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
async function listen() {
|
| 24 |
try {
|
| 25 |
const promise = new Promise<void>((resolve, reject) => {
|
|
@@ -42,3 +71,5 @@ listen();
|
|
| 42 |
process.on("unhandledRejection", async (err) => {
|
| 43 |
console.error("unhandled rejection", err);
|
| 44 |
});
|
|
|
|
|
|
|
|
|
| 3 |
import compression from "koa-compress";
|
| 4 |
import morgan from "koa-morgan";
|
| 5 |
import Router from "koa-router";
|
| 6 |
+
import { inspect } from "util";
|
| 7 |
import "dotenv/config";
|
| 8 |
|
| 9 |
const port = 7860;
|
|
|
|
| 14 |
app.use(compression());
|
| 15 |
app.use(bodyParser());
|
| 16 |
|
| 17 |
+
const { API_KEY, API_SECRET, BEARER_TOKEN, CLIENT_ID, CLIENT_SECRET } = process.env;
|
| 18 |
|
| 19 |
const router = new Router();
|
| 20 |
|
| 21 |
app.use(router.routes());
|
| 22 |
app.use(router.allowedMethods());
|
| 23 |
|
| 24 |
+
//Import package
|
| 25 |
+
import { Client, auth } from "twitter-api-sdk";
|
| 26 |
+
|
| 27 |
+
// Initialize auth client first
|
| 28 |
+
const authClient = new auth.OAuth2User({
|
| 29 |
+
client_id: CLIENT_ID as string,
|
| 30 |
+
client_secret: CLIENT_SECRET as string,
|
| 31 |
+
callback: "https://huggingface-projects-twitter-image-alt-bot.hf.space/callback",
|
| 32 |
+
scopes: ["tweet.read", "users.read", "offline.access"],
|
| 33 |
+
});
|
| 34 |
+
|
| 35 |
+
// Pass auth credentials to the library client
|
| 36 |
+
const twitterClient = new Client(authClient);
|
| 37 |
+
|
| 38 |
+
const BOT_NAME = "coyotte508";
|
| 39 |
+
|
| 40 |
+
function debug(stuff: any) {
|
| 41 |
+
console.log(inspect(stuff, { depth: 20 }));
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
async function lookupTweets() {
|
| 45 |
+
const resp = await fetch(`https://api.twitter.com/2/users/${BOT_NAME}/mentions`, {
|
| 46 |
+
headers: { Authorization: `Bearer ${BEARER_TOKEN}` },
|
| 47 |
+
});
|
| 48 |
+
|
| 49 |
+
debug(await resp.json());
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
async function listen() {
|
| 53 |
try {
|
| 54 |
const promise = new Promise<void>((resolve, reject) => {
|
|
|
|
| 71 |
process.on("unhandledRejection", async (err) => {
|
| 72 |
console.error("unhandled rejection", err);
|
| 73 |
});
|
| 74 |
+
|
| 75 |
+
lookupTweets();
|