How to set url filter in mod-header - request-headers

I am trying to edit request headers and using modheader chrome extension. I use the following code, the question is how to set 'filters: []' here:
page.visit("chrome-extension://idgpnmonknjnojddfkpgkljpfnnfcklj/_generated_background_page.html")
json = JSON.generate([{title: 'Selenium', hideComment: true, appendMode: '',
headers: [{ enabled: true, name: 'name', value: 'value'}],
respHeaders: [],
filters: []
}])
page.execute_script "chrome.storage.local.set({'profiles': #{json}})"

Related

How do I convert part of a Terraform schema provider from interface {}([]interface {}) to an array of strings

I am creating a new resource in the aws-terraform-provider. In my schema, I have the following vpc options which is a complex type.
...
"vpc_options": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"subnets": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"security_groups": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
},
},
},
...
In hashicorp configuration language i am using this resource like this
vpc_options {
5 subnets = ["subnet-0be8cde92b74efcc8", "subnet-03a31237a28404445"]
6 security_groups = ["sg-0d3c85573d69473fb"]
7 }
I want to be able to use this resource. In order for me to use these fields effectively, I think I need the resource to be in the form of strings that I can use with the aws api calls for creation, deletion, update, and read. Even though I need these values to be strings, when I read the vpc_config in the debugger, I see that they are of type
interface {}([]interface {}) [map[string]interface {} ["subnets": *(*interface {})(0xc0063a8088), "security_groups": *(*interface {})(0xc0063a8098), ]]
Here is a picture of me inspecting the vpc_config in my debugger.
How should i go about converting this to an array of subnet strings and an array of security_groups strings. Then update the schema with d.Set("subnets",.... and d.Set("security_groups",....

How to use has object when rewriting url in Next.js?

This is how I use has object, but it has no effect. Why? When I remove has rewrite` will work out.
{
source: '/:organizationShortId/:postId/:tempUserShortId/:imgId',
has: [
{
type: 'header',
key: 'User-Agent',
value: 'facebook*',
},
],
destination:
'https://t44-post-cover.s3.eu-central-1.amazonaws.com/:imgId-patch',
permanent: false,
},
I expect User-Agent will be a substring of facebook.
https://developers.facebook.com/docs/sharing/webmasters/crawler/
Crawler IPs and User Agents
The Facebook crawler user agent strings:
facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)
facebookexternalhit/1.1
facebookcatalog/1.0

'Note' property not being added in clockify

How do I set the note field?
When I try to add a new Client with the following data (taken from logged request):
method: 'post',
data: '{"name":"Inger Lise Suprice AS","note":"10017"}',
I get the following response:
data: {
id: '***',
name: 'Inger Lise Suprice AS',
workspaceId: '***',
archived: false,
address: null,
note: null <-----
}
Notice the 'note' field is null, even though I set the field in the request.
I followed the example in the documentation. Assuming this is a bug.

How can I persist nested redux store

I want to persist nested object of my redux store. I tried https://github.com/rt2zz/redux-persist package but it doesn't work in my case. I wonder if it's possible to define a whitelist like this: 'user.statuses.verification.isDone'
This is my store:
{
user: {
statuses: {
verification: { isPending: true, isDone: false },
activation: { isPending: true, isDone: false },
set1: { isPending: true, isDone: false, refNumber: xxx },
set2: { isPending: true, isDone: false, refNumber: xxx },
},
},
}
I want to persist only "isDone" in every of statuses and "refNumber".
Can anyone help me?
I already tried nested persist as described in redux persist documentation https://github.com/rt2zz/redux-persist#nested-persists but looks like it has a limitation to 2 levels.
I tried this https://stackoverflow.com/a/71616665 and it works perfectly. 
In this example you can see the blacklist but you just need to replace it with the whitelist.
const config = getPersistConfig({
key: 'root',
storage: AsyncStorage,
whitelist: [
'user.statuses.verification.isDone’,
'user.statuses.activation.isDone’,
'user.statuses.set1.isDone’,
'user.statuses.set1.refNumber’,
'user.statuses.set2.isDone’,
'user.statuses.set2.refNumber’,
],
rootReducer, // your root reducer must be also passed here
... // any other props from the original redux-persist config omitting the stateReconciler
})
You need to use this package: https://github.com/edy/redux-persist-transform-filter
The "issue" has already been addressed, it's more a precise implementation choice, not an issue according to the maintainers, and you have several different ways to address it:
redux-persist - how do you blacklist/whitelist nested state

Metalsmith-permalinks failing to add path to metadata

I'm using metalsmith-permalinks with the following settings:
.use(permalinks({
pattern: ':title',
linksets: [{
match: { collection: 'blogposts' },
pattern: 'blog/:title'
}, {
match: { collection: 'portfolioposts' },
pattern: 'portfolio/:title'
}]
}))
However, logging files in the relevant collections shows that path isn't being added to their metadata:
layout: 'subpage.hbs',
title: 'Blog Post',
date: 2016-08-16T00:00:00.000Z,
excerpt: 'This post has an excerpt',
tags: [ 'test', 'test-tag', 'a-third-tag' ],
contents: <>,
mode: '0644',
stats: {},
collection: [ 'blogposts' ]
Permalinks is being called before layouts, meaning it can't be the same issue found here, and – as seen in the log – other plugins are adding metadata successfully.
My full build order is:
.use(collections({}))
.use(tags({}))
.use(permalinks({}))
.use(dateFormatter({}))
.use(markdown({}))
.use(helpers({}))
.use(layouts({}))
.use(rename({}))
And I'm running Metalsmith directly in Gulp. Any help would be greatly appreciated.

Resources