iOS Content Blocker Whitelist Website - ios

In my content blocker, is there a way to prevent ad-blocking on a certain website? For example, if I want to block ads on all websites besides The Verge, is there a way to prevent the blocking rules I provided from affecting this page?

The above answer is unfortunately incorrect for two reasons, the url-filter attribute is required in the trigger and the if-domain attribute must be an array of domain(s), not a single value. After a lot of trial and error I have found a working solution to whitelist a website.
{
"trigger": {
"url-filter": ".*",
"if-domain": ["the verge.com"]
},
"action": {
"type": "ignore-previous-rules"
}
}
The only documentation I was able to find on what was causing various errors using the above answer was scouring the source code here: https://github.com/WebKit/webkit/tree/67985c34ffc405f69995e8a35f9c38618625c403/Source/WebCore/contentextensions

this article tells the solution http://comments.gmane.org/gmane.os.opendarwin.webkit.user/3971
{
"action": {
"type": "ignore-previous-rules"
},
"trigger": {
"url-filter": ".*",
"if-domain": ["*apple.com"]
}
}

I think you would do something like this.
"action": {
"type": “ignore-previous-rules”
},
"trigger": {
“if-domain”: “theverge.com”
}
Some good links to check out.
Safari Extensibility: Content Blocking and Shared Links
Safari Content Blocking in iOS 9: a tutorial by example

Related

Twilio Autopilot SMS not accepting media image type

I wrote a task a while back that would run a collect flow and collect an image using the model on the docs for doing so (https://www.twilio.com/docs/autopilot/actions/collect#questions). It ran flawlessly, and I tested it to make sure it ran as expected.
I made a new account using the company email to migrate my work over, and continue implementing the code, and eventually reached the portion where I needed to integrate that media collection. I used the same code, but it didn't work. The collect flow keeps on triggering the validate portion and telling me that it isn't an accepted type. I have tried it using the exact code from before as well as the exact image, but it still isn't working. The only thing I can think of is if the phone number was set up differently somehow. The message logs show the image as sent and looks fine and I can't find any differences other than that.
Is there anything that might be causing this? Here is the code for reference
{
"actions": [
{
"collect": {
"name": "image_collect",
"questions": [
{
"question": "Please upload an image",
"name": "image",
"type": "Twilio.MEDIA",
"validate": {
"on_failure": {
"messages": [
{
"say": "We do not accept this format. Please send another image."
}
]
},
"allowed_types": {
"list": [
"image/jpeg",
"image/gif",
"image/png",
"image/bmp",
"application/pdf"
]
}
}
}
],
"on_complete": {
"redirect": "https://4894-100-33-3-193.ngrok.io/image_processing"
}
}
}
]
}
Generally, media size causes this issue, just make sure the file size is within the limits.
For more info - https://www.twilio.com/docs/sms/accepted-mime-types

Unfurl links blocks template

I'm using the link_shared events to unfurl links in my workspace, trying to generate a template that is as close to Slack's unfurling template as possible, but I have several issues -
Blocks have very large spacing between them, causing my 3 blocks to take a lot of space
I'm unable to have an image inlined with the text for the title, unless I'm using context, but this is causing the text to be very small.
Taking Slack's example of how link unfurling should look like and trying to mimic it with blocks should explain the differences. This is the blocks message, and here you can see the result as an image
So my main question is - does Slack use some internal blocks formatting not available in the API, or is it possible to achieve the same result?
Thanks a lot!
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":pager: *Slack*"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*<https://slack.com/features|Features>*"
}
},
{
"type": "image",
"title": {
"type": "plain_text",
"text": "Slack is where work flows. It's where the people you need, the information you share, and the tool you use come together to get things done.",
"emoji": true
},
"image_url": "https://a.slack-edge.com/13f94ee/marketing/img/homepage/self-serve-campaign/unfurl/img-unfurl-ss-campaign.jpg",
"alt_text": "Slack"
}
]
}
That example is not using the Slack block unfurl - it's an example of how a generic link would be displayed using the page's meta tags to display some additional information, using the favicon image.
If you wanted to create something similar you could use use a markdown block and an image block (like this) - but the file size would be displayed on a new line rather than after the text.
It took a bit of playing around, but I realized Slack is actually using message attachments (the legacy version of message formatting) in order to generate their link unfurls.
For example, if you want to unfurl a GitHub repository link, this is the payload you should send, and it'll generate an almost identical unfurling to what Slack is generating (a small Added by {app-name} will be added to the footer) -
unfurls["https://github.com/slackapi/bolt-js/"] = {
author_name: "GitHub",
author_icon: "https://a.slack-edge.com/80588/img/unfurl_icons/github.png",
title: "GitHub - slackapi/bolt-js: A framework to build Slack apps using JavaScript",
title_link: "https://github.com/slackapi/bolt-js/",
text: "A framework to build Slack apps using JavaScript. Contribute to slackapi/bolt-js development by creating an account on GitHub.",
image_url: "https://opengraph.githubassets.com/3e06f7eee96f05a53cd4905af3b296dfe333be7a902bb3e6a095770e87fd17fe/slackapi/bolt-js"
}

