Last major update: 25.08.2020
- Что такое авторизация/аутентификация
- Где хранить токены
- Как ставить куки ?
- Процесс логина
- Процесс рефреш токенов
- Кража токенов/Механизм контроля токенов
// ==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 |
import 'package:flutter/foundation.dart' show Listenable, ValueListenable, VoidCallback, ChangeNotifier; | |
/// Selector from [Listenable] | |
typedef ListenableSelector<Controller extends Listenable, Value> = Value Function( | |
Controller controller, | |
); | |
/// Filter for [Listenable] | |
typedef ListenableFilter<Value> = bool Function(Value prev, Value next); |
/* | |
* Dart data class example | |
* https://gist.github.com/PlugFox/6a6d73a7822001af7f8558df89dbc60d | |
* https://dartpad.dev/6a6d73a7822001af7f8558df89dbc60d | |
* Matiunin Mikhail <[email protected]>, 16 May 2022 | |
*/ | |
import 'package:meta/meta.dart'; | |
void main() => |
/* | |
* Custom progress indicator | |
* https://gist.github.com/PlugFox/d2274f2d4278473774b79b0020cbd618 | |
* https://dartpad.dev/d2274f2d4278473774b79b0020cbd618 | |
* Matiunin Mikhail <[email protected]>, 1 May 2022 | |
*/ | |
import 'dart:async'; | |
import 'dart:math' as math; |