GithubHelp home page GithubHelp logo

Comments (12)

mwrock avatar mwrock commented on September 28, 2024

Iโ€™m open to pull requests to address this but with the bulk of boxstarter features and other projects I am involved with, I donโ€™t really have cycles to tackle this.

from boxstarter.

Redsandro avatar Redsandro commented on September 28, 2024

@mwrock How much trouble is it to skip the custom text mentioned above and just display the origin or the referer?

Is it possible that when we click from a website, it is shown without the custom text?

E.g.

Boxstarter Version x
(c) Matt Wrock. http://boxstarter.org

Running from http://WindowsRemix.com

Normal boxstarter output here

from boxstarter.

Redsandro avatar Redsandro commented on September 28, 2024

@mwrock Can you provide a link to the file where the command prompt output is output?

from boxstarter.

gep13 avatar gep13 commented on September 28, 2024

@Redsandro for the part that you have listed above, that would come under here:

https://github.com/mwrock/boxstarter/blob/8d964f36108da8cfc5c51d7da6fc5d9967b583d5/BoxStarter.Common/Write-BoxstarterLogo.ps1

Gary

from boxstarter.

mwrock avatar mwrock commented on September 28, 2024

One thing to keep in mind is that once the code has reached the powershell modules, the http context of the initial boxstarter.org request is gone. Here is a rough flow of how the "click-once" installs work:

  1. browser makes web request to boxstarter.org
  2. the "click-once" endpoint uses a deployment manifest to send back all the boxstarter bits to the client
  3. The click-once client code unpackages those bits and finally invokes the boxstarter.clickonce C# dll
  4. that dll invokes the boxstarter powershell which kicks off the boxstarter run

Everything prior to calling the boxstarter.clickonce dll is part of proprietary "click-once" goo where boxstarter doesn't actively do anything. The dll I refer to really acts as a packaging conduit for all the boxstarter powershell and a single C# file: launcher.cs.

see https://github.com/mwrock/boxstarter/blob/master/Boxstarter.ClickOnce/Launcher.cs

That is the file that interacts with some click-once API stuff and builds out the call to boxstarter telling it which package it is going to need to install. Here is where you would be able to get the referrer and you would need to pass that on to the boxstarter call.

I'm not sure what the call is to get the referrer but there must be one (at least I would assume) and it should be fairly easy to look up.

from boxstarter.

Redsandro avatar Redsandro commented on September 28, 2024

I'm not sure how your magic works, but I'm assuming you need to pass everything you want to use later on to boxstarter.bat using psArgs, no?

Would something like this work for that?

using System;
using System.Web;
using System.Web.Util;

HttpContext context = HttpContext.Current;
HttpRequest request = context != null ? context.Request : null;
HttpResponse response = context != null ? context.Response : null;

$remoteAddr = request.ServerVariables["REMOTE_ADDR"];
$referer = request.ServerVariables["HTTP_REFERER"];

// if $remoteAddr != null
psArgs += " -remoteAddr = $remoteAddr"

// if $referer != null
psArgs += " -referer = $referer"

// Process.Start(processInfo);

I'm pretending to know this language a lot better than I actually do. I thought using this as a reference would make this more credible: https://github.com/Microsoft/referencesource/blob/master/System.Web/UI/ViewStateException.cs

from boxstarter.

mwrock avatar mwrock commented on September 28, 2024

Hmmm. I dont think that will work. Inside launcher.cs, there is no HttpContext. Keep in mind this is executing on the client. The click-once API simply packages some of the relevant values of the HttpContext it had on the server and makes it available in the ApplicationDeployment object. I think you will need to do some googling on ApplicationDeployment to see what properties it exposes.

from boxstarter.

Redsandro avatar Redsandro commented on September 28, 2024

I can't find what I am hoping to find. But another possibility seems to be adding an identifier/label/referer in the clickOnce querystring:

private NameValueCollection GetQueryStringParameters()
{
    NameValueCollection nameValueTable = new NameValueCollection();

    if (ApplicationDeployment.IsNetworkDeployed)
    {
        string queryString = ApplicationDeployment.CurrentDeployment.ActivationUri.Query;
        nameValueTable = HttpUtility.ParseQueryString(queryString);
    }

    return (nameValueTable);
}

as found in the answer to this question:
https://stackoverflow.com/questions/9734704/net-clickonce-application-can-resolve-de-url-or-domain-of-the-page-from-it-was

We could probably append ?referer=some+label+or+url+here to the url if this is acceptable and not conflicting with the rest of the workings of Boxstarter.

from boxstarter.

mwrock avatar mwrock commented on September 28, 2024

Yeah that would work. Also I did a check on the information available via the ApplicationDeployment object and there is no referrer information so this is likely the only feasible approach.

You would need to edit the url rewrite rules in https://github.com/mwrock/boxstarter/blob/master/Web/Web.config to make sure the referrer gits put in the rewritten url.

from boxstarter.

Redsandro avatar Redsandro commented on September 28, 2024

Hmm.. let's see. Your usage of querystring is not according to standards, making this a little harder. Basically you use a variablename as a value when providing the url, leaving no room to add other variables.

However, looking at this, I think we might be able to pass in the referer after all, ignoring the querystring. Although I'm not sure. You use QUERY_STRING here, which is a variable from the request. Doesn't that mean you can use HTTP_REFERER here too?

That would mean in every <action/> for url you would simply append &amp;referer={HTTP_REFERER}, and we're one step closer.

If this works, this would be the easier solution. And it's always nice to use the actual referer.


Typo of the week:

You can sue this information to make rewriting decisions

http://www.iis.net/learn/extensions/url-rewrite-module/url-rewrite-module-configuration-reference

from boxstarter.

mwrock avatar mwrock commented on September 28, 2024

Yeah its been a long while since touching this code. And my suit is still stuck in legal red tape :)

from boxstarter.

Redsandro avatar Redsandro commented on September 28, 2024

@mwrock

I've been looking around a few times, but this construct/language is really complex for me.

I still hear this "I look like I'm being hacked" when people use WindowsRemix sometimes, mostly because there is no 'branding'. I'd love for you to find a way to implement a string parameter one can optionally pass to Boxstarter that it prints.

I could say "Windows Remix is applying the requested operations."

Possibly even add an origin in your code: "Script launched from: ". This has the added benefit of identifying the source if the script was actually launched from a fishy source. If that ever happens.

image

from boxstarter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.