Can't add Teams bot to a channel

This was originally a support ticket to Microsoft. However they told they don't do dev support without paying for it. They directed me to Stack Overflow, so here goes nothing.
I'm developing a Bot for Microsoft Teams. I have registered my bot with Azure Active Directory, & Bot Framework. I have uploaded my app to Team, without any errors. My bot is currently able to send direct messages to Teams users. However, when I try to add my bot to a Teams channel, I get unhelpful errors.
I click the dropdown under my app in the Apps tab:
I click "Add to a Team", then select a channel:
After clicking the button "Set up a bot", I get the following error message:
I have checked & rechecked my webApplicationInfo.id & webApplicationInfo.applicationPermissions numerous times, and I'm at a loss for what could be amiss. I don't see how either of these fields could be wrong given, I can authenticate with both the Microsoft Graph & Bot Framework apis using these values. Here's a slightly redacted version of my Teams app manifest:
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.8/MicrosoftTeams.schema.json",
"manifestVersion": "1.8",
"version": "1.0.15",
"id": "<TEAMS_APP_ID>",
"packageName": "ambition",
"developer": {
"name": "Ambition",
"websiteUrl": "https://ambition.com",
"privacyUrl": "https://ambition.com/privacy",
"termsOfUseUrl": "https://ambition.com/pages/terms"
},
"icons": {
"color": "logo_opaque_192x192.png",
"outline": "logo_transparent_32x32.png"
},
"name": {
"short": "Ambition",
"full": ""
},
"description": {
"short": "Motivate & Recognize",
"full": "Ask Marketing"
},
"accentColor": "#FFFFFF",
"permissions": [
"identity",
"messageTeamMembers"
],
"validDomains": [
"ambition.com"
],
"bots": [
{
"botId": "<AZURE_ACTIVE_DIRECTORY_CLIENT_ID>",
"scopes": [
"team",
"personal",
"groupchat"
],
"isNotificationOnly": true
}
],
"webApplicationInfo": {
"id": "<AZURE_ACTIVE_DIRECTORY_CLIENT_ID>",
"resource": "https://ambition.com",
"applicationPermissions": [
"Channel.ReadBasic.All",
"ChannelMessage.Send",
"Group.Read.All",
"Notifications.ReadWrite.CreatedByApp",
"Team.ReadBasic.All",
"User.Read",
"User.ReadBasic.All"
]
}
}
The webApplicationInfo section is really only for two things: Tab SSO, and Resource-Specific Consent. Are you trying to implement either one of those? If not, removing it is definitely the best option, as you've noted in your answer.
In addition, I see that the resource values you've put in there are Microsoft Graph Scopes, whereas the applicationPermissions section is expecting a different list of options (they look kind of similar, but their not the same thing). See here for more: https://learn.microsoft.com/en-gb/microsoftteams/platform/graph-api/rsc/resource-specific-consent#resource-specific-permissions
Don't really know why this works, but I compared my app manifest to the one generated by going through this tutorial: https://learn.microsoft.com/en-us/microsoftteams/platform/build-your-first-app/build-bot.
Removing the webApplicationInfo property from my manifest fixed the issue. Don't really understand why it was causing a problem in the first place.
https://learn.microsoft.com/en-us/microsoftteams/platform/resources/schema/manifest-schema#webapplicationinfo

