Skip to content
This repository was archived by the owner on Nov 10, 2021. It is now read-only.

Commit ec0e04c

Browse files
author
hicetnunc2000
committed
bans
1 parent 73c8786 commit ec0e04c

File tree

4 files changed

+49
-26
lines changed

4 files changed

+49
-26
lines changed

.serverless/cloudformation-template-update-stack.json

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
"S3Bucket": {
147147
"Ref": "ServerlessDeploymentBucket"
148148
},
149-
"S3Key": "serverless/hicetnunc-apiv2/dev/1616044842570-2021-03-18T05:20:42.570Z/hicetnunc-apiv2.zip"
149+
"S3Key": "serverless/hicetnunc-apiv2/dev/1616132797292-2021-03-19T05:46:37.292Z/hicetnunc-apiv2.zip"
150150
},
151151
"FunctionName": "hicetnunc-apiv2-dev-handler",
152152
"Handler": "index.handler",
@@ -158,20 +158,26 @@
158158
]
159159
},
160160
"Runtime": "nodejs12.x",
161-
"Timeout": 120
161+
"Timeout": 120,
162+
"Environment": {
163+
"Variables": {
164+
"TIMESTAMP": "",
165+
"BUFFER": ""
166+
}
167+
}
162168
},
163169
"DependsOn": [
164170
"HandlerLogGroup"
165171
]
166172
},
167-
"HandlerLambdaVersionBQ36OgfBcIfPgSb706UIr9lOrJOtZ0Z0CUitLzdpqA": {
173+
"HandlerLambdaVersionl43NXxTCsqpysRMWyXSvU0lsarIv6k41EVMGBVAAAI": {
168174
"Type": "AWS::Lambda::Version",
169175
"DeletionPolicy": "Retain",
170176
"Properties": {
171177
"FunctionName": {
172178
"Ref": "HandlerLambdaFunction"
173179
},
174-
"CodeSha256": "XzPgs+74v32jD1VtT3EQIuiguzI/+h1FI5G32MCoFNc="
180+
"CodeSha256": "yP30UhwdABdpM1UtDvnZ21GW5zg9jII05figW7uS74k="
175181
}
176182
},
177183
"ApiGatewayRestApi": {
@@ -383,7 +389,7 @@
383389
"MethodResponses": []
384390
}
385391
},
386-
"ApiGatewayDeployment1616044838303": {
392+
"ApiGatewayDeployment1616132791720": {
387393
"Type": "AWS::ApiGateway::Deployment",
388394
"Properties": {
389395
"RestApiId": {
@@ -445,7 +451,7 @@
445451
"HandlerLambdaFunctionQualifiedArn": {
446452
"Description": "Current Lambda function version",
447453
"Value": {
448-
"Ref": "HandlerLambdaVersionBQ36OgfBcIfPgSb706UIr9lOrJOtZ0Z0CUitLzdpqA"
454+
"Ref": "HandlerLambdaVersionl43NXxTCsqpysRMWyXSvU0lsarIv6k41EVMGBVAAAI"
449455
}
450456
},
451457
"ServiceEndpoint": {

.serverless/hicetnunc-apiv2.zip

1.04 KB
Binary file not shown.

.serverless/serverless-state.json

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
"runtime": "nodejs12.x",
1212
"region": "us-east-1",
1313
"versionFunctions": true,
14+
"environment": {
15+
"TIMESTAMP": "",
16+
"BUFFER": ""
17+
},
1418
"compiledCloudFormationTemplate": {
1519
"AWSTemplateFormatVersion": "2010-09-09",
1620
"Description": "The AWS CloudFormation template for this Serverless application",
@@ -159,7 +163,7 @@
159163
"S3Bucket": {
160164
"Ref": "ServerlessDeploymentBucket"
161165
},
162-
"S3Key": "serverless/hicetnunc-apiv2/dev/1616044842570-2021-03-18T05:20:42.570Z/hicetnunc-apiv2.zip"
166+
"S3Key": "serverless/hicetnunc-apiv2/dev/1616132797292-2021-03-19T05:46:37.292Z/hicetnunc-apiv2.zip"
163167
},
164168
"FunctionName": "hicetnunc-apiv2-dev-handler",
165169
"Handler": "index.handler",
@@ -171,20 +175,26 @@
171175
]
172176
},
173177
"Runtime": "nodejs12.x",
174-
"Timeout": 120
178+
"Timeout": 120,
179+
"Environment": {
180+
"Variables": {
181+
"TIMESTAMP": "",
182+
"BUFFER": ""
183+
}
184+
}
175185
},
176186
"DependsOn": [
177187
"HandlerLogGroup"
178188
]
179189
},
180-
"HandlerLambdaVersionBQ36OgfBcIfPgSb706UIr9lOrJOtZ0Z0CUitLzdpqA": {
190+
"HandlerLambdaVersionl43NXxTCsqpysRMWyXSvU0lsarIv6k41EVMGBVAAAI": {
181191
"Type": "AWS::Lambda::Version",
182192
"DeletionPolicy": "Retain",
183193
"Properties": {
184194
"FunctionName": {
185195
"Ref": "HandlerLambdaFunction"
186196
},
187-
"CodeSha256": "XzPgs+74v32jD1VtT3EQIuiguzI/+h1FI5G32MCoFNc="
197+
"CodeSha256": "yP30UhwdABdpM1UtDvnZ21GW5zg9jII05figW7uS74k="
188198
}
189199
},
190200
"ApiGatewayRestApi": {
@@ -396,7 +406,7 @@
396406
"MethodResponses": []
397407
}
398408
},
399-
"ApiGatewayDeployment1616044838303": {
409+
"ApiGatewayDeployment1616132791720": {
400410
"Type": "AWS::ApiGateway::Deployment",
401411
"Properties": {
402412
"RestApiId": {
@@ -458,7 +468,7 @@
458468
"HandlerLambdaFunctionQualifiedArn": {
459469
"Description": "Current Lambda function version",
460470
"Value": {
461-
"Ref": "HandlerLambdaVersionBQ36OgfBcIfPgSb706UIr9lOrJOtZ0Z0CUitLzdpqA"
471+
"Ref": "HandlerLambdaVersionl43NXxTCsqpysRMWyXSvU0lsarIv6k41EVMGBVAAAI"
462472
}
463473
},
464474
"ServiceEndpoint": {
@@ -556,7 +566,8 @@
556566
"vpc": {}
557567
},
558568
"plugins": [
559-
"serverless-plugin-include-dependencies"
569+
"serverless-plugin-include-dependencies",
570+
"serverless-dotenv-plugin"
560571
],
561572
"pluginsData": {},
562573
"functions": {
@@ -616,7 +627,7 @@
616627
"memory": 1024,
617628
"runtime": "nodejs12.x",
618629
"vpc": {},
619-
"versionLogicalId": "HandlerLambdaVersionBQ36OgfBcIfPgSb706UIr9lOrJOtZ0Z0CUitLzdpqA"
630+
"versionLogicalId": "HandlerLambdaVersionl43NXxTCsqpysRMWyXSvU0lsarIv6k41EVMGBVAAAI"
620631
}
621632
},
622633
"configValidationMode": "warn",
@@ -2546,7 +2557,7 @@
25462557
"node_modules/@types/aws-lambda/trigger/sqs.d.ts"
25472558
],
25482559
"artifact": "/home/crzy/Desktop/programs/lambdas-aws/api-final/new2/hicetnunc-api/.serverless/hicetnunc-apiv2.zip",
2549-
"artifactDirectoryName": "serverless/hicetnunc-apiv2/dev/1616044842570-2021-03-18T05:20:42.570Z"
2560+
"artifactDirectoryName": "serverless/hicetnunc-apiv2/dev/1616132797292-2021-03-19T05:46:37.292Z"
25502561
},
25512562
"plugins": {
25522563
"$ref": "$[\"service\"][\"plugins\"]"
@@ -2563,7 +2574,7 @@
25632574
"artifact": "/home/crzy/Desktop/programs/lambdas-aws/api-final/new2/hicetnunc-api/.serverless/hicetnunc-apiv2.zip"
25642575
},
25652576
"package": {
2566-
"artifactDirectoryName": "serverless/hicetnunc-apiv2/dev/1616044842570-2021-03-18T05:20:42.570Z",
2577+
"artifactDirectoryName": "serverless/hicetnunc-apiv2/dev/1616132797292-2021-03-19T05:46:37.292Z",
25672578
"artifact": "hicetnunc-apiv2.zip"
25682579
}
25692580
}

index.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ const getTokenHoldersArr = async (arr) => {
3535
return await arr.map(async e => await axios.get('https://api.better-call.dev/v1/contract/mainnet/KT1RJ6PbjHpwc3M5rw5s2Nbmefwbuwbdxton/tokens/holders?token_id=' + e).then(res => res.data))
3636
/* await axios.get('https://api.better-call.dev/v1/contract/mainnet/KT1RJ6PbjHpwc3M5rw5s2Nbmefwbuwbdxton/tokens/holders?token_id=' + arr[0]).then(res => console.log(res.data))
3737
*//* var result = arr.map(async e => {
38-
return await axios.get('https://api.better-call.dev/v1/contract/mainnet/KT1RJ6PbjHpwc3M5rw5s2Nbmefwbuwbdxton/tokens/holders?token_id=' + e).then(res => res.data)
39-
})
38+
return await axios.get('https://api.better-call.dev/v1/contract/mainnet/KT1RJ6PbjHpwc3M5rw5s2Nbmefwbuwbdxton/tokens/holders?token_id=' + e).then(res => res.data)
39+
})
4040
41-
console.log(result) */
41+
console.log(result) */
4242
}
4343

4444
const owners = async (obj) => {
@@ -128,18 +128,18 @@ const filterTz = (data, tz) => _.filter(data, { tz: tz })
128128

129129
const test = async () => console.log(desc(await getObjkts()))
130130

131-
const customFloor = function(value, roundTo) {
131+
const customFloor = function (value, roundTo) {
132132
return Math.floor(value / roundTo) * roundTo;
133133
}
134134

135135
const ONE_MINUTE_MILLIS = 60 * 1000
136136

137137

138138
const getFeed = async (counter, max_time, res) => {
139-
139+
140140
const now_time = Date.now()
141141
const immutable = (typeof max_time !== 'undefined') && (max_time < now_time)
142-
max_time = (typeof max_time !== 'undefined') ? max_time : customFloor(now_time, ONE_MINUTE_MILLIS)
142+
max_time = (typeof max_time !== 'undefined') ? max_time : customFloor(now_time, ONE_MINUTE_MILLIS)
143143

144144
var arr = await conseilUtil.getArtisticUniverse(max_time)
145145

@@ -154,17 +154,17 @@ const getFeed = async (counter, max_time, res) => {
154154
//console.log(feed)
155155
var cache_time
156156
if (immutable) {
157-
cache_time = 60*10
157+
cache_time = 60 * 10
158158
}
159159
else {
160160
cache_time = (int)(((max_time + ONE_MINUTE_MILLIS) - now_time) / 1000)
161161
}
162162
var promise = Promise.all(feed.map(e => e))
163163
promise.then(async (results) => {
164164
var aux_arr = results.map(e => e)
165-
165+
166166
res.set('Cache-Control', `public, max-age=${cache_time}`)
167-
167+
168168
console.log(aux_arr)
169169
res.json({ result: aux_arr })
170170
})
@@ -284,7 +284,13 @@ app.get('/feed', async (req, res) => {
284284

285285
app.post('/tz', async (req, res) => {
286286
console.log(req.body.tz)
287-
await getTzLedger(req.body.tz, res)
287+
var list = await axios.get('https://raw.githubusercontent.com/hicetnunc2000/hicetnunc/main/filters/w.json').then(res => res.data)
288+
289+
list.includes(req.body.tz)
290+
?
291+
res.json({ result: [] })
292+
:
293+
await getTzLedger(req.body.tz, res)
288294

289295
})
290296

0 commit comments

Comments
 (0)