Changeset 1258


Ignore:
Timestamp:
01/16/10 23:37:58 (11 years ago)
Author:
alno
Message:

WebIf:

  • Shutdown Button implemented. This Button kills the Oscam. If you use a restart script you can use it as restart. However, Shutdown only ends oscam.
Location:
branches/monitor-improvement
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/monitor-improvement/oscam-http-helpers.c

    r1256 r1258  
    388388    fprintf(f, "Expires: Sat, 26 Jul 1997 05:00:00 GMT\r\n");
    389389    fprintf(f, "Last-Modified: %s\r\n", timebuf);
    390   fprintf(f, "Connection: close\r\n");
    391   fprintf(f, "\r\n");
     390    fprintf(f, "Connection: close\r\n");
     391    fprintf(f, "\r\n");
    392392}
    393393
  • branches/monitor-improvement/oscam-http.c

    r1256 r1258  
    99#include <dirent.h>
    1010#include <sys/socket.h>
     11
     12static int running = 1;
    1113
    1214void refresh_oscam(enum refreshtypes refreshtype, struct in_addr in){
     
    11741176}
    11751177
     1178void send_oscam_shutdown(struct templatevars *vars, FILE *f){
     1179    tpl_printf(vars, 0, "REFRESHTIME", "%d", SHUTDOWNREFRESH);
     1180    tpl_addVar(vars, 0, "REFRESH", tpl_getTpl(vars, "REFRESH"));
     1181    tpl_printf(vars, 0, "SECONDS", "%d", SHUTDOWNREFRESH);
     1182    fputs(tpl_getTpl(vars, "SHUTDOWN"), f);
     1183    running = 0;
     1184}
     1185
    11761186int process_request(FILE *f, struct in_addr in) {
    11771187  char buf[4096];
     
    11981208            "/site.css",
    11991209            "/services_edit.html",
    1200             "/savetemplates.html"};
     1210            "/savetemplates.html",
     1211            "/shutdown.html"};
    12011212  int pagescnt = sizeof(pages)/sizeof(char *);  // Calculate the amount of items in array
    12021213
     
    13051316        case  4: send_oscam_user_config(vars, f, &params, in); break;
    13061317        case  5: send_oscam_reader_config(vars, f, &params, in); break;
    1307         case    6: send_oscam_services(vars, f, &params, in); break;
     1318        case  6: send_oscam_services(vars, f, &params, in); break;
    13081319        case  7: send_oscam_user_config_edit(vars, f, &params, in); break;
    13091320        case  9: send_oscam_services_edit(vars, f, &params, in); break;
    13101321        case  10: send_oscam_savetpls(vars, f); break;
     1322        case  11: send_oscam_shutdown(vars, f); break;
    13111323        default: send_oscam_status(vars, f, &params, in); break;
    13121324      }
     
    13581370    }
    13591371    cs_log("HTTP Server listening on port %d", cfg->http_port);
    1360     while (1)
     1372    while (running)
    13611373    {
    13621374        int s;
     
    13751387  }
    13761388  close(sock);
    1377 }
     1389  kill(client[0].pid, SIGQUIT);
     1390}
  • branches/monitor-improvement/oscam-http.h

    r1244 r1258  
    77#define AUTHNONCEVALIDSECS 15
    88#define MAXGETPARAMS 100
     9#define SHUTDOWNREFRESH 30
    910
    1011#define CSS "\
     
    3031TABLE.menu{background-color:black; align:center; font-size: 10px;}\n\
    3132TABLE.menu TD{border:2px outset lightgrey; background-color:silver; font-color:black; font-family: Arial;}\n\
     33TABLE.menu TD.shutdown{border:2px outset lightgrey; background-color:orange; font-color:black; font-family: Arial;}\n\
    3234TD.menu {border:2px outset lightgrey; background-color:silver; font-color:black; font-family: Arial; font-size:11px;}\n\
    3335TABLE.configmenu{background-color:black; align:center; font-size: 10px;}\n\
     
    5557
    5658#define TPLREFRESH "\
    57 <meta http-equiv=\"refresh\" content=\"##REFRESHTIME##\"; URL=/status.html\" />\n"
     59<meta http-equiv=\"refresh\" content=\"##REFRESHTIME##; URL=/status.html\" />\n"
    5860
    5961#define TPLMENU "\
     
    6567      <TD CLASS=\"menu\"><A HREF=\"userconfig.html\">USERS</TD>\n\
    6668      <TD CLASS=\"menu\"><A HREF=\"services.html\">SERVICES</TD>\n\
     69      <TD CLASS=\"shutdown\"><A HREF=\"shutdown.html\">SHUTDOWN</TD>\n\
    6770    </TR>\n\
    6871  </TABLE>"
     
    855858##TPLFOOTER##"
    856859
     860#define TPLSHUTDOWN "##TPLHEADER##\
     861##TPLMENU##\n\
     862<br><b>Oscam Shutdown - Try Reconnect in ##SECONDS## Seconds</b><br>\n\
     863##TPLFOOTER##"
     864
    857865enum refreshtypes {REFR_ACCOUNTS, REFR_READERS, REFR_SERVER, REFR_ANTICASC, REFR_SERVICES};
    858866
     
    902910    "SERVICECONFIGLISTBIT",
    903911    "SERVICECONFIGSIDBIT",
    904     "SERVICEEDIT"
     912    "SERVICEEDIT",
     913    "SHUTDOWN"
    905914#ifdef HAVE_DVBAPI
    906915    ,"CONFIGDVBAPI"
     
    966975    TPLSERVICECONFIGLISTBIT,
    967976    TPLSERVICECONFIGSIDBIT,
    968     TPLSERVICEEDIT
     977    TPLSERVICEEDIT,
     978    TPLSHUTDOWN
    969979#ifdef HAVE_DVBAPI
    970980    ,TPLCONFIGDVBAPI
Note: See TracChangeset for help on using the changeset viewer.