key => 1,
checktime => 1,
status => 1,
+ message => 0,
validdirectory => 1,
productname => 1,
regdate => 1,
return undef if $info->{status} ne 'Active';
foreach my $f (keys %$saved_fields) {
+ next if !$saved_fields->{$f};
if (!$info->{$f}) {
die "Missing field '$f'\n";
}
sub check_subscription {
my ($key) = @_;
- my $whmcsurl = "http://shop2.maurer-it.com";
+ my $whmcsurl = "https://shop.maurer-it.com";
my $uri = "$whmcsurl/modules/servers/licensing/verify.php";
$req->header('Content-Length' => length($content));
$req->content($content);
- my $ua = LWP::UserAgent->new(protocols_allowed => ['http'], timeout => 30);
+ my $ua = LWP::UserAgent->new(protocols_allowed => ['https'], timeout => 30);
if ($proxy) {
- $ua->proxy(['http'], $proxy);
+ $ua->proxy(['http', 'https'], $proxy);
} else {
$ua->env_proxy;
}
my $subinfo = {};
while ($raw =~ m/<(.*?)>([^<]+)<\/\1>/g) {
my ($k, $v) = ($1, $2);
- next if !($k eq 'md5hash' || $saved_fields->{$k});
+ next if !($k eq 'md5hash' || defined($saved_fields->{$k}));
$subinfo->{$k} = $v;
}
$subinfo->{checktime} = time();
$subinfo->{key} = $key;
+ if ($subinfo->{message}) {
+ $subinfo->{message} =~ s/^Directory Invalid$/Invalid Server ID/;
+ }
+
my $emd5sum = md5_hex($shared_key_data . $check_token);
if ($subinfo->{status} && $subinfo->{status} eq 'Active') {
if (!$subinfo->{md5hash} || ($subinfo->{md5hash} ne $emd5sum)) {
code => sub {
my ($param) = @_;
+ my $server_id = get_hwaddress();
+
my $info = PVE::INotify::read_file('subscription');
if (!$info) {
return {
status => "NotFound",
message => "There is no subscription key",
+ serverid => $server_id,
}
}
+
+ $info->{serverid} = $server_id;
+ $info->{sockets} = get_sockets();
+
return $info
}});
node/NetworkEdit.js \
node/NetworkView.js \
node/Tasks.js \
+ node/Subscription.js \
node/Config.js \
qemu/StatusView.js \
window/Migrate.js \
dc/AuthEdit.js \
dc/Backup.js \
dc/HAConfig.js \
+ dc/Support.js \
dc/Config.js \
Workspace.js
hprefix: 'v1',
compDict: {
+ ha: 28,
+ support: 27,
pool: 26,
syslog: 25,
ubc: 24,
xtype: 'pveDcHAConfig',
title: 'HA',
itemId: 'ha'
+ },
+ {
+ xtype: 'pveDcSupport',
+ title: gettext('Support'),
+ itemId: 'support'
}
]
});
--- /dev/null
+Ext.define('PVE.dc.Support', {
+ extend: 'Ext.panel.Panel',
+ alias: 'widget.pveDcSupport',
+
+ invalidHtml: '<h1>No valid subscription</h1>You do not have a valid subscription for this server. Please visit <a target="_blank" href="https://www.proxmox.com/products/proxmox-ve/subscription-service-plans">www.proxmox.com</a> to get a list of available options.',
+
+ communityHtml: 'Please use the public community <a target="_blank" href="http://forum.proxmox.com">forum</a> for any questions.',
+
+ activeHtml: 'Please use our <a target="_blank" href="http://my.proxmox.com">support portal</a> for any questions. You can also use the public community <a target="_blank" href="http://forum.proxmox.com">forum</a> to get additional information.',
+
+ bugzillaHtml: '<h1>Bug Tracking</h1>Our bug tracking system is available <a target="_blank" href="https://bugzilla.proxmox.com">here</a>.',
+
+ docuHtml: '<h1>Documentation</h1>Complete documentation, tutorials, videos and more is available at our <a target="_blank" href="https://pve.proxmox.com/wiki/Documentation">wiki</a>.',
+
+ updateActive: function(data) {
+ var me = this;
+
+ var html = '<h1>' + data.productname + '</h1>' + me.activeHtml;
+ html += '<br><br>' + me.docuHtml;
+ html += '<br><br>' + me.bugzillaHtml;
+
+ me.update(html);
+ },
+
+ updateCommunity: function(data) {
+ var me = this;
+
+ var html = '<h1>' + data.productname + '</h1>' + me.communityHtml;
+ html += '<br><br>' + me.docuHtml;
+ html += '<br><br>' + me.bugzillaHtml;
+
+ me.update(html);
+ },
+
+ updateInactive: function(data) {
+ var me = this;
+ me.update(me.invalidHtml);
+ },
+
+ initComponent: function() {
+ var me = this;
+
+ var reload = function() {
+ PVE.Utils.API2Request({
+ url: '/nodes/localhost/subscription',
+ method: 'GET',
+ waitMsgTarget: me,
+ failure: function(response, opts) {
+ Ext.Msg.alert('Error', response.htmlStatus);
+ me.update("Unable to load subscription status: " + response.htmlStatus);
+ },
+ success: function(response, opts) {
+ var data = response.result.data;
+
+ if (data.status === 'Active') {
+ if (data.level === 'c') {
+ me.updateCommunity(data);
+ } else {
+ me.updateActive(data);
+ }
+ } else {
+ me.updateInactive(data);
+ }
+ }
+ });
+ };
+
+ Ext.apply(me, {
+ autoScroll: true,
+ bodyStyle: 'padding:10px',
+ listeners: {
+ show: reload
+ }
+ });
+
+ me.callParent();
+ }
+});
\ No newline at end of file
title: 'UBC',
itemId: 'ubc',
xtype: 'pveNodeBCFailCnt'
+ },
+ {
+ title: 'Subscription',
+ itemId: 'support',
+ xtype: 'pveNodeSubscription',
+ nodename: nodename
}
]
});
--- /dev/null
+Ext.define('PVE.node.SubscriptionKeyEdit', {
+ extend: 'PVE.window.Edit',
+
+ initComponent : function() {
+ var me = this;
+
+ Ext.apply(me, {
+ title: gettext('Upload Subscription Key'),
+ width: 300,
+ items: {
+ xtype: 'textfield',
+ name: 'key',
+ value: '',
+ fieldLabel: gettext('Subscription Key')
+ }
+ });
+
+ me.callParent();
+
+ me.load();
+ }
+});
+
+Ext.define('PVE.node.Subscription', {
+ extend: 'PVE.grid.ObjectGrid',
+
+ alias: ['widget.pveNodeSubscription'],
+
+ features: [ {ftype: 'selectable'}],
+
+ initComponent : function() {
+ var me = this;
+
+ if (!me.nodename) {
+ throw "no node name specified";
+ }
+
+ var reload = function() {
+ me.rstore.load();
+ };
+
+ var baseurl = '/nodes/' + me.nodename + '/subscription';
+
+ var render_status = function(value) {
+
+ var message = me.getObjectValue('message');
+
+ if (message) {
+ return value + ": " + message;
+ }
+ return value;
+ };
+
+ var rows = {
+ productname: {
+ header: gettext('Type')
+ },
+ key: {
+ header: gettext('Subscription Key')
+ },
+ status: {
+ header: gettext('Status'),
+ renderer: render_status
+ },
+ message: {
+ visible: false
+ },
+ serverid: {
+ header: gettext('Server ID')
+ },
+ sockets: {
+ header: 'Sockets'
+ },
+ checktime: {
+ header: 'Last checked',
+ renderer: PVE.Utils.render_timestamp
+ }
+ };
+
+ Ext.applyIf(me, {
+ url: '/api2/json' + baseurl,
+ cwidth1: 170,
+ tbar: [
+ {
+ text: gettext('Upload Subscription Key'),
+ handler: function() {
+ var win = Ext.create('PVE.node.SubscriptionKeyEdit', {
+ url: '/api2/extjs/' + baseurl
+ });
+ win.show();
+ win.on('destroy', reload);
+ }
+ },
+ {
+ text: gettext('Check'),
+ handler: function() {
+ PVE.Utils.API2Request({
+ params: { force: 1 },
+ url: baseurl,
+ method: 'POST',
+ waitMsgTarget: me,
+ failure: function(response, opts) {
+ Ext.Msg.alert('Error', response.htmlStatus);
+ },
+ callback: reload
+ });
+ }
+ }
+ ],
+ rows: rows,
+ listeners: {
+ show: reload
+ }
+ });
+
+ me.callParent();
+ }
+}, function() {
+
+ Ext.define('pve-services', {
+ extend: 'Ext.data.Model',
+ fields: [ 'service', 'name', 'desc', 'state' ],
+ idProperty: 'service'
+ });
+
+});