Last major update: 25.08.2020
- Что такое авторизация/аутентификация
- Где хранить токены
- Как ставить куки ?
- Процесс логина
- Процесс рефреш токенов
- Кража токенов/Механизм контроля токенов
| import 'dart:typed_data' show Uint8List; | |
| import 'package:meta/meta.dart' show immutable; | |
| import 'drop_zone_stream_vm.dart' | |
| // ignore: uri_does_not_exist | |
| if (dart.library.js_interop) 'drop_zone_stream_js.dart'; | |
| /// {@template drop_zone_event} | |
| /// Events emitted by the [DropZone] stream. |
| import 'package:doctorina/src/profile/model/profile_data_codecs.dart'; | |
| import 'package:flutter/foundation.dart'; | |
| typedef ProfileId = String; | |
| @immutable | |
| class Profile { | |
| const Profile({ | |
| required this.id, | |
| required this.name, |
| // ignore_for_file: avoid_print | |
| /* | |
| * Date <==> Int conversion | |
| * https://gist.github.com/PlugFox/a94be8655b2adb91336f03bc77513d76 | |
| * https://dartpad.dev?id=a94be8655b2adb91336f03bc77513d76 | |
| * Mike Matiunin <[email protected]>, 20 March 2025 | |
| */ | |
| /// Date extension type |
| // ==UserScript== | |
| // @name Auto Scroll Toggle for comick.io | |
| // @namespace plugfox | |
| // @version 1.3 | |
| // @description Toggle auto scroll on and off with a hotkey, and stop on page blur | |
| // @author @plugfox | |
| // @run-at document-idle | |
| // @homepage https://gist.github.com/PlugFox/7315cad8ef028e2751f4a971ca9d59e9 | |
| // @homepageURL https://gist.github.com/PlugFox/7315cad8ef028e2751f4a971ca9d59e9 | |
| // @match *://comick.io/* |
| import 'dart:convert'; | |
| import 'package:crypto/crypto.dart'; | |
| import 'package:meta/meta.dart'; | |
| /// {@template jwt} | |
| /// A JWT token consists of three parts: the header, | |
| /// the payload, and the signature or encryption data. | |
| /// The first two elements are JSON objects of a specific structure. | |
| /// The third element is calculated based on the first two |
| void main() => runZonedGuarded<void>( | |
| () => runApp(const App()), | |
| (error, stackTrace) => log('Top level exception $error'), | |
| ); | |
| class App extends StatelessWidget { | |
| const App({super.key}); | |
| @override | |
| Widget build(BuildContext context) => MaterialApp( |
| /// Dependencies | |
| abstract interface class Dependencies { | |
| /// The state from the closest instance of this class. | |
| factory Dependencies.of(BuildContext context) => InheritedDependencies.of(context); | |
| /// Database | |
| abstract final Database database; | |
| } | |
| final class $MutableDependencies implements Dependencies { |
| // ignore_for_file: curly_braces_in_flow_control_structures | |
| /* | |
| * Performance benchmark of different ways to append data to a list. | |
| * https://gist.github.com/PlugFox/9849994d1f229967ef5dc408cb6b7647 | |
| * | |
| * BytesBuilder | builder.add(chunk) | 7 us. | |
| * AddAll | list.addAll(chunk) | 594 us. | |
| * Spread | [...list, ...chunk] | 1016446 us. | |
| * Concatenation | list + chunk | 1005022 us. |
| FROM dart:stable AS build_dart | |
| WORKDIR /app | |
| COPY ./tool/ ./tool/ | |
| RUN dart compile exe tool/web_env.dart -o tool/web-env | |
| FROM plugfox/flutter:stable-web AS build_web |