OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::HttpServer::ResponseRedirect Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/HttpServer.hpp>

Inheritance diagram for Slic3r::GUI::HttpServer::ResponseRedirect:
Collaboration diagram for Slic3r::GUI::HttpServer::ResponseRedirect:

Public Member Functions

 ResponseRedirect (const std::string &location)
 ~ResponseRedirect () override=default
void write_response (std::stringstream &ssOut) override

Private Attributes

const std::string location_str

Detailed Description

Constructor & Destructor Documentation

◆ ResponseRedirect()

Slic3r::GUI::HttpServer::ResponseRedirect::ResponseRedirect ( const std::string & location)
inline
104: location_str(location) {}
const std::string location_str
Definition HttpServer.hpp:101

References location_str.

◆ ~ResponseRedirect()

Slic3r::GUI::HttpServer::ResponseRedirect::~ResponseRedirect ( )
overridedefault

Member Function Documentation

◆ write_response()

void Slic3r::GUI::HttpServer::ResponseRedirect::write_response ( std::stringstream & ssOut)
overridevirtual

Implements Slic3r::GUI::HttpServer::Response.

431{
432 const std::string sHTML =
433 "<html><head><meta charset=\"utf-8\">"
434 "<meta http-equiv=\"refresh\" content=\"0;url=" + location_str + "\">"
435 "<style>body{font-family:Arial,sans-serif;background:#f7f7f7;color:#222;margin:32px;}"
436 "a.button{display:inline-block;padding:10px 16px;margin-top:12px;background:#0f8bff;color:#fff;text-decoration:none;border-radius:6px;}"
437 "</style></head><body><div class=\"container\">"
438 "<h2>" + _u8L("Authentication complete") + "</h2>"
439 "<p>" + _u8L("You can return to OrcaSlicer. If your browser does not redirect automatically, use the button below.") + "</p>"
440 "<a class=\"button\" href=\"" + location_str + "\">" + _u8L("Continue") + "</a>"
441 "<script>setTimeout(function(){try{window.close();}catch(e){}},1500);</script>"
442 "</div></body></html>";
443 ssOut << "HTTP/1.1 302 Found" << std::endl;
444 ssOut << "Location: " << location_str << std::endl;
445 ssOut << "content-type: text/html" << std::endl;
446 ssOut << "content-length: " << sHTML.length() << std::endl;
447 ssOut << std::endl;
448 ssOut << sHTML;
449}
#define _u8L(s)
Definition I18N.hpp:11

References _u8L, and location_str.

Member Data Documentation

◆ location_str

const std::string Slic3r::GUI::HttpServer::ResponseRedirect::location_str
private

Referenced by ResponseRedirect(), and write_response().


The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/HttpServer.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/HttpServer.cpp