How to implement deeplinks in KaiOS

A user should be able to click on a link like app:this/is/some/link?with=information and the desired app opens and does some action.
This question is similar but just the other side to
KaiOS - Share using WhatsApp. Another application should link to my application.
Is this possible in KaiOS?
Deeplinks do exist on KaiOS 2.5.3 or newer, but there is no documentation on them. For example, this is from the KaiStore app manifest:
"deeplinks": {
"regex": "^(app://)(kaios-store|kaios-plus)(.kaiostech.com)($|/$|/\\?(apps|postResult)=)",
"action": "open-deeplink"
},
"activities": {
"open-deeplink": {
"href": "./index.html",
"disposition": "window",
"filters": {
"type": "url",
"url": {
"required": true,
"pattern": "(app|rtsp|data):.{1,16384}"
}
},
"returnValue": true
},
}
The action under deeplinks points to one of the activities, which must accept a required URL parameter. An app can then register using navigator.mozSetMessageHandler to handle this activity (see B2G's Web Activities API).
That said, there is no way to deep-link to arbitrary apps. Apps must expose Web Activities in their manifest in order to be open-able by other apps.

How to access full source of old commit in BitBucket?

I can't figure out or find the documentation on how to access the source of an old commit in the new Bit Bucket format. Is this even possible anymore?
I understand you want to download an older version via the BitBucket web interface without using a Mercurial/Git client.
Check this related question. On the comments, someone says that there is no way to do that. Fortunately, that's not entirely true.
By navigating on BitBucket project pages, I found no link to download an arbitrary version. There are links to download specific tags, in the format:
https://bitbucket.org/owner/repository/get/v0.1.2.tar.gz
But by tweaking a bit the url above, changing the tag name by the commit hash, like:
https://bitbucket.org/owner/repository/get/A0B1C2D.tar.gz
You can actually download a specific version.
As mentioned by Rakka Rage in a comment, replacing .tar.gz by .zip works too.
I was trying to figure out if it's possible to browse the code of an earlier commit like you can on GitHub and it brought me here. I used the information I found here, and after fiddling around with the urls, I actually found a way to browse code of old commits as well.
When you're browsing your code the URL is something like:
https://bitbucket.org/user/repo/src/
and by adding a commit hash at the end like this:
https://bitbucket.org/user/repo/src/a0328cb
You can browse the code at the point of that commit. I don't understand why there's no dropdown box for choosing a commit directly, the feature is already there. Strange.
Step 1
Step 2
Step 3
Step 4
Final Step
Just in case anyone is in my boat where none of these answers worked exactly, here's what I did.
Perhaps our in house Bitbucket server is set up a little differently than most, but here's the URL that I'd normally go to just to view the files in the master branch:
https://<BITBUCKET_URL>/projects/<PROJECT_GROUP>/repos/<REPO_NAME>/browse
If I select a different branch than master from the drop down menu, I get this:
https://<BITBUCKET_URL>/projects/<PROJECT_GROUP>/repos/<REPO_NAME>/browse?at=refs%2Fheads%2F<BRANCH_NAME>
So I tried doing this and it worked:
https://<BITBUCKET_URL>/projects/<PROJECT_GROUP>/repos/<REPO_NAME>/browse?at=<COMMIT_ID>
Now I can browse the whole repo as it was at the time of that commit.
Great answers from a couple of years ago. Now Bitbucket has made it easier.
Tag the Commit you want to download (as mentioned in answer by Rudy Matela).
Then head over to Downloads and click the "Tags" tab and you'll get multiple options for download.
For the record, you can also toy around URLs this way :
When browsing the latest source, you have something like :
https://bitbucket.org/my/repo/src/latestcommithash/my.file?at=master
Simply change the commit hash and remove the GET parameter :
https://bitbucket.org/my/repo/src/wantedcommithash/my.file
Got to +1 #Hein A. Grønnestad above : it's all working, really wondering why there's nothing in the GUI to use it.
Add this to the end of any url: ?at=102beada4f1 (using the relevant commit SHA).
Note: the parameter is 'forgotten' with every new page load, so get ctrl + c and ctrl + v ready.
It's astonishing that BitBucket/Stash has no 'Browse files' button in the UI, like GitHub has:
Sigh.
You can view the source of the file up to a particular commit by appending
?until=<sha-of-commit> in the URL (after the file name).
The easiest way is to click on that commit and add a tag to that commit.
I have included the tag 'last_commit' with this commit
Than go to downloads in the left corner of the side nav in bit bucket.
Click on download in the left side
Now click on tags in the nav bar and download the zip from the UI.
Find your tag and download the zip
You can view it on your BitBucket web site
As explained on Atlassian community site, it's enough to go to the Source page (available from left side menu) and put your commit id in the at= query parameter of the url. So, for example, the url will end with ?at=bacf2ad3095.
I know it's too late, but with API 2.0 you can do
from command line with:
curl https://api.bitbucket.org/2.0/repositories/<user>/<repo>/filehistory/<branch>/<path_file>
or in php with:
$data = json_decode(file_get_contents("https://api.bitbucket.org/2.0/repositories/<user>/<repo>/filehistory/<branch>/<path_file>", true));
then you have the history of your file (from the most recent commit to the oldest one):
{
"pagelen": 50,
"values": [
{
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/<user>/<repo>/src/<hash>/<path_file>"
},
"meta": {
"href": "https://api.bitbucket.org/2.0/repositories/<user>/<repo>/src/<HEAD>/<path_file>?format=meta"
},
"history": {
"href": "https://api.bitbucket.org/2.0/repositories/<user>/<repo>/filehistory/<HEAD>/<path_file>"
}
},
"commit": {
"hash": "<HEAD>",
"type": "commit",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/<user>/<repo>/commit/<HEAD>"
},
"html": {
"href": "https://bitbucket.org/<user>/<repo>/commits/<HEAD>"
}
}
},
"attributes": [],
"path": "<path_file>",
"type": "commit_file",
"size": 31
},
{
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/<user>/<repo>/src/<HEAD~1>/<path_file>"
},
"meta": {
"href": "https://api.bitbucket.org/2.0/repositories/<user>/<repo>/src/<HEAD~1>/<path_file>?format=meta"
},
"history": {
"href": "https://api.bitbucket.org/2.0/repositories/<user>/<repo>/filehistory/<HEAD~1>/<path_file>"
}
},
"commit": {
"hash": "<HEAD~1>",
"type": "commit",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/<user>/<repo>/commit/<HEAD~1>"
},
"html": {
"href": "https://bitbucket.org/<user>/<repo>/commits/<HEAD~1>"
}
}
},
"attributes": [],
"path": "<path_file>",
"type": "commit_file",
"size": 20
}
],
"page": 1
}
where values > links > self provides the file at the moment in the history which you can retrieve it with curl <link> or file_get_contents(<link>).
Eventually, from the command line you can filter with:
curl https://api.bitbucket.org/2.0/repositories/<user>/<repo>/filehistory/<branch>/<path_file>?fields=values.links.self
in php, just make a foreach loop on the array $data.
Note: if <path_file> has a / you have to convert it in %2F.
See the doc here: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/filehistory/%7Bnode%7D/%7Bpath%7D
Search it for a long time, and finally, I found how to do it:)
Please check this image which illustrates steps.
In my case with Atlassian Bitbucket v6.10
https://<bitbucket.myserver.it>/projects/<myproject>/repos/<myrepo>/browse?at=<full-commit-hash>

Resources