-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathNOTES.txt
More file actions
366 lines (287 loc) · 17.6 KB
/
NOTES.txt
File metadata and controls
366 lines (287 loc) · 17.6 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
.07.2018:
dob - now year/month only
added analysis_use for data
add tokens, token use data, payment data to profile
removed "has_children" and mention of children at top of form
add privacy policy link to person form
04.04.2018:
Upgrade notes:
1) install new HTML::FormHandler (for the Field::Money)
2) update the database to add the payment_override field
register / payments - allow users to pay more than the default
suggest "correct" amount and allow making it bigger
also add concessionary override entry - via multi choice
test /editme!
carton exec perl -Ilib -MAccessSystem::Schema -le'AccessSystem::Schema->connect("dbi:SQLite:test.db")->create_ddl_dir(undef, undef, "sql/", "2.0")'
emvtool -r 1 -p 8477 cap
ssh pi@inside.swindon-makerspace.org -L 0.0.0.0:3001:localhost:3000 -L 0.0.0.0:3002:localhost:3001 -L 8080:192.168.1.1:80
bank ref "SM<membershipnum>"
membership numbers for:
Jess: 0001, James, 0002, Jamie, 0003, Damian, 0004, Steve W, 0005, Rob L, 0006, Steve N, 0007, Amy Axford 0008, James Pattinson, 0009
* CatalystX::Controller::Auth ?
* TODO:
** non-auth form that new members can use to register
*** Creates People entr(y|ies) - one for the main registrant, one for each dependent?
*** Requires you to acknowledge the "responsibility waiver" with link to Guide
*** Creates linked user entr(y|ies) - person has_a user?
*** user_role == default (nonpaying member)
*** collects email, name, date of birth
select written_date, substr(message, 24) as token, people.name from message_log join access_tokens on access_tokens.id = token join people on people.id = access_tokens.person_id where accessible_thing_id='1A9E3D66-E90F-11E5-83C1-1E346D398B53' and message like 'Permission granted to: %' order by written_date;
https://ico.org.uk/for-organisations/data-protection-reform/overview-of-the-gdpr/individuals-rights/the-right-to-be-informed/
Installing new version of config file /etc/dbus-1/system.d/bluetooth.conf ...
Job for bluetooth.service failed. See 'systemctl status bluetooth.service' and 'journalctl -xn' for details.
invoke-rc.d: initscript bluetooth, action "restart" failed.
dpkg: error processing package bluez (--configure):
Errors were encountered while processing:
bluez
E: Sub-process /usr/bin/dpkg returned an error code (1)
Failed to perform requested operation on package. Trying to recover:
Setting up bluez (5.23-2+rpi2) ...
Job for bluetooth.service failed. See 'systemctl status bluetooth.service' and 'journalctl -xn' for details.
invoke-rc.d: initscript bluetooth, action "restart" failed.
dpkg: error processing package bluez (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
bluez
Press Return to continue.
pi@raspberrypi:~/packages $ sudo apt-cache showsrc python-cryptography
Package: python-cryptography
Version: 1.7.1-3~bpo8+1
Build-Depends: debhelper (>= 9), dh-python, python-all-dev, python3-all-dev, python-setuptools, python3-setuptools, python-cffi (>= 0.8), python3-cffi (>= 0.8), python-six (>= 1.4.1), python3-six (>= 1.4.1), libssl-dev, python-cryptography-vectors (>= 0.8.2~), python-cryptography-vectors (<< 0.8.3~), python3-cryptography-vectors (>= 0.8.2~), python3-cryptography-vectors (<< 0.8.3~), python-iso8601, python3-iso8601, python-pytest, python3-pytest, python-pretend, python3-pretend, python-pyasn1, python3-pyasn1, python-enum34, python3-enum34
Package: libjs-jquery python-alabaster python-imagesize python-sphinx sphinx-co\
mmon libjs-sphinxdoc python-cryptography-vectors python-hypothesis python-idna \
python-pyasn1 python3-setuptools python3-pkg-resources python3-six python3-cryp\
tography-vectors python3-hypothesis python3-idna python3-imagesize python3-jinj\
a2 python3-pyasn1 python3-pygments python3-alabaster python3-sphinx python-iso8\
601 python3-iso8601 python-pytest, python3-pytest python-py python3-py
The following NEW packages will be installed:
fonts-font-awesome libssl-dev python-alabaster python-babel
python-babel-localedata python-cryptography-vectors python-enum34
python-hypothesis python-idna python-imagesize python-iso8601 python-pretend
python-pyasn1-modules python-sphinx-rtd-theme python-tz python3-alabaster
python3-babel python3-cryptography-vectors python3-docutils
python3-hypothesis python3-idna python3-imagesize python3-iso8601
python3-jinja2 python3-markupsafe python3-pretend python3-pyasn1
python3-pyasn1-modules python3-pygments python3-roman python3-six
python3-sphinx python3-tz
The following packages will be upgraded:
libjs-jquery libjs-sphinxdoc python-pkg-resources python-py python-pyasn1
python-pytest python-setuptools python-sphinx python3-pkg-resources
python3-py python3-pytest python3-setuptools sphinx-common
13 upgraded, 33 newly installed, 0 to remove and 58 not upgraded.
pi@raspberrypi:~/packages $ sudo apt-cache showsrc python-openssl
Package: pyopenssl
Binary: python-openssl, python-openssl-doc, python3-openssl
Version: 16.0.0-1~bpo8+1
Maintainer: Sandro Tosi <morph@debian.org>
Uploaders: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>
Build-Depends: debhelper (>= 9), python-all, python3-all, dh-python, libssl-dev (>= 0.9.8), openssl, python-sphinx (>= 1.0.7+dfsg), python-setuptools, python3-setuptools, python-cryptography (>= 1.3), python3-cryptography (>= 1.3), python-six, python3-six, python-pytest (>= 2.8.5), python3-pytest (>= 2.8.5), python-cffi, python3-cffi, python-all-dev, python3-all-dev, python-sphinx-rtd-theme
- needs python-openssl installed too.. that one says "arch:any" so it should Just Work?
10.12.2022:
* new membership tiers: https://docs.google.com/document/d/1YbuFwwVMnIjdSh_ZwrWBjttum_nQh5OTOBuiD9Xaf2w/edit#
** database table
- tiers: id, name, description, price, concessions_allowed (yes/no), dont_use (yes/no), restrictions (if any?)
Eg:
1. MemberOfOtherHackspace, '...', 500, no, no, {}
2. Weekend, '...', 1500, yes, no, {'times': [{'from':.., 'to'}, {'from' .. }]}
3. Standard, '...', 2500, yes, no, {}
4. Sponsor, '...', yes, no, {}
5. MensShed, '..', no, yes, {}
# DateTime: 1=Monday, 7=Sunday
{"times": [{"from":"6:00:00","to":"7:23:59"},{"from":"3:18:30","to":"3:23:59"}]}
- person
** remove member_of_another_hackspace
** add tier_id, default to 3
** add prefered door_colour !
** dont forget to upgrade existing members!
- is mostly: make sure member_of_another_hackspace folks get tier 1 set
- repeat for concession_rate_override = 'mensshed'
** DB update:
** sqlite
INSERT INTO "people_temp_alter"( "id", "parent_id", "name", "email", "opt_in", "dob", "address", "how_found_us", "github_user", "telegram_username", "telegram_chatid", "google_id", "concessionary_rate_override", "payment_override", "voucher_code", "voucher_start", "created_date", "end_date", "tier_id") SELECT "id", "parent_id", "name", "email", "opt_in", "dob", "address", "how_found_us", "github_user", "telegram_username", "telegram_chatid", "google_id", "concessionary_rate_override", "payment_override", "voucher_code", "voucher_start", "created_date", "end_date", CASE WHEN "people".member_of_other_hackspace == 1 THEN 1 WHEN "people".concessionary_rate_override == 'mensshed' THEN 5 ELSE 3 END tier_id FROM "people";
** pg:
ALTER TABLE people ADD COLUMN tier_id integer DEFAULT 0 NOT NULL;
UPDATE people SET tier_id = 1 WHERE member_of_other_hackspace = 1;
UPDATE people SET tier_id = 5 WHERE concessionary_rate_override = 'mensshed';
ALTER TABLE people DROP COLUMN member_of_other_hackspace;
** tiers:
INSERT INTO tiers (name, description, price, in_use, concessions_allowed) values ('MemberOfOtherHackspace', 'Living outside of Swindon Borough and a fully paid up member of another Maker or Hackspace', 500, 1, 0);
INSERT INTO tiers (name, description, price, restrictions, in_use) values ('Weekend', 'Access 12:00am Saturday until 12:00am Monday, and Wednesdays 6:30pm to 11:59pm only', 1500, '{"times":[{"from":"3:18:00","to":"3:23:59"},{"from":"6:00:01","to":"6:23:59"},{"from":"7:00:01","to":7:23:59"}]}', 1);
INSERT INTO tiers (name, description, price, in_use) values ('Standard', 'Access 24hours a day, 365 days a year', 2500, 1);
INSERT INTO tiers (name, description, price, in_use) values ('Sponsor', 'Access 24hours a day, 365 days a year', 3500, 1);
INSERT INTO tiers (name, description, price) values ('MensShed', 'Members of Renew only, rate now retired', 1000);
09.03.2023:
Matt's crazy sql abstract "tiers + concessions count" query:
my $sqla = SQL::Abstract->new->plugin('+ExtraClauses');
# my ($query, @bind) = $sqla->select({
# _ => [
# 'tiers.name',
# { -as => [ { -count => '*' }, \'"all"' ] },
# { -as => [
# { -sum => { -cast => [ 'is_concession' => 'int' ] } },
# 'conc'
# ] },
# ],
# from => [
# { -select => {
# _ => [
# 'person.tier_id',
# \q{(person.concessionary_rate_override != '') AS is_concession},
# ],
# from => [
# 'people' => -as => 'person',
# -join => [
# { 'dues' => { -as => 'payment' } },
# on => { 'payment.person_id' => 'person.id' },
# type => 'left'
# ],
# ],
# group_by => 'person.id',
# having => { -op => [
# '>=',
# { -max => 'payment.expires_on_date' },
# { -value => $dtf->format_datetime($now) }, # { -now => [] },
# ] },
# } },
# -as => 'valid_person',
# -join => [
# 'tiers',
# on => { 'tiers.id' => 'valid_person.tier_id' }
# ],
# ],
# group_by => 'tiers.id',
# });
# # print $query, "\n";
# my $tiers = $self->result_source->schema->storage->dbh_do(sub {
# my $dbh = $_[1];
# $dbh->selectall_hashref($query, 'name', {}, @bind)
# });
# #print STDERR Data::Dumper::Dumper($tiers);
# $data->{valid_members} = $tiers;
09.04.2023:
Bot can ban/unban members? (or ban, then unban if/when they attempt to re-join? is there an on-join?)
banChatMember
Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
- chat_id, user_id, until_date, revoke_messages (Pass True to delete all messages from the chat for the user that is being removed. If False, the user will be able to see messages in the group that were sent before the user was removed. Always True for supergroups and channels.)
unbanChatMember chat_id, user_id, only_if_banned
approveChatJoinRequest - chat_id, user_id
declineChatJoinRequest - chat_id, user_id
Types of incoming messages:
chat_join_request ChatJoinRequest
chat: Chat
from: User
user_chat_id: Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 24 hours to send messages until the join request is processed, assuming no other administrator contacted the user.
date: Integer
bio: String
invite_link: ChatInviteLink
Object::Chat:
join_to_send_messages True Optional. True, if users need to join the supergroup before they can send messages. Returned only in getChat.
join_by_request True Optional. True, if all users directly joining the supergroup need to be approved by supergroup administrators. Returned only in getChat.
Hmm no ChatJoinRequest (maybe only if the bot itself made the invite!?)
Instead we get this (message with no text):
Incoming msg: $VAR1 = {
'message' => {
'new_chat_member' => {
'is_bot' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' ),
'id' => 201913669,
'last_name' => 'smith',
'username' => 'colour_limited',
'first_name' => 'josh'
},
'new_chat_members' => [
{
'last_name' => 'smith',
'id' => 201913669,
'is_bot' => $VAR1->{'message'}{'new_chat_member'}{'is_bot'},
'first_name' => 'josh',
'username' => 'colour_limited'
}
],
'new_chat_participant' => {
'username' => 'colour_limited',
'first_name' => 'josh',
'is_bot' => $VAR1->{'message'}{'new_chat_member'}{'is_bot'},
'last_name' => 'smith',
'id' => 201913669
},
'from' => {
'first_name' => 'josh',
'username' => 'colour_limited',
'id' => 201913669,
'last_name' => 'smith',
'is_bot' => $VAR1->{'message'}{'new_chat_member'}{'is_bot'}
},
'date' => 1681051733,
'message_id' => 2,
'chat' => {
'title' => 'SwMakers Bot Testing',
'id' => '-1001809447294',
'type' => 'supergroup'
}
},
'update_id' => 623330505
};
TODO:
* readme/docs for Telegram::Bot::Brain
2023-04-23:
We need an invite link with this set:
*creates_join_request* Boolean True, if users joining the chat via the link need to be approved by chat administrators
ChatInviteLink
Represents an invite link for a chat.
Field Type Description
invite_link String The invite link. If the link was created by another chat administrator, then the second part of the link will be replaced with “…”.
creator User Creator of the link
*creates_join_request* Boolean True, if users joining the chat via the link need to be approved by chat administrators
is_primary Boolean True, if the link is primary
is_revoked Boolean True, if the link is revoked
name String Optional. Invite link name
expire_date Integer Optional. Point in time (Unix timestamp) when the link will expire or has been expired
member_limit Integer Optional. The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999
pending_join_request_count Integer Optional. Number of pending join requests created using this link
12.08.2023:
* admin rights in groups/channels
Bot - setMyCommands (update command list)
Bot - getMyDefaultAdministratorRights (for_channels) returns https://core.telegram.org/bots/api#chatadministratorrights
** getChatMember with chat id, bot id
* https://core.telegram.org/bots/features#chat-and-user-selection
Dec 2023
* emails now using templating (see root/src/emails/)
* TODO: add / fix tests! eg using https://metacpan.org/pod/Email::Sender::Transport::Test
# carton exec script/accesssystem_api_server.pl --port 9001 &
March 2024
my $chat_id = $message->chat->id;
my $chat = $message->_brain->getChat($chat_id);
my $response = '';
say "Chat";
#say Dumper($chat);
say "active_usernames: ". $chat->active_usernames;
say Dumper($chat->active_usernames);
if(!$chat->active_usernames || !@{$chat->active_usernames}) {
return $message->reply("Can't get chat usernames!\n");
}
my $all_members_rs = $self->db->resultset('Person')->search_rs({ telegram_username => { '-in' => $chat->active_usernames } });
# $all_members_rs->result_class('DBIx::Class::ResultClass::HashRefInflator');
# bonus exercise: users in active_usernames who are not in all_members
# my @missing = grep
foreach my $member ($all_members_rs->all) {
if(!$member->is_valid) {
$response .= "\n" . $member->name . " is no longer paid-up.";
} else {
$response .= "\n" . $member->name . " is ok.";
}
}
return $message->reply($response);
.. members_only tidyup .. it appears that "active_members" returns "sod all" even tho its an admin and a supergroup.. so redone this in a different fashion!
insert into allowed (person_id, tool_id, added_on, is_admin) select person_id, '69F67AEC-0277-11EF-9DD6-430397B5F489', current_timestamp, 0 from allowed where tool_id in (select id from tools where name ilike '%blaster%') on conflict do nothing;
July 2024
* oneall https://app.oneall.com/applications/application/providers/?applicationid=527391
* More social networks? Discord needs a "team" and verifications
** https://discord.com/developers/applications/1267148296003125311/verification-onboarding
* facebook / instagram needs an account with a phone number
** https://developers.facebook.com/async/registration/dialog/?src=default
Aug 2024
TelegramBot, sendMessage reply_markup - ForceReply
** working
* /tools - if single item requested (eg /tools laser) - also show status/description
** buggy - with >1 status returns 2 lasers..
** need "most recent status"..