') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); der_derive v0.6.0 by tarcieri · Pull Request #652 · RustCrypto/formats · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion der/Cargo.toml
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,7 +17,7 @@ rust-version = "1.57"

[dependencies]
const-oid = { version = "0.9", optional = true, path = "../const-oid" }
der_derive = { version = "=0.6.0-pre.4", optional = true, path = "derive" }
der_derive = { version = "0.6", optional = true, path = "derive" }
flagset = { version = "0.4.3", optional = true }
pem-rfc7468 = { version = "0.6", optional = true, path = "../pem-rfc7468" }
time = { version = "0.3.4", optional = true, default-features = false }
Expand Down
30 changes: 30 additions & 0 deletions der/derive/CHANGELOG.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,36 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.6.0 (2022-05-08)
### Added
- Support for Context-Specific fields with default values ([#246])
- Context-Specific tags on `#[derive(Sequence)]` ([#349])
- `#[asn1(constructed = "true")]` ([#398])

### Changed
- Have `Sequence` macro derive `DecodeValue` ([#375])
- Pass `Header` to `DecodeValue` ([#392])
- Have `Choice` macro derive `EncodeValue` ([#395])
- Only emit `.try_into()?` when a type is specified ([#397])
- Use type's tag by default on `derive(Choice)` ([#416])

### Fixed
- Length calculation for explicit tags ([#400])

### Removed
- Static lifetime from ENUMERATED's derived `DecodeValue` ([#367])

[#246]: https://github.com/RustCrypto/formats/pull/246
[#349]: https://github.com/RustCrypto/formats/pull/349
[#367]: https://github.com/RustCrypto/formats/pull/367
[#375]: https://github.com/RustCrypto/formats/pull/375
[#392]: https://github.com/RustCrypto/formats/pull/392
[#395]: https://github.com/RustCrypto/formats/pull/395
[#397]: https://github.com/RustCrypto/formats/pull/397
[#398]: https://github.com/RustCrypto/formats/pull/398
[#400]: https://github.com/RustCrypto/formats/pull/400
[#416]: https://github.com/RustCrypto/formats/pull/416

## 0.5.0 (2021-11-15)
### Added
- `asn1(tag_mode = "...")` derive attribute ([#150])
Expand Down
4 changes: 2 additions & 2 deletions der/derive/Cargo.toml
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
[package]
name = "der_derive"
version = "0.6.0-pre.4" # Also update html_root_url in lib.rs when bumping this
version = "0.6.0"
description = "Custom derive support for the `der` crate's `Choice` and `Sequence` traits"
authors = ["RustCrypto Developers"]
license = "Apache-2.0 OR MIT"
documentation = "https://docs.rs/der"
repository = "https://github.com/RustCrypto/formats/tree/master/der/derive"
categories = ["cryptography", "data-structures", "encoding", "no-std"]
categories = ["cryptography", "data-structures", "encoding", "no-std", "parser-implementations"]
keywords = ["asn1", "der", "crypto", "itu", "pkcs"]
readme = "README.md"
edition = "2021"
Expand Down
9 changes: 7 additions & 2 deletions der/derive/src/lib.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -113,8 +113,13 @@
//! [`der::asn1::Utf8String`]: https://docs.rs/der/latest/der/asn1/struct.Utf8String.html

#![crate_type = "proc-macro"]
#![forbid(unsafe_code, clippy::unwrap_used)]
#![warn(rust_2018_idioms, trivial_casts, unused_qualifications)]
#![forbid(unsafe_code)]
#![warn(
clippy::unwrap_used,
rust_2018_idioms,
trivial_casts,
unused_qualifications
)]

mod asn1_type;
mod attributes;
Expand Down